commit_id
stringlengths 40
40
| project
stringclasses 90
values | commit_message
stringlengths 5
2.21k
| type
stringclasses 3
values | url
stringclasses 89
values | git_diff
stringlengths 283
4.32M
|
|---|---|---|---|---|---|
eb831a81621c685e710b9ff75b1ac7f5c340d1db
|
orientdb
|
Issue 161: added the support for custom strategy- on creation of records- http://code.google.com/p/orient/wiki/Security-Customize_on_creation--
|
a
|
https://github.com/orientechnologies/orientdb
|
diff --git a/build.number b/build.number
index 0928ce53e5d..0e16b998107 100644
--- a/build.number
+++ b/build.number
@@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
-#Mon Oct 01 16:53:04 CEST 2012
-build.number=12603
+#Mon Oct 01 18:00:48 CEST 2012
+build.number=12604
diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/ORestrictedAccessHook.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/ORestrictedAccessHook.java
index e2267e1490f..3a8a81eef1b 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/ORestrictedAccessHook.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/ORestrictedAccessHook.java
@@ -15,15 +15,16 @@
*/
package com.orientechnologies.orient.core.metadata.security;
-import java.util.HashSet;
import java.util.Set;
import com.orientechnologies.orient.core.db.ODatabaseRecordThreadLocal;
import com.orientechnologies.orient.core.db.record.ODatabaseRecord;
import com.orientechnologies.orient.core.db.record.OIdentifiable;
+import com.orientechnologies.orient.core.exception.OConfigurationException;
import com.orientechnologies.orient.core.exception.OSecurityException;
import com.orientechnologies.orient.core.hook.ODocumentHookAbstract;
import com.orientechnologies.orient.core.metadata.schema.OClass;
+import com.orientechnologies.orient.core.metadata.schema.OClassImpl;
import com.orientechnologies.orient.core.record.impl.ODocument;
/**
@@ -40,14 +41,32 @@ public ORestrictedAccessHook() {
public RESULT onRecordBeforeCreate(final ODocument iDocument) {
final OClass cls = iDocument.getSchemaClass();
if (cls != null && cls.isSubClassOf(OSecurityShared.RESTRICTED_CLASSNAME)) {
- Set<OIdentifiable> allowed = iDocument.field(OSecurityShared.ALLOW_ALL_FIELD);
- if (allowed == null) {
- allowed = new HashSet<OIdentifiable>();
- iDocument.field(OSecurityShared.ALLOW_ALL_FIELD, allowed);
- }
- allowed.add(ODatabaseRecordThreadLocal.INSTANCE.get().getUser().getDocument().getIdentity());
+ String fieldNames = ((OClassImpl) cls).getCustom(OSecurityShared.ONCREATE_FIELD);
+ if (fieldNames == null)
+ fieldNames = OSecurityShared.ALLOW_ALL_FIELD;
+ final String[] fields = fieldNames.split(",");
+ String identityType = ((OClassImpl) cls).getCustom(OSecurityShared.ONCREATE_IDENTITY_TYPE);
+ if (identityType == null)
+ identityType = "user";
+
+ final ODatabaseRecord db = ODatabaseRecordThreadLocal.INSTANCE.get();
- return RESULT.RECORD_CHANGED;
+ ODocument identity = null;
+ if (identityType.equals("user"))
+ identity = db.getUser().getDocument();
+ else if (identityType.equals("role")) {
+ final Set<ORole> roles = db.getUser().getRoles();
+ if (!roles.isEmpty())
+ identity = roles.iterator().next().getDocument();
+ } else
+ throw new OConfigurationException("Wrong custom field '" + OSecurityShared.ONCREATE_IDENTITY_TYPE + "' in class '"
+ + cls.getName() + "' with value '" + identityType + "'. Supported ones are: 'user', 'role'");
+
+ if (identity != null) {
+ for (String f : fields)
+ db.getMetadata().getSecurity().allowIdentity(iDocument, f, identity);
+ return RESULT.RECORD_CHANGED;
+ }
}
return RESULT.RECORD_NOT_CHANGED;
}
diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurity.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurity.java
index 8bb72ef6c34..b5af39a5bd8 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurity.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurity.java
@@ -38,10 +38,14 @@ public interface OSecurity {
public OIdentifiable allowRole(final ODocument iDocument, final String iAllowFieldName, final String iRoleName);
+ public OIdentifiable allowIdentity(final ODocument iDocument, final String iAllowFieldName, final OIdentifiable iId);
+
public OIdentifiable disallowUser(final ODocument iDocument, final String iAllowFieldName, final String iUserName);
public OIdentifiable disallowRole(final ODocument iDocument, final String iAllowFieldName, final String iRoleName);
+ public OIdentifiable disallowIdentity(final ODocument iDocument, final String iAllowFieldName, final OIdentifiable iId);
+
public OUser authenticate(String iUsername, String iUserPassword);
public OUser getUser(String iUserName);
diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityNull.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityNull.java
index b24088b851e..3992a1b153e 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityNull.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityNull.java
@@ -99,6 +99,11 @@ public OIdentifiable allowRole(ODocument iDocument, String iAllowFieldName, Stri
return null;
}
+ @Override
+ public OIdentifiable allowIdentity(ODocument iDocument, String iAllowFieldName, OIdentifiable iId) {
+ return null;
+ }
+
@Override
public OIdentifiable disallowUser(ODocument iDocument, String iAllowFieldName, String iUserName) {
return null;
@@ -108,4 +113,9 @@ public OIdentifiable disallowUser(ODocument iDocument, String iAllowFieldName, S
public OIdentifiable disallowRole(ODocument iDocument, String iAllowFieldName, String iRoleName) {
return null;
}
+
+ @Override
+ public OIdentifiable disallowIdentity(ODocument iDocument, String iAllowFieldName, OIdentifiable iId) {
+ return null;
+ }
}
diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityProxy.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityProxy.java
index eedbd07578d..3b5e6d6bc8c 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityProxy.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityProxy.java
@@ -48,6 +48,11 @@ public OIdentifiable allowRole(final ODocument iDocument, final String iAllowFie
return delegate.allowRole(iDocument, iAllowFieldName, iRoleName);
}
+ @Override
+ public OIdentifiable allowIdentity(ODocument iDocument, String iAllowFieldName, OIdentifiable iId) {
+ return delegate.allowIdentity(iDocument, iAllowFieldName, iId);
+ }
+
public OIdentifiable disallowUser(final ODocument iDocument, final String iAllowFieldName, final String iUserName) {
return delegate.disallowUser(iDocument, iAllowFieldName, iUserName);
}
@@ -56,6 +61,11 @@ public OIdentifiable disallowRole(final ODocument iDocument, final String iAllow
return delegate.disallowRole(iDocument, iAllowFieldName, iRoleName);
}
+ @Override
+ public OIdentifiable disallowIdentity(ODocument iDocument, String iAllowFieldName, OIdentifiable iId) {
+ return delegate.disallowIdentity(iDocument, iAllowFieldName, iId);
+ }
+
public OUser create() {
return delegate.create();
}
diff --git a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityShared.java b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityShared.java
index 621c062f024..80fdfe6e8d6 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityShared.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/metadata/security/OSecurityShared.java
@@ -43,11 +43,13 @@
*
*/
public class OSecurityShared extends OSharedResourceAdaptive implements OSecurity, OCloseable {
- public static final String RESTRICTED_CLASSNAME = "ORestricted";
- public static final String ALLOW_ALL_FIELD = "_allow";
- public static final String ALLOW_READ_FIELD = "_allowRead";
- public static final String ALLOW_UPDATE_FIELD = "_allowUpdate";
- public static final String ALLOW_DELETE_FIELD = "_allowDelete";
+ public static final String RESTRICTED_CLASSNAME = "ORestricted";
+ public static final String ALLOW_ALL_FIELD = "_allow";
+ public static final String ALLOW_READ_FIELD = "_allowRead";
+ public static final String ALLOW_UPDATE_FIELD = "_allowUpdate";
+ public static final String ALLOW_DELETE_FIELD = "_allowDelete";
+ public static final String ONCREATE_IDENTITY_TYPE = "onCreate.identityType";
+ public static final String ONCREATE_FIELD = "onCreate.fields";
public OIdentifiable allowUser(final ODocument iDocument, final String iAllowFieldName, final String iUserName) {
final OUser user = ODatabaseRecordThreadLocal.INSTANCE.get().getMetadata().getSecurity().getUser(iUserName);
|
135f05e6728a3a0eb02c8974dafca434557080c0
|
drools
|
JBRULES-1736 Dynamically generated Types -Must get- classloader from the rulebase root classloader now--git-svn-id: https://svn.jboss.org/repos/labs/labs/jbossrules/trunk@21573 c60d74c8-e8f6-0310-9e8f-d4a2fc68ab70-
|
c
|
https://github.com/kiegroup/drools
|
diff --git a/drools-clips/.classpath b/drools-clips/.classpath
index d078808cf23..e330ced3ca6 100644
--- a/drools-clips/.classpath
+++ b/drools-clips/.classpath
@@ -9,7 +9,21 @@
<classpathentry kind="src" path="/drools-compiler"/>
<classpathentry kind="src" path="/drools-core"/>
<classpathentry kind="var" path="M2_REPO/org/mvel/mvel/2.0-dp4/mvel-2.0-dp4.jar"/>
- <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0/antlr-runtime-3.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/antlr-runtime/3.0.1/antlr-runtime-3.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/stringtemplate/3.1-b1/stringtemplate-3.1-b1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/gunit/1.0.1/gunit-1.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-project/2.0/maven-project-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-profile/2.0/maven-profile-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-model/2.0/maven-model-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-utils/1.0.4/plexus-utils-1.0.4.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/codehaus/plexus/plexus-container-default/1.0-alpha-8/plexus-container-default-1.0-alpha-8.jar"/>
+ <classpathentry kind="var" path="M2_REPO/classworlds/classworlds/1.1-alpha-2/classworlds-1.1-alpha-2.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact-manager/2.0/maven-artifact-manager-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-repository-metadata/2.0/maven-repository-metadata-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/maven/maven-artifact/2.0/maven-artifact-2.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/maven/wagon/wagon-provider-api/1.0-alpha-5/wagon-provider-api-1.0-alpha-5.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/antlr/antlr/3.0.1/antlr-3.0.1.jar"/>
+ <classpathentry kind="var" path="M2_REPO/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>
<classpathentry kind="var" path="M2_REPO/org/eclipse/jdt/core/3.2.3.v_686_R32x/core-3.2.3.v_686_R32x.jar"/>
<classpathentry kind="var" path="M2_REPO/janino/janino/2.5.10/janino-2.5.10.jar"/>
</classpath>
\ No newline at end of file
diff --git a/drools-clips/src/main/java/org/drools/clips/ClipsShell.java b/drools-clips/src/main/java/org/drools/clips/ClipsShell.java
index b9406261086..c3fd0da41c2 100644
--- a/drools-clips/src/main/java/org/drools/clips/ClipsShell.java
+++ b/drools-clips/src/main/java/org/drools/clips/ClipsShell.java
@@ -403,7 +403,8 @@ public void lispFormHandler(LispForm lispForm) {
context.addPackageImport( importName.substring( 0,
importName.length() - 2 ) );
} else {
- Class cls = pkg.getDialectRuntimeRegistry().getClassLoader().loadClass( importName );
+
+ Class cls = ((InternalRuleBase)ruleBase).getRootClassLoader().loadClass( importName );
context.addImport( cls.getSimpleName(),
(Class) cls );
}
@@ -418,7 +419,7 @@ public void lispFormHandler(LispForm lispForm) {
}
ClassLoader tempClassLoader = Thread.currentThread().getContextClassLoader();
- Thread.currentThread().setContextClassLoader( pkg.getPackageScopeClassLoader() );
+ Thread.currentThread().setContextClassLoader( ((InternalRuleBase)ruleBase).getRootClassLoader() );
ExpressionCompiler expr = new ExpressionCompiler( appendable.toString() );
Serializable executable = expr.compile( context );
diff --git a/drools-clips/src/test/java/org/drools/clips/ClipsShellTest.java b/drools-clips/src/test/java/org/drools/clips/ClipsShellTest.java
index 251ba45fdf0..6d8994bccc1 100644
--- a/drools-clips/src/test/java/org/drools/clips/ClipsShellTest.java
+++ b/drools-clips/src/test/java/org/drools/clips/ClipsShellTest.java
@@ -31,6 +31,7 @@
import org.drools.clips.functions.RunFunction;
import org.drools.clips.functions.SetFunction;
import org.drools.clips.functions.SwitchFunction;
+import org.drools.common.InternalRuleBase;
import org.drools.rule.Package;
import org.drools.rule.Rule;
@@ -251,7 +252,7 @@ public void FIXME_testTemplateCreation2() throws Exception {
this.shell.eval( "(defrule xxx (PersonTemplate (name ?name&bob) (age 30) ) (PersonTemplate (name ?name) (age 35)) => (printout t xx \" \" (eq 1 1) ) )" );
this.shell.eval( "(assert (PersonTemplate (name 'mike') (age 34)))" );
- Class personClass = this.shell.getStatefulSession().getRuleBase().getPackage( "MAIN" ).getPackageScopeClassLoader().loadClass( "MAIN.PersonTemplate" );
+ Class personClass = ((InternalRuleBase)this.shell.getStatefulSession().getRuleBase()).getRootClassLoader().loadClass( "MAIN.PersonTemplate" );
assertNotNull( personClass );
}
@@ -287,7 +288,7 @@ public void testTemplateCreationWithJava() throws Exception {
pkg.getRules().length );
WorkingMemory wm = shell.getStatefulSession();
- Class personClass = this.shell.getStatefulSession().getRuleBase().getPackage( "MAIN" ).getPackageScopeClassLoader().loadClass( "MAIN.Person" );
+ Class personClass = ((InternalRuleBase)this.shell.getStatefulSession().getRuleBase()).getRootClassLoader().loadClass( "MAIN.Person" );
Method nameMethod = personClass.getMethod( "setName",
new Class[]{String.class} );
|
e477c143bca83b8ec8e10c65a0e8ef526e24482e
|
hbase
|
HBASE-15354 Use same criteria for clearing meta- cache for all operations (addendum) (Ashu Pachauri)--
|
p
|
https://github.com/apache/hbase
|
diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java
index 5738be9045ac..23b9eedc549a 100644
--- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java
+++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaCache.java
@@ -19,8 +19,6 @@
import com.google.protobuf.RpcController;
import com.google.protobuf.ServiceException;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.*;
@@ -34,6 +32,7 @@
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.MediumTests;
import org.apache.hadoop.hbase.util.Bytes;
+import org.apache.hadoop.hbase.util.JVMClusterUtil;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -45,17 +44,19 @@
import java.util.ArrayList;
import java.util.List;
+import static junit.framework.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
@Category({MediumTests.class, ClientTests.class})
public class TestMetaCache {
- private static final Log LOG = LogFactory.getLog(TestMetaCache.class);
private final static HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
private static final TableName TABLE_NAME = TableName.valueOf("test_table");
private static final byte[] FAMILY = Bytes.toBytes("fam1");
private static final byte[] QUALIFIER = Bytes.toBytes("qual");
private ConnectionImplementation conn;
+ private HRegionServer badRS;
/**
* @throws java.lang.Exception
@@ -64,8 +65,9 @@ public class TestMetaCache {
public static void setUpBeforeClass() throws Exception {
Configuration conf = TEST_UTIL.getConfiguration();
conf.set("hbase.client.retries.number", "1");
- conf.setStrings(HConstants.REGION_SERVER_IMPL, RegionServerWithFakeRpcServices.class.getName());
TEST_UTIL.startMiniCluster(1);
+ TEST_UTIL.getHBaseCluster().waitForActiveAndReadyMaster();
+ TEST_UTIL.waitUntilAllRegionsAssigned(TABLE_NAME.META_TABLE_NAME);
}
@@ -82,8 +84,21 @@ public static void tearDownAfterClass() throws Exception {
*/
@Before
public void setup() throws Exception {
- conn = (ConnectionImplementation)ConnectionFactory.createConnection(
- TEST_UTIL.getConfiguration());
+ MiniHBaseCluster cluster = TEST_UTIL.getHBaseCluster();
+
+ cluster.getConfiguration().setStrings(HConstants.REGION_SERVER_IMPL,
+ RegionServerWithFakeRpcServices.class.getName());
+ JVMClusterUtil.RegionServerThread rsThread = cluster.startRegionServer();
+ rsThread.waitForServerOnline();
+ badRS = rsThread.getRegionServer();
+ assertTrue(badRS.getRSRpcServices() instanceof FakeRSRpcServices);
+ cluster.getConfiguration().setStrings(HConstants.REGION_SERVER_IMPL,
+ HRegionServer.class.getName());
+
+ assertEquals(2, cluster.getRegionServerThreads().size());
+
+ conn = (ConnectionImplementation) ConnectionFactory.createConnection(
+ TEST_UTIL.getConfiguration());
HTableDescriptor table = new HTableDescriptor(TABLE_NAME);
HColumnDescriptor fam = new HColumnDescriptor(FAMILY);
fam.setMaxVersions(2);
@@ -105,7 +120,7 @@ public void tearDown() throws Exception {
@Test
public void testPreserveMetaCacheOnException() throws Exception {
Table table = conn.getTable(TABLE_NAME);
- byte [] row = HBaseTestingUtility.KEYS[2];
+ byte[] row = badRS.getOnlineRegions().get(0).getRegionInfo().getStartKey();
Put put = new Put(row);
put.addColumn(FAMILY, QUALIFIER, Bytes.toBytes(10));
@@ -151,19 +166,19 @@ public void testPreserveMetaCacheOnException() throws Exception {
public static List<Throwable> metaCachePreservingExceptions() {
return new ArrayList<Throwable>() {{
- add(new RegionOpeningException(" "));
- add(new RegionTooBusyException());
- add(new ThrottlingException(" "));
- add(new MultiActionResultTooLarge(" "));
- add(new RetryImmediatelyException(" "));
- add(new CallQueueTooBigException());
+ add(new RegionOpeningException(" "));
+ add(new RegionTooBusyException());
+ add(new ThrottlingException(" "));
+ add(new MultiActionResultTooLarge(" "));
+ add(new RetryImmediatelyException(" "));
+ add(new CallQueueTooBigException());
}};
}
protected static class RegionServerWithFakeRpcServices extends HRegionServer {
public RegionServerWithFakeRpcServices(Configuration conf, CoordinatedStateManager cp)
- throws IOException, InterruptedException {
+ throws IOException, InterruptedException {
super(conf, cp);
}
@@ -185,7 +200,7 @@ public FakeRSRpcServices(HRegionServer rs) throws IOException {
@Override
public GetResponse get(final RpcController controller,
- final ClientProtos.GetRequest request) throws ServiceException {
+ final ClientProtos.GetRequest request) throws ServiceException {
throwSomeExceptions();
return super.get(controller, request);
}
@@ -224,8 +239,8 @@ private void throwSomeExceptions() throws ServiceException {
// single Gets.
expCount++;
Throwable t = metaCachePreservingExceptions.get(
- expCount % metaCachePreservingExceptions.size());
+ expCount % metaCachePreservingExceptions.size());
throw new ServiceException(t);
}
}
-}
+}
\ No newline at end of file
|
f78a55ee33ae002ee99b68a43e8fae9f4d4519da
|
hdiv$hdiv
|
Clarify property name and functionality
|
p
|
https://github.com/hdiv/hdiv
|
diff --git a/hdiv-config/src/main/java/org/hdiv/config/xml/ConfigBeanDefinitionParser.java b/hdiv-config/src/main/java/org/hdiv/config/xml/ConfigBeanDefinitionParser.java
index 7a53f7a7..32d2ed2d 100644
--- a/hdiv-config/src/main/java/org/hdiv/config/xml/ConfigBeanDefinitionParser.java
+++ b/hdiv-config/src/main/java/org/hdiv/config/xml/ConfigBeanDefinitionParser.java
@@ -155,7 +155,7 @@ public BeanDefinition parse(Element element, ParserContext parserContext) {
this.createJsfValidatorHelper(element, source));
parserContext.getRegistry().registerBeanDefinition("multipartConfig",
this.createJsfMultipartConfig(element, source));
-
+
parserContext.getRegistry().registerBeanDefinition("HDIVFacesEventListener",
this.createFacesEventListener(element, source));
@@ -402,7 +402,7 @@ private RootBeanDefinition createConfigBean(Element element, Object source, Pars
String confidentiality = element.getAttribute("confidentiality");
String avoidCookiesIntegrity = element.getAttribute("avoidCookiesIntegrity");
- String cookiesConfidentiality = element.getAttribute("avoidCookiesConfidentiality");
+ String avoidCookiesConfidentiality = element.getAttribute("avoidCookiesConfidentiality");
String avoidValidationInUrlsWithoutParams = element.getAttribute("avoidValidationInUrlsWithoutParams");
String strategy = element.getAttribute("strategy");
String randomName = element.getAttribute("randomName");
@@ -417,11 +417,11 @@ private RootBeanDefinition createConfigBean(Element element, Object source, Pars
}
if (StringUtils.hasText(avoidCookiesIntegrity)) {
- bean.getPropertyValues().addPropertyValue("cookiesIntegrity", avoidCookiesIntegrity);
+ bean.getPropertyValues().addPropertyValue("avoidCookiesIntegrity", avoidCookiesIntegrity);
}
- if (StringUtils.hasText(cookiesConfidentiality)) {
- bean.getPropertyValues().addPropertyValue("cookiesConfidentiality", cookiesConfidentiality);
+ if (StringUtils.hasText(avoidCookiesConfidentiality)) {
+ bean.getPropertyValues().addPropertyValue("avoidCookiesConfidentiality", avoidCookiesConfidentiality);
}
if (StringUtils.hasText(avoidValidationInUrlsWithoutParams)) {
@@ -515,7 +515,7 @@ private RootBeanDefinition createJsfValidatorHelper(Element element, Object sour
new RuntimeBeanReference("dataComposerFactory"));
return bean;
}
-
+
private RootBeanDefinition createJsfMultipartConfig(Element element, Object source) {
RootBeanDefinition bean = new RootBeanDefinition(JsfMultipartConfig.class);
bean.setSource(source);
diff --git a/hdiv-config/src/test/java/org/hdiv/config/xml/CustomSchemaTest.java b/hdiv-config/src/test/java/org/hdiv/config/xml/CustomSchemaTest.java
index 8bd1466a..749211e1 100644
--- a/hdiv-config/src/test/java/org/hdiv/config/xml/CustomSchemaTest.java
+++ b/hdiv-config/src/test/java/org/hdiv/config/xml/CustomSchemaTest.java
@@ -12,8 +12,7 @@ public class CustomSchemaTest extends TestCase {
public void testSchema() {
ApplicationContext context = new ClassPathXmlApplicationContext(
- "org/hdiv/config/xml/hdiv-config-test-schema.x" +
- "ml");
+ "org/hdiv/config/xml/hdiv-config-test-schema.xml");
Validation validation = (Validation) context.getBean("id1");
assertNotNull(validation);
diff --git a/hdiv-core/src/main/java/org/hdiv/config/HDIVConfig.java b/hdiv-core/src/main/java/org/hdiv/config/HDIVConfig.java
index 70543ed2..6dbb72ed 100644
--- a/hdiv-core/src/main/java/org/hdiv/config/HDIVConfig.java
+++ b/hdiv-core/src/main/java/org/hdiv/config/HDIVConfig.java
@@ -98,14 +98,14 @@ public class HDIVConfig {
private HDIVValidations validations;
/**
- * If <code>cookiesIntegrity</code> is true, cookie integrity will not be applied.
+ * If <code>avoidCookiesIntegrity</code> is true, cookie integrity will not be applied.
*/
- private boolean cookiesIntegrity;
+ private boolean avoidCookiesIntegrity;
/**
- * If <code>cookiesConfidentiality</code> is true, cookie confidentiality will not be applied.
+ * If <code>avoidCookiesConfidentiality</code> is true, cookie confidentiality will not be applied.
*/
- private boolean cookiesConfidentiality;
+ private boolean avoidCookiesConfidentiality;
/**
* if <code>avoidValidationInUrlsWithoutParams</code> is true, HDIV validation will not be applied in urls without
@@ -583,30 +583,30 @@ public boolean areEditableParameterValuesValid(String url, String parameter, Str
* @return Returns true if cookies' confidentiality is activated.
*/
public boolean isCookiesConfidentialityActivated() {
- return (cookiesConfidentiality == false);
+ return (this.avoidCookiesConfidentiality == false);
}
/**
- * @param cookiesConfidentiality
- * The cookiesConfidentiality to set.
+ * @param avoidCookiesConfidentiality
+ * the avoidCookiesConfidentiality to set
*/
- public void setCookiesConfidentiality(Boolean cookiesConfidentiality) {
- this.cookiesConfidentiality = cookiesConfidentiality.booleanValue();
+ public void setAvoidCookiesConfidentiality(boolean avoidCookiesConfidentiality) {
+ this.avoidCookiesConfidentiality = avoidCookiesConfidentiality;
}
/**
* @return Returns true if cookies' integrity is activated.
*/
public boolean isCookiesIntegrityActivated() {
- return (cookiesIntegrity == false);
+ return (this.avoidCookiesIntegrity == false);
}
/**
- * @param cookiesIntegrity
- * The cookiesIntegrity to set.
+ * @param avoidCookiesIntegrity
+ * the avoidCookiesIntegrity to set
*/
- public void setCookiesIntegrity(Boolean cookiesIntegrity) {
- this.cookiesIntegrity = cookiesIntegrity.booleanValue();
+ public void setAvoidCookiesIntegrity(boolean avoidCookiesIntegrity) {
+ this.avoidCookiesIntegrity = avoidCookiesIntegrity;
}
/**
@@ -723,8 +723,8 @@ public void setShowErrorPageOnEditableValidation(boolean showErrorPageOnEditable
public String toString() {
StringBuffer result = new StringBuffer().append("");
result = result.append(" Confidentiality=").append(this.getConfidentiality().toString());
- result.append(" avoidCookiesIntegrity=").append(this.cookiesIntegrity);
- result.append(" avoidCookiesConfidentiality=").append(this.cookiesConfidentiality);
+ result.append(" avoidCookiesIntegrity=").append(this.avoidCookiesIntegrity);
+ result.append(" avoidCookiesConfidentiality=").append(this.avoidCookiesConfidentiality);
result.append(" avoidValidationInUrlsWithoutParams=").append(this.avoidValidationInUrlsWithoutParams);
result.append(" strategy=").append(this.getStrategy());
result.append(" randomName=").append(this.isRandomName());
diff --git a/hdiv-core/src/test/resources/org/hdiv/config/hdiv-config.xml b/hdiv-core/src/test/resources/org/hdiv/config/hdiv-config.xml
index df943506..1cb69104 100644
--- a/hdiv-core/src/test/resources/org/hdiv/config/hdiv-config.xml
+++ b/hdiv-core/src/test/resources/org/hdiv/config/hdiv-config.xml
@@ -72,11 +72,9 @@
<property name="confidentiality" value="true" />
- <!-- Activated, reverse logic -->
- <property name="cookiesIntegrity" value="false" />
+ <property name="avoidCookiesIntegrity" value="false" />
- <!-- Activated, reverse logic -->
- <property name="cookiesConfidentiality" value="false" />
+ <property name="avoidCookiesConfidentiality" value="false" />
<property name="strategy" value="memory" />
diff --git a/hdiv-jsf/src/test/java/org/hdiv/AbstractJsfHDIVTestCase.java b/hdiv-jsf/src/test/java/org/hdiv/AbstractJsfHDIVTestCase.java
index cd355522..e0d45adc 100644
--- a/hdiv-jsf/src/test/java/org/hdiv/AbstractJsfHDIVTestCase.java
+++ b/hdiv-jsf/src/test/java/org/hdiv/AbstractJsfHDIVTestCase.java
@@ -17,6 +17,7 @@
import javax.servlet.http.HttpServletRequest;
+import org.hdiv.config.HDIVConfig;
import org.hdiv.util.HDIVUtil;
public abstract class AbstractJsfHDIVTestCase extends AbstractHDIVTestCase {
@@ -28,24 +29,28 @@ protected void onSetUp() throws Exception {
HttpServletRequest request = HDIVUtil.getHttpServletRequest();
- shaleMockObjects = new ShaleMockObjects();
- shaleMockObjects.setUp(request);
-
- // Disable not supported features
- super.getConfig().setConfidentiality(Boolean.FALSE);
- super.getConfig().setCookiesConfidentiality(Boolean.TRUE);
- super.getConfig().setCookiesIntegrity(Boolean.TRUE);
+ this.shaleMockObjects = new ShaleMockObjects();
+ this.shaleMockObjects.setUp(request);
this.innerSetUp();
}
+ @Override
+ protected void postCreateHdivConfig(HDIVConfig config) {
+
+ // Disable not supported features
+ config.setConfidentiality(Boolean.FALSE);
+ config.setAvoidCookiesConfidentiality(Boolean.TRUE);
+ config.setAvoidCookiesIntegrity(Boolean.TRUE);
+ }
+
abstract protected void innerSetUp() throws Exception;
@Override
protected void tearDown() throws Exception {
super.tearDown();
- shaleMockObjects.tearDown();
+ this.shaleMockObjects.tearDown();
}
}
|
ac26e42d1e85deac0b7bfa50c3ca3e5298493dd4
|
ReactiveX-RxJava
|
use Java Subject<T
|
a
|
https://github.com/ReactiveX/RxJava
|
diff --git a/rxjava-core/src/main/java/rx/Observable.java b/rxjava-core/src/main/java/rx/Observable.java
index d5d8fb8297..a14e78329c 100644
--- a/rxjava-core/src/main/java/rx/Observable.java
+++ b/rxjava-core/src/main/java/rx/Observable.java
@@ -397,7 +397,7 @@ public Subscription subscribe(final Action1<? super T> onNext, final Action1<Thr
* @return a {@link ConnectableObservable} that upon connection causes the source Observable to
* push results into the specified {@link Subject}
*/
- public <R> ConnectableObservable<R> multicast(Subject<T, R> subject) {
+ public <R> ConnectableObservable<R> multicast(Subject<? super T, ? extends R> subject) {
return OperationMulticast.multicast(this, subject);
}
diff --git a/rxjava-core/src/main/java/rx/operators/OperationMulticast.java b/rxjava-core/src/main/java/rx/operators/OperationMulticast.java
index e83cfdaa03..e24c24a91a 100644
--- a/rxjava-core/src/main/java/rx/operators/OperationMulticast.java
+++ b/rxjava-core/src/main/java/rx/operators/OperationMulticast.java
@@ -27,7 +27,7 @@
import rx.subjects.Subject;
public class OperationMulticast {
- public static <T, R> ConnectableObservable<R> multicast(Observable<? extends T> source, final Subject<T, R> subject) {
+ public static <T, R> ConnectableObservable<R> multicast(Observable<? extends T> source, final Subject<? super T, ? extends R> subject) {
return new MulticastConnectableObservable<T, R>(source, subject);
}
@@ -35,11 +35,11 @@ private static class MulticastConnectableObservable<T, R> extends ConnectableObs
private final Object lock = new Object();
private final Observable<? extends T> source;
- private final Subject<T, R> subject;
+ private final Subject<? super T, ? extends R> subject;
private Subscription subscription;
- public MulticastConnectableObservable(Observable<? extends T> source, final Subject<T, R> subject) {
+ public MulticastConnectableObservable(Observable<? extends T> source, final Subject<? super T, ? extends R> subject) {
super(new OnSubscribeFunc<R>() {
@Override
public Subscription onSubscribe(Observer<? super R> observer) {
|
40c30c0430a3938a71d3d94df20255a8c9898218
|
Mylyn Reviews
|
Merge branch 'master' of git://git.eclipse.org/gitroot/mylyn/org.eclipse.mylyn.reviews
|
p
|
https://github.com/eclipse-mylyn/org.eclipse.mylyn.reviews
|
diff --git a/framework/org.eclipse.mylyn.reviews.core/.settings/org.eclipse.jdt.core.prefs b/framework/org.eclipse.mylyn.reviews.core/.settings/org.eclipse.jdt.core.prefs
index fbac2391..8e95137a 100644
--- a/framework/org.eclipse.mylyn.reviews.core/.settings/org.eclipse.jdt.core.prefs
+++ b/framework/org.eclipse.mylyn.reviews.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue May 12 20:42:44 PDT 2009
+#Wed Mar 02 16:00:08 PST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -81,6 +81,7 @@ org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@@ -88,9 +89,10 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
@@ -137,10 +139,16 @@ org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -153,9 +161,14 @@ org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
@@ -338,5 +351,7 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/framework/org.eclipse.mylyn.reviews.core/.settings/org.eclipse.jdt.ui.prefs b/framework/org.eclipse.mylyn.reviews.core/.settings/org.eclipse.jdt.ui.prefs
index 8d68e732..e2834b27 100644
--- a/framework/org.eclipse.mylyn.reviews.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/framework/org.eclipse.mylyn.reviews.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,16 +1,16 @@
-#Thu Sep 11 16:27:18 PDT 2008
+#Wed Mar 02 16:00:04 PST 2011
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Mylyn based on Eclipse
-formatter_settings_version=11
+formatter_settings_version=12
internal.default.compliance=default
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.javadoc=false
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2010 Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/framework/org.eclipse.mylyn.reviews.core/pom.xml b/framework/org.eclipse.mylyn.reviews.core/pom.xml
index a75837a0..92002b29 100644
--- a/framework/org.eclipse.mylyn.reviews.core/pom.xml
+++ b/framework/org.eclipse.mylyn.reviews.core/pom.xml
@@ -7,7 +7,7 @@
<groupId>org.eclipse.mylyn.reviews</groupId>
<version>0.7.0-SNAPSHOT</version>
</parent>
- <artifactId>org.eclipse.mylyn.framework.core</artifactId>
+ <artifactId>org.eclipse.mylyn.reviews.core</artifactId>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
diff --git a/framework/org.eclipse.mylyn.reviews.feature/.project b/framework/org.eclipse.mylyn.reviews.feature/.project
new file mode 100644
index 00000000..1bb50d31
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.mylyn.reviews-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.jdt.core.prefs b/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..bc1e8f9c
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,357 @@
+#Wed Mar 02 16:00:03 PST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
+org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
+org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=80
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.jdt.ui.prefs b/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..e2834b27
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,63 @@
+#Wed Mar 02 16:00:04 PST 2011
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Mylyn based on Eclipse
+formatter_settings_version=12
+internal.default.compliance=default
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.javadoc=false
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs b/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644
index 00000000..47ada179
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs
@@ -0,0 +1,4 @@
+#Thu Dec 20 14:12:59 PST 2007
+eclipse.preferences.version=1
+project.repository.kind=bugzilla
+project.repository.url=https\://bugs.eclipse.org/bugs
diff --git a/framework/org.eclipse.mylyn.reviews.feature/about.html b/framework/org.eclipse.mylyn.reviews.feature/about.html
new file mode 100644
index 00000000..d774b07c
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/about.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 25, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/framework/org.eclipse.mylyn.reviews.feature/build.properties b/framework/org.eclipse.mylyn.reviews.feature/build.properties
new file mode 100644
index 00000000..1d717bf0
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2009, 2010 Tasktop Technologies and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Tasktop Technologies - initial API and implementation
+###############################################################################
+bin.includes = feature.properties,\
+ feature.xml,\
+ about.html,\
+ epl-v10.html,\
+ license.html
+src.includes = about.html
diff --git a/framework/org.eclipse.mylyn.reviews.feature/epl-v10.html b/framework/org.eclipse.mylyn.reviews.feature/epl-v10.html
new file mode 100644
index 00000000..ed4b1966
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/framework/org.eclipse.mylyn.reviews.feature/feature.properties b/framework/org.eclipse.mylyn.reviews.feature/feature.properties
new file mode 100644
index 00000000..0f69f248
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/feature.properties
@@ -0,0 +1,137 @@
+###############################################################################
+# Copyright (c) 2011 Tasktop Technologies and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Tasktop Technologies - initial API and implementation
+###############################################################################
+featureName=Mylyn Reviews (Incubation)
+description=Provides a framework for review integrations.
+providerName=Eclipse Mylyn
+copyright=Copyright (c) 2011 Tasktop Technologies and others. All rights reserved.
+license=\
+Eclipse Foundation Software User Agreement\n\
+April 14, 2010\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
diff --git a/framework/org.eclipse.mylyn.reviews.feature/feature.xml b/framework/org.eclipse.mylyn.reviews.feature/feature.xml
new file mode 100644
index 00000000..92f998da
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/feature.xml
@@ -0,0 +1,49 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2011 Tasktop Technologies and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Tasktop Technologies - initial API and implementation
+ -->
+<feature
+ id="org.eclipse.mylyn.reviews.feature"
+ label="%featureName"
+ version="0.7.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.eclipse.mylyn">
+
+ <description url="http://eclipse.org/mylyn/reviews">
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="license.html">
+ %license
+ </license>
+
+ <requires>
+ <import feature="org.eclipse.mylyn_feature" version="3.5.0.I2011" match="compatible"/>
+ </requires>
+
+ <plugin
+ id="org.eclipse.mylyn.reviews.core"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.mylyn.reviews.ui"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/framework/org.eclipse.mylyn.reviews.feature/license.html b/framework/org.eclipse.mylyn.reviews.feature/license.html
new file mode 100644
index 00000000..c184ca36
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/framework/org.eclipse.mylyn.reviews.feature/pom.xml b/framework/org.eclipse.mylyn.reviews.feature/pom.xml
new file mode 100644
index 00000000..fecec0de
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.feature/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>mylyn-reviews-framework-parent</artifactId>
+ <groupId>org.eclipse.mylyn.reviews</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.mylyn.reviews.feature</artifactId>
+ <packaging>eclipse-feature</packaging>
+</project>
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/.project b/framework/org.eclipse.mylyn.reviews.sdk.feature/.project
new file mode 100644
index 00000000..deed8c2f
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.mylyn.reviews.sdk-feature</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.pde.FeatureBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.FeatureNature</nature>
+ </natures>
+</projectDescription>
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.jdt.core.prefs b/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000..8e95137a
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,357 @@
+#Wed Mar 02 16:00:08 PST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled
+org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
+org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=80
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=1
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.jdt.ui.prefs b/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000..f6c0a161
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,63 @@
+#Wed Mar 02 16:00:06 PST 2011
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Mylyn based on Eclipse
+formatter_settings_version=12
+internal.default.compliance=default
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.javadoc=false
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=true
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs b/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs
new file mode 100644
index 00000000..47ada179
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/.settings/org.eclipse.mylyn.tasks.ui.prefs
@@ -0,0 +1,4 @@
+#Thu Dec 20 14:12:59 PST 2007
+eclipse.preferences.version=1
+project.repository.kind=bugzilla
+project.repository.url=https\://bugs.eclipse.org/bugs
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/about.html b/framework/org.eclipse.mylyn.reviews.sdk.feature/about.html
new file mode 100644
index 00000000..d774b07c
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/about.html
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+<head>
+<title>About</title>
+<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 25, 2008</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/build.properties b/framework/org.eclipse.mylyn.reviews.sdk.feature/build.properties
new file mode 100644
index 00000000..1d717bf0
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/build.properties
@@ -0,0 +1,16 @@
+###############################################################################
+# Copyright (c) 2009, 2010 Tasktop Technologies and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Tasktop Technologies - initial API and implementation
+###############################################################################
+bin.includes = feature.properties,\
+ feature.xml,\
+ about.html,\
+ epl-v10.html,\
+ license.html
+src.includes = about.html
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/epl-v10.html b/framework/org.eclipse.mylyn.reviews.sdk.feature/epl-v10.html
new file mode 100644
index 00000000..ed4b1966
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/epl-v10.html
@@ -0,0 +1,328 @@
+<html xmlns:o="urn:schemas-microsoft-com:office:office"
+xmlns:w="urn:schemas-microsoft-com:office:word"
+xmlns="http://www.w3.org/TR/REC-html40">
+
+<head>
+<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
+<meta name=ProgId content=Word.Document>
+<meta name=Generator content="Microsoft Word 9">
+<meta name=Originator content="Microsoft Word 9">
+<link rel=File-List
+href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
+<title>Eclipse Public License - Version 1.0</title>
+<!--[if gte mso 9]><xml>
+ <o:DocumentProperties>
+ <o:Revision>2</o:Revision>
+ <o:TotalTime>3</o:TotalTime>
+ <o:Created>2004-03-05T23:03:00Z</o:Created>
+ <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
+ <o:Pages>4</o:Pages>
+ <o:Words>1626</o:Words>
+ <o:Characters>9270</o:Characters>
+ <o:Lines>77</o:Lines>
+ <o:Paragraphs>18</o:Paragraphs>
+ <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
+ <o:Version>9.4402</o:Version>
+ </o:DocumentProperties>
+</xml><![endif]--><!--[if gte mso 9]><xml>
+ <w:WordDocument>
+ <w:TrackRevisions/>
+ </w:WordDocument>
+</xml><![endif]-->
+<style>
+<!--
+ /* Font Definitions */
+@font-face
+ {font-family:Tahoma;
+ panose-1:2 11 6 4 3 5 4 4 2 4;
+ mso-font-charset:0;
+ mso-generic-font-family:swiss;
+ mso-font-pitch:variable;
+ mso-font-signature:553679495 -2147483648 8 0 66047 0;}
+ /* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {mso-style-parent:"";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p
+ {margin-right:0in;
+ mso-margin-top-alt:auto;
+ mso-margin-bottom-alt:auto;
+ margin-left:0in;
+ mso-pagination:widow-orphan;
+ font-size:12.0pt;
+ font-family:"Times New Roman";
+ mso-fareast-font-family:"Times New Roman";}
+p.BalloonText, li.BalloonText, div.BalloonText
+ {mso-style-name:"Balloon Text";
+ margin:0in;
+ margin-bottom:.0001pt;
+ mso-pagination:widow-orphan;
+ font-size:8.0pt;
+ font-family:Tahoma;
+ mso-fareast-font-family:"Times New Roman";}
+@page Section1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.25in 1.0in 1.25in;
+ mso-header-margin:.5in;
+ mso-footer-margin:.5in;
+ mso-paper-source:0;}
+div.Section1
+ {page:Section1;}
+-->
+</style>
+</head>
+
+<body lang=EN-US style='tab-interval:.5in'>
+
+<div class=Section1>
+
+<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
+</p>
+
+<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
+THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE,
+REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
+OF THIS AGREEMENT.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>"Contribution" means:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+in the case of the initial Contributor, the initial code and documentation
+distributed under this Agreement, and<br clear=left>
+b) in the case of each subsequent Contributor:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+changes to the Program, and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+additions to the Program;</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
+such changes and/or additions to the Program originate from and are distributed
+by that particular Contributor. A Contribution 'originates' from a Contributor
+if it was added to the Program by such Contributor itself or anyone acting on
+such Contributor's behalf. Contributions do not include additions to the
+Program which: (i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are not derivative
+works of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Contributor" means any person or
+entity that distributes the Program.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Licensed Patents " mean patent
+claims licensable by a Contributor which are necessarily infringed by the use
+or sale of its Contribution alone or when combined with the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>"Program" means the Contributions
+distributed in accordance with this Agreement.</span> </p>
+
+<p><span style='font-size:10.0pt'>"Recipient" means anyone who
+receives the Program under this Agreement, including all Contributors.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+Subject to the terms of this Agreement, each Contributor hereby grants Recipient
+a non-exclusive, worldwide, royalty-free copyright license to<span
+style='color:red'> </span>reproduce, prepare derivative works of, publicly
+display, publicly perform, distribute and sublicense the Contribution of such
+Contributor, if any, and such derivative works, in source code and object code
+form.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
+patent license under Licensed Patents to make, use, sell, offer to sell, import
+and otherwise transfer the Contribution of such Contributor, if any, in source
+code and object code form. This patent license shall apply to the combination
+of the Contribution and the Program if, at the time the Contribution is added
+by the Contributor, such addition of the Contribution causes such combination
+to be covered by the Licensed Patents. The patent license shall not apply to
+any other combinations which include the Contribution. No hardware per se is
+licensed hereunder. </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
+Recipient understands that although each Contributor grants the licenses to its
+Contributions set forth herein, no assurances are provided by any Contributor
+that the Program does not infringe the patent or other intellectual property
+rights of any other entity. Each Contributor disclaims any liability to Recipient
+for claims brought by any other entity based on infringement of intellectual
+property rights or otherwise. As a condition to exercising the rights and
+licenses granted hereunder, each Recipient hereby assumes sole responsibility
+to secure any other intellectual property rights needed, if any. For example,
+if a third party patent license is required to allow Recipient to distribute
+the Program, it is Recipient's responsibility to acquire that license before
+distributing the Program.</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
+Each Contributor represents that to its knowledge it has sufficient copyright
+rights in its Contribution, if any, to grant the copyright license set forth in
+this Agreement. </span></p>
+
+<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
+
+<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
+Program in object code form under its own license agreement, provided that:</span>
+</p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it complies with the terms and conditions of this Agreement; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
+its license agreement:</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
+effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title
+and non-infringement, and implied warranties or conditions of merchantability
+and fitness for a particular purpose; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
+effectively excludes on behalf of all Contributors all liability for damages,
+including direct, indirect, special, incidental and consequential damages, such
+as lost profits; </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
+states that any provisions which differ from this Agreement are offered by that
+Contributor alone and not by any other party; and</span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
+states that source code for the Program is available from such Contributor, and
+informs licensees how to obtain it in a reasonable manner on or through a
+medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
+
+<p><span style='font-size:10.0pt'>When the Program is made available in source
+code form:</span> </p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
+it must be made available under this Agreement; and </span></p>
+
+<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
+copy of this Agreement must be included with each copy of the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
+copyright notices contained within the Program. </span></p>
+
+<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
+originator of its Contribution, if any, in a manner that reasonably allows
+subsequent Recipients to identify the originator of the Contribution. </span></p>
+
+<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
+
+<p><span style='font-size:10.0pt'>Commercial distributors of software may
+accept certain responsibilities with respect to end users, business partners
+and the like. While this license is intended to facilitate the commercial use
+of the Program, the Contributor who includes the Program in a commercial
+product offering should do so in a manner which does not create potential
+liability for other Contributors. Therefore, if a Contributor includes the
+Program in a commercial product offering, such Contributor ("Commercial
+Contributor") hereby agrees to defend and indemnify every other
+Contributor ("Indemnified Contributor") against any losses, damages and
+costs (collectively "Losses") arising from claims, lawsuits and other
+legal actions brought by a third party against the Indemnified Contributor to
+the extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor
+to control, and cooperate with the Commercial Contributor in, the defense and
+any related settlement negotiations. The Indemnified Contributor may participate
+in any such claim at its own expense.</span> </p>
+
+<p><span style='font-size:10.0pt'>For example, a Contributor might include the
+Program in a commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes performance
+claims, or offers warranties related to Product X, those performance claims and
+warranties are such Commercial Contributor's responsibility alone. Under this
+section, the Commercial Contributor would have to defend claims against the
+other Contributors related to those performance claims and warranties, and if a
+court requires any other Contributor to pay any damages as a result, the
+Commercial Contributor must pay those damages.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT
+WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
+WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
+MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and distributing the
+Program and assumes all risks associated with its exercise of rights under this
+Agreement , including but not limited to the risks and costs of program errors,
+compliance with applicable laws, damage to or loss of data, programs or
+equipment, and unavailability or interruption of operations. </span></p>
+
+<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
+
+<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
+AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
+OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
+THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
+
+<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
+
+<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
+or unenforceable under applicable law, it shall not affect the validity or
+enforceability of the remainder of the terms of this Agreement, and without
+further action by the parties hereto, such provision shall be reformed to the
+minimum extent necessary to make such provision valid and enforceable.</span> </p>
+
+<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
+against any entity (including a cross-claim or counterclaim in a lawsuit)
+alleging that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s), then such
+Recipient's rights granted under Section 2(b) shall terminate as of the date
+such litigation is filed. </span></p>
+
+<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
+shall terminate if it fails to comply with any of the material terms or
+conditions of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all Recipient's
+rights under this Agreement terminate, Recipient agrees to cease use and
+distribution of the Program as soon as reasonably practicable. However,
+Recipient's obligations under this Agreement and any licenses granted by
+Recipient relating to the Program shall continue and survive. </span></p>
+
+<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
+copies of this Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The Agreement
+Steward reserves the right to publish new versions (including revisions) of
+this Agreement from time to time. No one other than the Agreement Steward has
+the right to modify this Agreement. The Eclipse Foundation is the initial
+Agreement Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each new version
+of the Agreement will be given a distinguishing version number. The Program
+(including Contributions) may always be distributed subject to the version of
+the Agreement under which it was received. In addition, after a new version of
+the Agreement is published, Contributor may elect to distribute the Program
+(including its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
+the intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.</span> </p>
+
+<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
+State of New York and the intellectual property laws of the United States of
+America. No party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each party waives
+its rights to a jury trial in any resulting litigation.</span> </p>
+
+<p class=MsoNormal><![if !supportEmptyParas]> <![endif]><o:p></o:p></p>
+
+</div>
+
+</body>
+
+</html>
\ No newline at end of file
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/feature.properties b/framework/org.eclipse.mylyn.reviews.sdk.feature/feature.properties
new file mode 100644
index 00000000..e5354300
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/feature.properties
@@ -0,0 +1,137 @@
+###############################################################################
+# Copyright (c) 2011 Tasktop Technologies and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Tasktop Technologies - initial API and implementation
+###############################################################################
+featureName=Mylyn Reviews SDK (Incubation)
+description=Plug-in development support and sources for review integrations.
+providerName=Eclipse Mylyn
+copyright=Copyright (c) 2011 Tasktop Technologies and others. All rights reserved.
+license=\
+Eclipse Foundation Software User Agreement\n\
+April 14, 2010\n\
+\n\
+Usage Of Content\n\
+\n\
+THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
+OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
+USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
+AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
+NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
+AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
+AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
+OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
+TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
+OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
+BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
+\n\
+Applicable Licenses\n\
+\n\
+Unless otherwise indicated, all Content made available by the\n\
+Eclipse Foundation is provided to you under the terms and conditions of\n\
+the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
+provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
+For purposes of the EPL, "Program" will mean the Content.\n\
+\n\
+Content includes, but is not limited to, source code, object code,\n\
+documentation and other files maintained in the Eclipse Foundation source code\n\
+repository ("Repository") in software modules ("Modules") and made available\n\
+as downloadable archives ("Downloads").\n\
+\n\
+ - Content may be structured and packaged into modules to facilitate delivering,\n\
+ extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
+ plug-in fragments ("Fragments"), and features ("Features").\n\
+ - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
+ in a directory named "plugins".\n\
+ - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
+ Each Feature may be packaged as a sub-directory in a directory named "features".\n\
+ Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
+ numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
+ - Features may also include other Features ("Included Features"). Within a Feature, files\n\
+ named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
+\n\
+The terms and conditions governing Plug-ins and Fragments should be\n\
+contained in files named "about.html" ("Abouts"). The terms and\n\
+conditions governing Features and Included Features should be contained\n\
+in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
+Licenses may be located in any directory of a Download or Module\n\
+including, but not limited to the following locations:\n\
+\n\
+ - The top-level (root) directory\n\
+ - Plug-in and Fragment directories\n\
+ - Inside Plug-ins and Fragments packaged as JARs\n\
+ - Sub-directories of the directory named "src" of certain Plug-ins\n\
+ - Feature directories\n\
+\n\
+Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
+Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
+Update License") during the installation process. If the Feature contains\n\
+Included Features, the Feature Update License should either provide you\n\
+with the terms and conditions governing the Included Features or inform\n\
+you where you can locate them. Feature Update Licenses may be found in\n\
+the "license" property of files named "feature.properties" found within a Feature.\n\
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
+terms and conditions (or references to such terms and conditions) that\n\
+govern your use of the associated Content in that directory.\n\
+\n\
+THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
+TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
+SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
+\n\
+ - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
+ - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
+ - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
+ - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
+ - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
+\n\
+IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
+TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
+is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
+govern that particular Content.\n\
+\n\
+\n\Use of Provisioning Technology\n\
+\n\
+The Eclipse Foundation makes available provisioning software, examples of which include,\n\
+but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
+the purpose of allowing users to install software, documentation, information and/or\n\
+other materials (collectively "Installable Software"). This capability is provided with\n\
+the intent of allowing such users to install, extend and update Eclipse-based products.\n\
+Information about packaging Installable Software is available at\n\
+http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
+\n\
+You may use Provisioning Technology to allow other parties to install Installable Software.\n\
+You shall be responsible for enabling the applicable license agreements relating to the\n\
+Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
+in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
+making it available in accordance with the Specification, you further acknowledge your\n\
+agreement to, and the acquisition of all necessary rights to permit the following:\n\
+\n\
+ 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
+ the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
+ extending or updating the functionality of an Eclipse-based product.\n\
+ 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
+ Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
+ 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
+ govern the use of the Installable Software ("Installable Software Agreement") and such\n\
+ Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
+ with the Specification. Such Installable Software Agreement must inform the user of the\n\
+ terms and conditions that govern the Installable Software and must solicit acceptance by\n\
+ the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
+ indication of agreement by the user, the provisioning Technology will complete installation\n\
+ of the Installable Software.\n\
+\n\
+Cryptography\n\
+\n\
+Content may contain encryption software. The country in which you are\n\
+currently may have restrictions on the import, possession, and use,\n\
+and/or re-export to another country, of encryption software. BEFORE\n\
+using any encryption software, please check the country's laws,\n\
+regulations and policies concerning the import, possession, or use, and\n\
+re-export of encryption software, to see if this is permitted.\n\
+\n\
+Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/feature.xml b/framework/org.eclipse.mylyn.reviews.sdk.feature/feature.xml
new file mode 100644
index 00000000..6c401eb0
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/feature.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (c) 2010 Tasktop Technologies and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Tasktop Technologies - initial API and implementation
+ -->
+<feature
+ id="org.eclipse.mylyn.reviews.sdk.feature"
+ label="%featureName"
+ version="0.7.0.qualifier"
+ provider-name="%providerName"
+ plugin="org.eclipse.mylyn">
+
+ <description url="http://eclipse.org/mylyn/reviews">
+ %description
+ </description>
+
+ <copyright>
+ %copyright
+ </copyright>
+
+ <license url="license.html">
+ %license
+ </license>
+
+ <includes
+ id="org.eclipse.mylyn.reviews.feature"
+ version="0.0.0"/>
+
+ <includes
+ id="org.eclipse.mylyn.gerrit.feature"
+ version="0.0.0"/>
+
+ <plugin
+ id="org.eclipse.mylyn.gerrit.core.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.mylyn.gerrit.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.mylyn.reviews.core.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="org.eclipse.mylyn.reviews.ui.source"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.gerrit.common"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.gerrit.reviewdb"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.gerrit.prettify"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.gson"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.gwt.user"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.gwtjsonrpc"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+ <plugin
+ id="com.google.gwtorm"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/license.html b/framework/org.eclipse.mylyn.reviews.sdk.feature/license.html
new file mode 100644
index 00000000..c184ca36
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/license.html
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
+<title>Eclipse Foundation Software User Agreement</title>
+</head>
+
+<body lang="EN-US">
+<h2>Eclipse Foundation Software User Agreement</h2>
+<p>April 14, 2010</p>
+
+<h3>Usage Of Content</h3>
+
+<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
+ (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
+ CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
+ OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
+ NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
+ CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
+
+<h3>Applicable Licenses</h3>
+
+<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
+ ("EPL"). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+ For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
+ repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").</p>
+
+<ul>
+ <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").</li>
+ <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".</li>
+ <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins
+ and/or Fragments associated with that Feature.</li>
+ <li>Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.</li>
+</ul>
+
+<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and
+Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module
+including, but not limited to the following locations:</p>
+
+<ul>
+ <li>The top-level (root) directory</li>
+ <li>Plug-in and Fragment directories</li>
+ <li>Inside Plug-ins and Fragments packaged as JARs</li>
+ <li>Sub-directories of the directory named "src" of certain Plug-ins</li>
+ <li>Feature directories</li>
+</ul>
+
+<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the
+installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
+inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature.
+Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
+that directory.</p>
+
+<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
+OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
+
+<ul>
+ <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
+ <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
+ <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
+ <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
+ <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
+</ul>
+
+<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
+contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
+
+
+<h3>Use of Provisioning Technology</h3>
+
+<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
+ Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or
+ other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to
+ install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
+ href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
+ ("Specification").</p>
+
+<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
+ applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
+ in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
+ Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
+
+<ol>
+ <li>A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology
+ on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based
+ product.</li>
+ <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
+ accessed and copied to the Target Machine.</li>
+ <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
+ Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target
+ Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
+ the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
+ indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
+</ol>
+
+<h3>Cryptography</h3>
+
+<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
+ another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
+ possession, or use, and re-export of encryption software, to see if this is permitted.</p>
+
+<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
+</body>
+</html>
diff --git a/framework/org.eclipse.mylyn.reviews.sdk.feature/pom.xml b/framework/org.eclipse.mylyn.reviews.sdk.feature/pom.xml
new file mode 100644
index 00000000..e0cd2d5f
--- /dev/null
+++ b/framework/org.eclipse.mylyn.reviews.sdk.feature/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>mylyn-reviews-framework-parent</artifactId>
+ <groupId>org.eclipse.mylyn.reviews</groupId>
+ <version>0.7.0-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.mylyn.reviews.sdk.feature</artifactId>
+ <packaging>eclipse-feature</packaging>
+</project>
diff --git a/framework/org.eclipse.mylyn.reviews.ui/.settings/org.eclipse.jdt.core.prefs b/framework/org.eclipse.mylyn.reviews.ui/.settings/org.eclipse.jdt.core.prefs
index fbac2391..bbaca6d6 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/framework/org.eclipse.mylyn.reviews.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue May 12 20:42:44 PDT 2009
+#Wed Mar 02 16:00:06 PST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -81,6 +81,7 @@ org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@@ -88,9 +89,10 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
@@ -137,10 +139,16 @@ org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -153,9 +161,14 @@ org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
@@ -338,5 +351,7 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/framework/org.eclipse.mylyn.reviews.ui/.settings/org.eclipse.jdt.ui.prefs b/framework/org.eclipse.mylyn.reviews.ui/.settings/org.eclipse.jdt.ui.prefs
index 8d68e732..ae5a0874 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/framework/org.eclipse.mylyn.reviews.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -1,16 +1,16 @@
-#Thu Sep 11 16:27:18 PDT 2008
+#Wed Mar 02 16:00:03 PST 2011
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Mylyn based on Eclipse
-formatter_settings_version=11
+formatter_settings_version=12
internal.default.compliance=default
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.javadoc=false
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2010 Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/IReviewActionListener.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/IReviewActionListener.java
index 1fa7e94a..513f9294 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/IReviewActionListener.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/IReviewActionListener.java
@@ -1,4 +1,5 @@
package org.eclipse.mylyn.internal.reviews.ui;
+
/*******************************************************************************
* Copyright (c) 2009 Atlassian and others.
* All rights reserved. This program and the accompanying materials
@@ -10,7 +11,6 @@
* Atlassian - initial API and implementation
******************************************************************************/
-
import org.eclipse.jface.action.Action;
/**
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentInformationControlCreator.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentInformationControlCreator.java
index 998271e3..9c5f4844 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentInformationControlCreator.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentInformationControlCreator.java
@@ -21,9 +21,9 @@
* @author Shawn Minto
*/
public class CommentInformationControlCreator implements IInformationControlCreator {
-
+
public IInformationControl createInformationControl(Shell parent) {
return new CommentInformationControl(parent, this);
}
-
+
}
\ No newline at end of file
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java
index 7390d78d..276dca14 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java
@@ -30,7 +30,6 @@
import org.eclipse.ui.forms.IFormColors;
import org.eclipse.ui.forms.widgets.FormToolkit;
-
/**
* Popup to show the information about the annotation in
*
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/IReviewAnnotationModel.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/IReviewAnnotationModel.java
index bb9b0ca6..f33a514e 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/IReviewAnnotationModel.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/IReviewAnnotationModel.java
@@ -14,7 +14,7 @@
import org.eclipse.jface.text.IDocument;
public interface IReviewAnnotationModel {
-
+
void setEditorDocument(IDocument editorDocument);
}
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewAnnotationModel.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewAnnotationModel.java
index 771f3f3b..5716eff9 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewAnnotationModel.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewAnnotationModel.java
@@ -63,8 +63,6 @@ public class ReviewAnnotationModel implements IAnnotationModel, IReviewAnnotatio
private boolean annotated = false;
- private IReview review;
-
private final IDocumentListener documentListener = new IDocumentListener() {
public void documentChanged(DocumentEvent event) {
updateAnnotations(false);
@@ -77,13 +75,12 @@ public void documentAboutToBeChanged(DocumentEvent event) {
private final IFileRevision revision;
public ReviewAnnotationModel(ITextEditor editor, IEditorInput editorInput, IDocument document,
- IFileItem crucibleFile, IFileRevision revision, IReview review) {
+ IFileItem crucibleFile, IFileRevision revision) {
this.textEditor = editor;
this.editorInput = editorInput;
this.editorDocument = document;
this.crucibleFile = crucibleFile;
this.revision = revision;
- this.review = review;
updateAnnotations(true);
}
@@ -246,7 +243,6 @@ public Position getPosition(Annotation annotation) {
public void updateCrucibleFile(IFileItem newCrucibleFile, IReview newReview) {
// TODO we could just update the annotations appropriately instead of remove and re-add
- this.review = newReview;
this.crucibleFile = newCrucibleFile;
updateAnnotations(true);
}
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewAnnotationModelManager.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewAnnotationModelManager.java
index d44abd73..f8d4cf2e 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewAnnotationModelManager.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewAnnotationModelManager.java
@@ -21,7 +21,6 @@
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
-
/**
* Class to manage the annotation model for the open editors
*
@@ -49,8 +48,7 @@ public static void updateAllOpenEditors(Review activeReview) {
private static void update(CompareEditor editor, Review activeReview) {
IEditorInput editorInput = editor.getEditorInput();
if (editorInput instanceof ReviewCompareEditorInput) {
- ((ReviewCompareEditorInput) editorInput).getAnnotationModelToAttach().updateCrucibleFile(
- activeReview);
+ ((ReviewCompareEditorInput) editorInput).getAnnotationModelToAttach().updateCrucibleFile(activeReview);
}
}
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewCompareAnnotationModel.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewCompareAnnotationModel.java
index ecbc156f..69926657 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewCompareAnnotationModel.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/ReviewCompareAnnotationModel.java
@@ -60,7 +60,6 @@
import org.eclipse.ui.texteditor.AnnotationPreferenceLookup;
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
-
/**
* Model for annotations in the diff view.
*
@@ -444,8 +443,6 @@ public boolean isListenerFor(MergeSourceViewer viewer, ReviewAnnotationModel ann
private final ReviewAnnotationModel rightAnnotationModel;
- private final IReview review;
-
private CrucibleViewerTextInputListener leftViewerListener;
private CrucibleViewerTextInputListener rightViewerListener;
@@ -458,13 +455,10 @@ public boolean isListenerFor(MergeSourceViewer viewer, ReviewAnnotationModel ann
private MergeSourceViewer fLeftSourceViewer;
- public ReviewCompareAnnotationModel(IFileItem crucibleFile, IReview review, ITopic commentToFocus) {
+ public ReviewCompareAnnotationModel(IFileItem crucibleFile, ITopic commentToFocus) {
super();
- this.review = review;
- this.leftAnnotationModel = new ReviewAnnotationModel(null, null, null, crucibleFile, crucibleFile.getBase(),
- review);
- this.rightAnnotationModel = new ReviewAnnotationModel(null, null, null, crucibleFile,
- crucibleFile.getTarget(), review);
+ this.leftAnnotationModel = new ReviewAnnotationModel(null, null, null, crucibleFile, crucibleFile.getBase());
+ this.rightAnnotationModel = new ReviewAnnotationModel(null, null, null, crucibleFile, crucibleFile.getTarget());
this.commentToFocus = commentToFocus;
}
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/ExpandablePart.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/ExpandablePart.java
index 59a9b818..ecfdac2b 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/ExpandablePart.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/ExpandablePart.java
@@ -44,7 +44,6 @@
import org.eclipse.ui.forms.widgets.ImageHyperlink;
import org.eclipse.ui.forms.widgets.Section;
-
/**
* A UI part that is expandable like a tree
*
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TopicPart.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TopicPart.java
index 99709254..fca15335 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TopicPart.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/parts/TopicPart.java
@@ -20,7 +20,6 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.FormToolkit;
-
/**
* A UI part to represent a general comment in a review
*
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/ruler/CommentAnnotationRulerColumn.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/ruler/CommentAnnotationRulerColumn.java
index a7720898..d4d7507c 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/ruler/CommentAnnotationRulerColumn.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/editors/ruler/CommentAnnotationRulerColumn.java
@@ -47,7 +47,6 @@
import org.eclipse.ui.texteditor.rulers.IContributedRulerColumn;
import org.eclipse.ui.texteditor.rulers.RulerColumnDescriptor;
-
public class CommentAnnotationRulerColumn extends AbstractRulerColumn implements IContributedRulerColumn {
/** The contribution descriptor. */
diff --git a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ProgressDialog.java b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ProgressDialog.java
index 0970b2e1..9b1b5718 100644
--- a/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ProgressDialog.java
+++ b/framework/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ProgressDialog.java
@@ -11,6 +11,10 @@
package org.eclipse.mylyn.reviews.ui;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+import java.util.HashMap;
+
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.TitleAreaDialog;
@@ -22,6 +26,7 @@
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -31,10 +36,6 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Collection;
-import java.util.HashMap;
-
/**
* Dialog that can display progress
*
@@ -68,7 +69,7 @@ protected Control createDialogArea(Composite parent) {
Composite composite = (Composite) super.createDialogArea(parent);
// Build the Page container
pageContainer = new Composite(composite, SWT.NONE);
- pageContainer.setLayout(new GridLayout());
+ pageContainer.setLayout(new FillLayout());
GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
pageContainer.setLayoutData(gd);
pageContainer.setFont(parent.getFont());
@@ -145,10 +146,6 @@ private void stopped(Object savedState) {
}
}
- @Override
- protected void createButtonsForButtonBar(Composite parent) {
- }
-
/**
* Create the progress monitor part in the receiver.
*
@@ -203,11 +200,9 @@ public void subTask(String name) {
* has been run, regardless of the value of <code>fork</code>. It is recommended that <code>fork</code> is set to
* true in most cases. If <code>fork</code> is set to <code>false</code>, the runnable will run in the UI thread and
* it is the runnable's responsibility to call <code>Display.readAndDispatch()</code> to ensure UI responsiveness.
- *
* UI state is saved prior to executing the long-running operation and is restored after the long-running operation
* completes executing. Any attempt to change the UI state of the wizard in the long-running operation will be
* nullified when original UI state is restored.
- *
*/
public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException,
InterruptedException {
diff --git a/framework/pom.xml b/framework/pom.xml
index ea163e98..82c28d0c 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -11,7 +11,9 @@
<packaging>pom</packaging>
<modules>
<module>org.eclipse.mylyn.reviews.core</module>
+ <module>org.eclipse.mylyn.reviews.feature</module>
<module>org.eclipse.mylyn.reviews.frame.core</module>
+ <module>org.eclipse.mylyn.reviews.sdk.feature</module>
<module>org.eclipse.mylyn.reviews.ui</module>
</modules>
</project>
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/.classpath b/gerrit/org.eclipse.mylyn.gerrit.core/.classpath
index 304e8618..64c5e31b 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/.classpath
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/.settings/org.eclipse.jdt.core.prefs b/gerrit/org.eclipse.mylyn.gerrit.core/.settings/org.eclipse.jdt.core.prefs
index fbac2391..48cee56f 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/.settings/org.eclipse.jdt.core.prefs
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue May 12 20:42:44 PDT 2009
+#Wed Mar 02 16:00:06 PST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -81,6 +81,7 @@ org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@@ -88,9 +89,10 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
@@ -122,11 +124,9 @@ org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
@@ -137,10 +137,16 @@ org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -152,10 +158,13 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
@@ -338,5 +347,7 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/.settings/org.eclipse.jdt.ui.prefs b/gerrit/org.eclipse.mylyn.gerrit.core/.settings/org.eclipse.jdt.ui.prefs
index 8d68e732..f6c0a161 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/.settings/org.eclipse.jdt.ui.prefs
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/.settings/org.eclipse.jdt.ui.prefs
@@ -1,16 +1,16 @@
-#Thu Sep 11 16:27:18 PDT 2008
+#Wed Mar 02 16:00:06 PST 2011
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Mylyn based on Eclipse
-formatter_settings_version=11
+formatter_settings_version=12
internal.default.compliance=default
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.javadoc=false
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2010 Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF b/gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF
index f1f0d27e..9594979d 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/META-INF/MANIFEST.MF
@@ -23,7 +23,8 @@ Require-Bundle: org.eclipse.core.runtime,
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Export-Package: org.eclipse.mylyn.internal.gerrit.core;x-friends:="org.eclipse.mylyn.gerrit.ui",
- org.eclipse.mylyn.internal.gerrit.core.client;x-friends:="org.eclipse.mylyn.gerrit.ui"
+ org.eclipse.mylyn.internal.gerrit.core.client;x-friends:="org.eclipse.mylyn.gerrit.ui",
+ org.eclipse.mylyn.internal.gerrit.core.operations;x-friends:="org.eclipse.mylyn.gerrit.ui"
Bundle-Vendor: Eclipse Mylyn
Import-Package: com.google.gson;version="1.4.0",
com.google.gson.reflect;version="1.4.0"
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/build.properties b/gerrit/org.eclipse.mylyn.gerrit.core/build.properties
index 9adcaaf4..1b8cf665 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/build.properties
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/build.properties
@@ -9,7 +9,6 @@
bin.includes = .,\
model/,\
- plugin.xml,\
META-INF/
jars.compile.order = .
source.. = src/
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/plugin.xml b/gerrit/org.eclipse.mylyn.gerrit.core/plugin.xml
deleted file mode 100644
index ae0190ec..00000000
--- a/gerrit/org.eclipse.mylyn.gerrit.core/plugin.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-
-<!--
- Copyright (c) 2011 Tasktop Technologies and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- Tasktop Technologies - initial API and implementation
--->
-
-<plugin>
-
- <extension point="org.eclipse.emf.ecore.generated_package">
- <package
- uri="http://eclipse.org/mylyn/reviews/core/1.0"
- class="org.eclipse.mylyn.reviews.internal.core.model.ReviewsPackage"
- genModel="model/reviews.genmodel"/>
- </extension>
-
-</plugin>
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritAttribute.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritAttribute.java
deleted file mode 100644
index 5294b7cb..00000000
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritAttribute.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*********************************************************************
- * Copyright (c) 2010 Sony Ericsson/ST Ericsson and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sony Ericsson/ST Ericsson - initial API and implementation
- *********************************************************************/
-package org.eclipse.mylyn.internal.gerrit.core;
-
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-
-/**
- * Enum holding the mapping of gerrit task attributes to mylyn task attributes.
- *
- * @author Mikael Kober
- * @author Thomas Westling
- */
-public enum GerritAttribute {
-
- ID(GerritConstants.ATTRIBUTE_ID, "ID", TaskAttribute.TASK_KEY, TaskAttribute.TYPE_SHORT_TEXT, true),
- // BRANCH(GerritConstants.ATTRIBUTE_BRANCH, "Branch", TaskAttribute.USER_ASSIGNED, TaskAttribute.TYPE_PERSON, true),
- OWNER(GerritConstants.ATTRIBUTE_OWNER, "Owner", TaskAttribute.USER_ASSIGNED, TaskAttribute.TYPE_PERSON, true), //
- PROJECT(GerritConstants.ATTRIBUTE_PROJECT, "Project", TaskAttribute.PRODUCT, TaskAttribute.TYPE_SHORT_TEXT, true), //
- STATUS(GerritConstants.ATTRIBUTE_STATUS, "Status", TaskAttribute.STATUS, TaskAttribute.TYPE_SHORT_TEXT, false), //
- SUMMARY(GerritConstants.ATTRIBUTE_SUMMARY, "Title", TaskAttribute.SUMMARY, TaskAttribute.TYPE_SHORT_RICH_TEXT, true), //
- URL(GerritConstants.ATTRIBUTE_URL, "URL", TaskAttribute.TASK_URL, TaskAttribute.TYPE_URL, true), //
- UPLOADED(GerritConstants.ATTRIBUTE_UPLOADED, "Uploaded", TaskAttribute.DATE_CREATION, TaskAttribute.TYPE_DATE, true), //
- UPDATED(GerritConstants.ATTRIBUTE_UPDATED, "Updated", TaskAttribute.DATE_MODIFICATION, TaskAttribute.TYPE_DATE,
- true), //
- DESCRIPTION(GerritConstants.ATTRIBUTE_DESCRIPTION, "Description", TaskAttribute.DESCRIPTION,
- TaskAttribute.TYPE_LONG_RICH_TEXT, true), //
- COMPLETED(TaskAttribute.DATE_COMPLETION, "Completed", TaskAttribute.DATE_COMPLETION, TaskAttribute.TYPE_DATE, true); //
-
- private final String gerritKey;
-
- private final String prettyName;
-
- private final String taskKey;
-
- private final String type;
-
- private final boolean readOnly;
-
- /**
- * Constructor.
- *
- * @param gerritKey
- * @param prettyName
- * @param taskKey
- * @param type
- * @param readOnly
- */
- GerritAttribute(String gerritKey, String prettyName, String taskKey, String type, boolean readOnly) {
- this.gerritKey = gerritKey;
- this.taskKey = taskKey;
- this.prettyName = prettyName;
- this.type = type;
- this.readOnly = readOnly;
- }
-
- /**
- * Get the gerrit specifiv key.
- *
- * @return the gerrit specific key
- */
- public String getGerritKey() {
- return gerritKey;
- }
-
- /**
- * Get the attribute kind
- *
- * @return attribute kind
- */
- public String getKind() {
- switch (this) {
- case PROJECT:
- return TaskAttribute.KIND_DEFAULT;
- default:
- return null;
- }
- }
-
- /**
- * Get the task key.
- *
- * @return the mylyn task key
- */
- public String getTaskKey() {
- return taskKey;
- }
-
- /**
- * Get the attribute type.
- *
- * @return attribute type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Check if this is a read only attribute.
- *
- * @return true if the attribute is read only, false otherwise
- */
- public boolean isReadOnly() {
- return readOnly;
- }
-
- /* (non-Javadoc)
- *
- * @see java.lang.Enum#toString() */
- @Override
- public String toString() {
- return prettyName;
- }
-
-}
\ No newline at end of file
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java
index 6d34e8ab..101908b9 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConnector.java
@@ -39,6 +39,7 @@
import org.eclipse.osgi.util.NLS;
import com.google.gerrit.common.data.ChangeInfo;
+import com.google.gerrit.common.data.GerritConfig;
/**
* The Gerrit connector core.
@@ -63,6 +64,8 @@ public class GerritConnector extends AbstractRepositoryConnector {
*/
public static final String CONNECTOR_LABEL = "Gerrit Code Review";
+ private static final String KEY_REPOSITORY_CONFIG = CONNECTOR_KIND + ".config";
+
private final GerritTaskDataHandler taskDataHandler = new GerritTaskDataHandler(this);
private TaskRepositoryLocationFactory taskRepositoryLocationFactory = new TaskRepositoryLocationFactory();
@@ -160,6 +163,7 @@ public IStatus performQuery(TaskRepository repository, IRepositoryQuery query, T
try {
monitor.beginTask("Executing query", IProgressMonitor.UNKNOWN);
GerritClient client = getClient(repository);
+ client.refreshConfigOnce(monitor);
List<ChangeInfo> result = null;
if (GerritQuery.ALL_OPEN_CHANGES.equals(query.getAttribute(GerritQuery.TYPE))) {
result = client.queryAllReviews(monitor);
@@ -196,7 +200,11 @@ public synchronized void setTaskRepositoryLocationFactory(
@Override
public void updateRepositoryConfiguration(TaskRepository repository, IProgressMonitor monitor) throws CoreException {
- // ignore
+ try {
+ getClient(repository).refreshConfig(monitor);
+ } catch (GerritException e) {
+ throw toCoreException(repository, e);
+ }
}
@Override
@@ -209,8 +217,14 @@ public GerritClient getClient(TaskRepository repository) {
return createClient(repository);
}
- private GerritClient createClient(TaskRepository repository) {
- return new GerritClient(taskRepositoryLocationFactory.createWebLocation(repository));
+ private GerritClient createClient(final TaskRepository repository) {
+ GerritConfig config = GerritClient.configFromString(repository.getProperty(KEY_REPOSITORY_CONFIG));
+ return new GerritClient(taskRepositoryLocationFactory.createWebLocation(repository), config) {
+ @Override
+ protected void configurationChanged(GerritConfig config) {
+ repository.setProperty(KEY_REPOSITORY_CONFIG, GerritClient.configToString(config));
+ }
+ };
}
CoreException toCoreException(TaskRepository repository, GerritException e) {
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConstants.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConstants.java
deleted file mode 100644
index 4d5040ed..00000000
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritConstants.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*********************************************************************
- * Copyright (c) 2010 Sony Ericsson/ST Ericsson and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sony Ericsson/ST Ericsson - initial API and implementation
- *********************************************************************/
-package org.eclipse.mylyn.internal.gerrit.core;
-
-/**
- * Constants.
- *
- * @author Mikael Kober
- * @author Thomas Westling
- */
-public class GerritConstants {
-
- public static final String ATTRIBUTE_ID = "attribute.gerrit.id";
-
- public static final String ATTRIBUTE_CHANGEID = "attribute.gerrit.changeid";
-
- public static final String ATTRIBUTE_OWNER = "attribute.gerrit.owner";
-
- public static final String ATTRIBUTE_PROJECT = "attribute.gerrit.project";
-
- public static final String ATTRIBUTE_SUMMARY = "attribute.gerrit.summary";
-
- public static final String ATTRIBUTE_STATUS = "attribute.gerrit.status";
-
- public static final String ATTRIBUTE_URL = "attribute.gerrit.url";
-
- public static final String ATTRIBUTE_UPLOADED = "attribute.gerrit.uploaded";
-
- public static final String ATTRIBUTE_UPDATED = "attribute.gerrit.updated";
-
- public static final String ATTRIBUTE_DESCRIPTION = "attribute.gerrit.description";
-
- public static final int HTTPSPORT = 443;
-
- public static final String ATTRIBUTE_BRANCH = "attribute.gerrit.branch";
-
-}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritOperationFactory.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritOperationFactory.java
new file mode 100644
index 00000000..99b7b373
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritOperationFactory.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core;
+
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.operations.AbandonRequest;
+import org.eclipse.mylyn.internal.gerrit.core.operations.AddReviewersRequest;
+import org.eclipse.mylyn.internal.gerrit.core.operations.GerritOperation;
+import org.eclipse.mylyn.internal.gerrit.core.operations.PublishRequest;
+import org.eclipse.mylyn.internal.gerrit.core.operations.RefreshConfigRequest;
+import org.eclipse.mylyn.internal.gerrit.core.operations.RestoreRequest;
+import org.eclipse.mylyn.internal.gerrit.core.operations.SubmitRequest;
+import org.eclipse.mylyn.tasks.core.IRepositoryManager;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritOperationFactory {
+
+ private final IRepositoryManager repositoryManager;
+
+ public GerritOperationFactory(IRepositoryManager repositoryManager) {
+ this.repositoryManager = repositoryManager;
+ }
+
+ public GerritOperation createAbandonOperation(ITask review, AbandonRequest request) {
+ return new GerritOperation("Abandoning Change", getClient(review), request);
+ }
+
+ public GerritOperation createAddReviewersOperation(ITask review, AddReviewersRequest request) {
+ return new GerritOperation("Adding Reviewers", getClient(review), request);
+ }
+
+ public GerritOperation createPublishOperation(ITask review, PublishRequest request) {
+ return new GerritOperation("Publishing Change", getClient(review), request);
+ }
+
+ public GerritOperation createRefreshConfigOperation(ITask review, RefreshConfigRequest request) {
+ return new GerritOperation("Refreshing Configuration", getClient(review), request);
+ }
+
+ public GerritOperation createRestoreOperation(ITask review, RestoreRequest request) {
+ return new GerritOperation("Restoring Change", getClient(review), request);
+ }
+
+ public GerritOperation createSubmitOperation(ITask review, SubmitRequest request) {
+ return new GerritOperation("Submitting Change", getClient(review), request);
+ }
+
+ public GerritClient getClient(ITask review) {
+ TaskRepository repository = repositoryManager.getRepository(review.getConnectorKind(),
+ review.getRepositoryUrl());
+ GerritConnector connector = (GerritConnector) repositoryManager.getRepositoryConnector(repository.getConnectorKind());
+ GerritClient client = connector.getClient(repository);
+ return client;
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskAttributeMapper.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskAttributeMapper.java
deleted file mode 100644
index 18cdff8b..00000000
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskAttributeMapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*********************************************************************
- * Copyright (c) 2010 Sony Ericsson/ST Ericsson and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sony Ericsson/ST Ericsson - initial API and implementation
- *********************************************************************/
-package org.eclipse.mylyn.internal.gerrit.core;
-
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
-
-/**
- * TaskAttributeMapper for Gerrit.
- *
- * @author Mikael Kober
- * @author Thomas Westling
- */
-public class GerritTaskAttributeMapper extends TaskAttributeMapper {
-
- /**
- * Constructor.
- *
- * @param taskRepository
- */
- public GerritTaskAttributeMapper(TaskRepository taskRepository) {
- super(taskRepository);
- }
-
- /* (non-Javadoc)
- *
- * @see org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper#mapToRepositoryKey(org.eclipse.mylyn.tasks.core.data.
- * TaskAttribute, java.lang.String) */
- @Override
- public String mapToRepositoryKey(TaskAttribute parent, String key) {
- for (GerritAttribute attr : GerritAttribute.values()) {
- if (key.equals(attr.getTaskKey())) {
- key = attr.getGerritKey();
- break;
- }
- }
- return key;
- }
-
-}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskDataHandler.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskDataHandler.java
index 769af13a..f734c6e1 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskDataHandler.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskDataHandler.java
@@ -16,8 +16,10 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritChange;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+import org.eclipse.mylyn.internal.gerrit.core.client.JSonSupport;
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
@@ -25,9 +27,9 @@
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMetaData;
import org.eclipse.mylyn.tasks.core.data.TaskCommentMapper;
import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema.Field;
import com.google.gerrit.common.data.AccountInfo;
import com.google.gerrit.common.data.ChangeDetail;
@@ -42,28 +44,6 @@
*/
public class GerritTaskDataHandler extends AbstractTaskDataHandler {
- public static TaskAttribute createAttribute(TaskData data, GerritAttribute gerritAttribute) {
- TaskAttribute attr = data.getRoot().createAttribute(gerritAttribute.getGerritKey());
- TaskAttributeMetaData metaData = attr.getMetaData();
- metaData.setType(gerritAttribute.getType());
- metaData.setKind(gerritAttribute.getKind());
- metaData.setLabel(gerritAttribute.toString());
- metaData.setReadOnly(gerritAttribute.isReadOnly());
- return attr;
- }
-
- public static void createDefaultAttributes(TaskData data) {
- createAttribute(data, GerritAttribute.ID);
- createAttribute(data, GerritAttribute.OWNER);
- createAttribute(data, GerritAttribute.PROJECT);
- createAttribute(data, GerritAttribute.SUMMARY);
- createAttribute(data, GerritAttribute.STATUS);
- createAttribute(data, GerritAttribute.URL);
- createAttribute(data, GerritAttribute.UPDATED);
- createAttribute(data, GerritAttribute.UPLOADED);
- createAttribute(data, GerritAttribute.DESCRIPTION);
- }
-
public static String dateToString(Date date) {
if (date == null) {
return ""; //$NON-NLS-1$
@@ -81,13 +61,13 @@ public GerritTaskDataHandler(GerritConnector connector) {
public TaskData createTaskData(TaskRepository repository, String taskId, IProgressMonitor monitor) {
TaskData data = new TaskData(getAttributeMapper(repository), GerritConnector.CONNECTOR_KIND,
repository.getRepositoryUrl(), taskId);
- createDefaultAttributes(data);
+ initializeTaskData(repository, data, null, monitor);
return data;
}
@Override
public TaskAttributeMapper getAttributeMapper(TaskRepository repository) {
- return new GerritTaskAttributeMapper(repository);
+ return new TaskAttributeMapper(repository);
}
/**
@@ -97,9 +77,10 @@ public TaskData getTaskData(TaskRepository repository, String taskId, IProgressM
throws CoreException {
try {
GerritClient client = connector.getClient(repository);
- ChangeDetail changeDetail = client.getChangeDetail(client.id(taskId), monitor);
+ client.refreshConfigOnce(monitor);
+ GerritChange review = client.getChange(taskId, monitor);
TaskData taskData = createTaskData(repository, taskId, monitor);
- updateTaskData(repository, taskData, changeDetail);
+ updateTaskData(repository, taskData, review, !client.isAnonymous());
return taskData;
} catch (GerritException e) {
throw connector.toCoreException(repository, e);
@@ -108,8 +89,8 @@ public TaskData getTaskData(TaskRepository repository, String taskId, IProgressM
@Override
public boolean initializeTaskData(TaskRepository repository, TaskData taskData, ITaskMapping initializationData,
- IProgressMonitor monitor) throws CoreException {
- createDefaultAttributes(taskData);
+ IProgressMonitor monitor) {
+ GerritTaskSchema.getDefault().initialize(taskData);
return true;
}
@@ -119,29 +100,36 @@ public RepositoryResponse postTaskData(TaskRepository repository, TaskData taskD
throw new UnsupportedOperationException();
}
- public void updateTaskData(TaskRepository repository, TaskData data, ChangeDetail changeDetail) {
+ public void updateTaskData(TaskRepository repository, TaskData data, GerritChange review, boolean canPublish) {
+ GerritTaskSchema schema = GerritTaskSchema.getDefault();
+
+ ChangeDetail changeDetail = review.getChangeDetail();
Change change = changeDetail.getChange();
AccountInfo owner = changeDetail.getAccounts().get(change.getOwner());
- setAttributeValue(data, GerritAttribute.ID, change.getChangeId() + ""); //$NON-NLS-1$
- setAttributeValue(data, GerritAttribute.OWNER, owner.getFullName());
- setAttributeValue(data, GerritAttribute.PROJECT, change.getProject().get());
- setAttributeValue(data, GerritAttribute.SUMMARY, change.getSubject());
- setAttributeValue(data, GerritAttribute.STATUS, change.getStatus().toString());
+
+ setAttributeValue(data, schema.KEY, change.getId().toString());
+ //setAttributeValue(data, schema.KEY, change.getKey().abbreviate());
+ setAttributeValue(data, schema.CHANGE_ID, change.getKey().get());
+ setAttributeValue(data, schema.BRANCH, change.getDest().get());
+ setAttributeValue(data, schema.OWNER, GerritUtil.getUserLabel(owner));
+ setAttributeValue(data, schema.PROJECT, change.getProject().get());
+ setAttributeValue(data, schema.SUMMARY, change.getSubject());
+ setAttributeValue(data, schema.STATUS, change.getStatus().toString());
//setAttributeValue(data, GerritAttribute.URL, change.getUrl());
- setAttributeValue(data, GerritAttribute.UPDATED, dateToString(change.getLastUpdatedOn()));
- setAttributeValue(data, GerritAttribute.UPLOADED, dateToString(change.getCreatedOn()));
- setAttributeValue(data, GerritAttribute.DESCRIPTION, changeDetail.getDescription());
- setAttributeValue(data, GerritAttribute.URL, connector.getTaskUrl(repository.getUrl(), data.getTaskId()));
+ setAttributeValue(data, schema.UPDATED, dateToString(change.getLastUpdatedOn()));
+ setAttributeValue(data, schema.UPLOADED, dateToString(change.getCreatedOn()));
+ setAttributeValue(data, schema.DESCRIPTION, changeDetail.getDescription());
+ setAttributeValue(data, schema.URL, connector.getTaskUrl(repository.getUrl(), data.getTaskId()));
if (change.getStatus() != null && change.getStatus().isClosed()) {
- createAttribute(data, GerritAttribute.COMPLETED);
- setAttributeValue(data, GerritAttribute.COMPLETED, dateToString(change.getLastUpdatedOn()));
+ setAttributeValue(data, schema.COMPLETED, dateToString(change.getLastUpdatedOn()));
}
int i = 1;
for (ChangeMessage message : changeDetail.getMessages()) {
TaskCommentMapper mapper = new TaskCommentMapper();
if (message.getAuthor() != null) {
AccountInfo author = changeDetail.getAccounts().get(message.getAuthor());
- IRepositoryPerson person = repository.createPerson((author.getPreferredEmail() != null) ? author.getPreferredEmail()
+ IRepositoryPerson person = repository.createPerson((author.getPreferredEmail() != null)
+ ? author.getPreferredEmail()
: author.getId() + ""); //$NON-NLS-1$
person.setName(author.getFullName());
mapper.setAuthor(person);
@@ -153,23 +141,28 @@ public void updateTaskData(TaskRepository repository, TaskData data, ChangeDetai
mapper.applyTo(attribute);
i++;
}
+
+ JSonSupport json = new JSonSupport();
+ setAttributeValue(data, schema.OBJ_REVIEW, json.getGson().toJson(review));
+ setAttributeValue(data, schema.CAN_PUBLISH, Boolean.toString(canPublish));
}
public void updateTaskData(TaskData data, ChangeInfo changeInfo) {
- setAttributeValue(data, GerritAttribute.ID, changeInfo.getId() + ""); //$NON-NLS-1$
- setAttributeValue(data, GerritAttribute.OWNER, changeInfo.getOwner().toString());
- setAttributeValue(data, GerritAttribute.PROJECT, changeInfo.getProject().getName());
- setAttributeValue(data, GerritAttribute.SUMMARY, changeInfo.getSubject());
- setAttributeValue(data, GerritAttribute.STATUS, changeInfo.getStatus().toString());
+ GerritTaskSchema schema = GerritTaskSchema.getDefault();
+ setAttributeValue(data, schema.KEY, changeInfo.getId() + ""); //$NON-NLS-1$
+ setAttributeValue(data, schema.OWNER, changeInfo.getOwner().toString());
+ setAttributeValue(data, schema.PROJECT, changeInfo.getProject().getName());
+ setAttributeValue(data, schema.SUMMARY, changeInfo.getSubject());
+ setAttributeValue(data, schema.STATUS, changeInfo.getStatus().toString());
//setAttributeValue(data, GerritAttribute.URL, change.getUrl());
- setAttributeValue(data, GerritAttribute.UPDATED, dateToString(changeInfo.getLastUpdatedOn()));
+ setAttributeValue(data, schema.UPDATED, dateToString(changeInfo.getLastUpdatedOn()));
}
/**
* Convenience method to set the value of a given Attribute in the given {@link TaskData}.
*/
- private TaskAttribute setAttributeValue(TaskData data, GerritAttribute gerritAttribut, String value) {
- TaskAttribute attribute = data.getRoot().getAttribute(gerritAttribut.getGerritKey());
+ private TaskAttribute setAttributeValue(TaskData data, Field gerritAttribut, String value) {
+ TaskAttribute attribute = data.getRoot().getAttribute(gerritAttribut.getKey());
if (value != null) {
attribute.setValue(value);
}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskSchema.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskSchema.java
new file mode 100644
index 00000000..483a7383
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritTaskSchema.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core;
+
+import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema;
+import org.eclipse.mylyn.tasks.core.data.DefaultTaskSchema;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritTaskSchema extends AbstractTaskSchema {
+
+ private static final GerritTaskSchema instance = new GerritTaskSchema();
+
+ public static GerritTaskSchema getDefault() {
+ return instance;
+ }
+
+ private final DefaultTaskSchema parent = DefaultTaskSchema.getInstance();
+
+ public final Field SUMMARY = inheritFrom(parent.SUMMARY).create();
+
+ public final Field STATUS = inheritFrom(parent.STATUS).create();
+
+ public final Field COMPLETED = inheritFrom(parent.DATE_COMPLETION).create();
+
+ public final Field UPLOADED = inheritFrom(parent.DATE_CREATION).create();
+
+ public final Field UPDATED = inheritFrom(parent.DATE_MODIFICATION).create();
+
+ public final Field OWNER = inheritFrom(parent.USER_ASSIGNED).flags(Flag.READ_ONLY, Flag.ATTRIBUTE).create();
+
+ public final Field PROJECT = createField(TaskAttribute.PRODUCT, "Project", TaskAttribute.TYPE_SHORT_TEXT,
+ Flag.READ_ONLY, Flag.ATTRIBUTE);
+
+ public final Field BRANCH = createField("org.eclipse.gerrit.Branch", "Branch", TaskAttribute.TYPE_SHORT_TEXT,
+ Flag.READ_ONLY, Flag.ATTRIBUTE);
+
+ public final Field CHANGE_ID = createField("org.eclipse.gerrit.Key", "Change-Id", TaskAttribute.TYPE_LONG_TEXT,
+ Flag.READ_ONLY, Flag.ATTRIBUTE);
+
+ public final Field KEY = inheritFrom(parent.TASK_KEY).create();
+
+ public final Field URL = inheritFrom(parent.TASK_URL).create();
+
+ public final Field DESCRIPTION = inheritFrom(parent.DESCRIPTION).create();
+
+ public final Field OBJ_REVIEW = createField("org.eclipse.gerrit.Review", "Review", TaskAttribute.TYPE_LONG_TEXT);
+
+ public final Field CAN_PUBLISH = createField("org.eclipse.gerrit.CanPublish", "Publish", TaskAttribute.TYPE_BOOLEAN);
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritUtil.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritUtil.java
new file mode 100644
index 00000000..09a43154
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/GerritUtil.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritChange;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+import org.eclipse.mylyn.internal.gerrit.core.client.JSonSupport;
+import org.eclipse.mylyn.reviews.core.model.IComment;
+import org.eclipse.mylyn.reviews.core.model.IFileItem;
+import org.eclipse.mylyn.reviews.core.model.IFileRevision;
+import org.eclipse.mylyn.reviews.core.model.ILineLocation;
+import org.eclipse.mylyn.reviews.core.model.ILineRange;
+import org.eclipse.mylyn.reviews.core.model.IReview;
+import org.eclipse.mylyn.reviews.core.model.IReviewItem;
+import org.eclipse.mylyn.reviews.core.model.IReviewItemSet;
+import org.eclipse.mylyn.reviews.core.model.ITopic;
+import org.eclipse.mylyn.reviews.core.model.IUser;
+import org.eclipse.mylyn.reviews.internal.core.model.ReviewsFactory;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskData;
+import org.eclipse.osgi.util.NLS;
+
+import com.google.gerrit.common.data.AccountInfo;
+import com.google.gerrit.common.data.AccountInfoCache;
+import com.google.gerrit.common.data.ChangeDetail;
+import com.google.gerrit.common.data.CommentDetail;
+import com.google.gerrit.common.data.PatchScript;
+import com.google.gerrit.common.data.PatchSetDetail;
+import com.google.gerrit.prettify.common.SparseFileContent;
+import com.google.gerrit.reviewdb.Account.Id;
+import com.google.gerrit.reviewdb.Patch;
+import com.google.gerrit.reviewdb.PatchLineComment;
+import com.google.gerrit.reviewdb.PatchSet;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritUtil {
+
+ private static final ReviewsFactory FACTORY = ReviewsFactory.eINSTANCE;
+
+ public static GerritChange getChange(TaskData taskData) {
+ JSonSupport json = new JSonSupport();
+ TaskAttribute attribute = taskData.getRoot().getAttribute(GerritTaskSchema.getDefault().OBJ_REVIEW.getKey());
+ if (attribute != null) {
+ return json.getGson().fromJson(attribute.getValue(), GerritChange.class);
+ }
+ return null;
+ }
+
+ public static IReview toReview(ChangeDetail detail) throws GerritException {
+ IReview review = FACTORY.createReview();
+ review.setId(detail.getChange().getId().get() + "");
+ List<PatchSet> patchSets = detail.getPatchSets();
+ for (PatchSet patchSet : patchSets) {
+ IReviewItemSet itemSet = FACTORY.createReviewItemSet();
+ itemSet.setName(NLS.bind("Patch Set {0}", patchSet.getPatchSetId()));
+ itemSet.setId(patchSet.getPatchSetId() + "");
+ itemSet.setAddedBy(createUser(patchSet.getUploader(), detail.getAccounts()));
+ itemSet.setRevision(patchSet.getRevision().get());
+ itemSet.setReview(review);
+ review.getItems().add(itemSet);
+ }
+ return review;
+ }
+
+ public static List<IReviewItem> toReviewItems(PatchSetDetail detail,
+ Map<Patch.Key, PatchScript> patchScriptByPatchKey) {
+ List<IReviewItem> items = new ArrayList<IReviewItem>();
+ for (Patch patch : detail.getPatches()) {
+ IFileItem item = FACTORY.createFileItem();
+ item.setName(patch.getFileName());
+ items.add(item);
+
+ if (patchScriptByPatchKey != null) {
+ PatchScript patchScript = patchScriptByPatchKey.get(patch.getKey());
+ if (patchScript != null) {
+ CommentDetail commentDetail = patchScript.getCommentDetail();
+
+ IFileRevision revisionA = FACTORY.createFileRevision();
+ revisionA.setContent(patchScript.getA().asString());
+ revisionA.setPath(patchScript.getA().getPath());
+ revisionA.setRevision("Base");
+ addComments(revisionA, commentDetail.getCommentsA(), commentDetail.getAccounts());
+ item.setBase(revisionA);
+
+ IFileRevision revisionB = FACTORY.createFileRevision();
+ SparseFileContent target = patchScript.getB().apply(patchScript.getA(), patchScript.getEdits());
+ revisionB.setContent(target.asString());
+ revisionB.setPath(patchScript.getB().getPath());
+ revisionB.setRevision(NLS.bind("Patch Set {0}", detail.getPatchSet().getPatchSetId()));
+ addComments(revisionB, commentDetail.getCommentsB(), commentDetail.getAccounts());
+ item.setTarget(revisionB);
+ }
+ }
+ }
+ return items;
+ }
+
+ private static void addComments(IFileRevision revision, List<PatchLineComment> comments,
+ AccountInfoCache accountInfoCache) {
+ if (comments == null) {
+ return;
+ }
+ for (PatchLineComment comment : comments) {
+ ILineRange line = FACTORY.createLineRange();
+ line.setStart(comment.getLine());
+ line.setEnd(comment.getLine());
+ ILineLocation location = FACTORY.createLineLocation();
+ location.getRanges().add(line);
+
+ IUser author = GerritUtil.createUser(comment.getAuthor(), accountInfoCache);
+
+ IComment topicComment = FACTORY.createComment();
+ topicComment.setAuthor(author);
+ topicComment.setCreationDate(comment.getWrittenOn());
+ topicComment.setDescription(comment.getMessage());
+
+ ITopic topic = FACTORY.createTopic();
+ topic.setAuthor(author);
+ topic.setCreationDate(comment.getWrittenOn());
+ topic.setLocation(location);
+ topic.setItem(revision);
+ topic.setDescription(comment.getMessage());
+ topic.getComments().add(topicComment);
+
+ revision.getTopics().add(topic);
+ }
+ }
+
+ public static IUser createUser(Id id, AccountInfoCache accountInfoCache) {
+ AccountInfo info = accountInfoCache.get(id);
+ IUser user = FACTORY.createUser();
+ user.setDisplayName(getUserLabel(info));
+ user.setId(Integer.toString(id.get()));
+ return user;
+ }
+
+ public static String getUserLabel(AccountInfo user) {
+ if (user == null) {
+ return "Anonymous";
+ }
+ if (user.getFullName() != null) {
+ return user.getFullName();
+ }
+ if (user.getPreferredEmail() != null) {
+ String email = user.getPreferredEmail();
+ int i = email.indexOf("@");
+ return (i > 0) ? email.substring(0, i) : email;
+ }
+ return "<Unknown>";
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritChange.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritChange.java
new file mode 100644
index 00000000..dd4102d9
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritChange.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client;
+
+import java.util.List;
+import java.util.Map;
+
+import com.google.gerrit.common.data.ChangeDetail;
+import com.google.gerrit.common.data.PatchSetDetail;
+import com.google.gerrit.common.data.PatchSetPublishDetail;
+import com.google.gerrit.reviewdb.PatchSet;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritChange {
+
+ private ChangeDetail changeDetail;
+
+ private List<PatchSetDetail> patchSetDetails;
+
+ private Map<PatchSet.Id, PatchSetPublishDetail> publishDetailByPatchSetId;
+
+ public ChangeDetail getChangeDetail() {
+ return changeDetail;
+ }
+
+ public List<PatchSetDetail> getPatchSetDetails() {
+ return patchSetDetails;
+ }
+
+ public Map<PatchSet.Id, PatchSetPublishDetail> getPublishDetailByPatchSetId() {
+ return publishDetailByPatchSetId;
+ }
+
+ void setChangeDetail(ChangeDetail changeDetail) {
+ this.changeDetail = changeDetail;
+ }
+
+ void setPatchSets(List<PatchSetDetail> patchSets) {
+ this.patchSetDetails = patchSets;
+ }
+
+ void setPatchSetPublishDetailByPatchSetId(Map<PatchSet.Id, PatchSetPublishDetail> patchSetPublishDetailByPatchSetId) {
+ this.publishDetailByPatchSetId = patchSetPublishDetailByPatchSetId;
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java
index b20ada78..5d282890 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritClient.java
@@ -11,46 +11,64 @@
*********************************************************************/
package org.eclipse.mylyn.internal.gerrit.core.client;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.text.ParseException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Set;
+import javax.swing.text.html.HTML.Tag;
+
+import org.apache.commons.httpclient.HttpStatus;
+import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.lang.StringEscapeUtils;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.AbstractWebLocation;
+import org.eclipse.mylyn.commons.net.HtmlStreamTokenizer;
+import org.eclipse.mylyn.commons.net.HtmlStreamTokenizer.Token;
+import org.eclipse.mylyn.commons.net.HtmlTag;
+import org.eclipse.mylyn.commons.net.WebUtil;
+import org.eclipse.mylyn.internal.gerrit.core.GerritCorePlugin;
+import org.eclipse.mylyn.internal.gerrit.core.GerritUtil;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritService.GerritRequest;
import org.eclipse.mylyn.reviews.core.model.IComment;
-import org.eclipse.mylyn.reviews.core.model.IFileItem;
import org.eclipse.mylyn.reviews.core.model.IFileRevision;
import org.eclipse.mylyn.reviews.core.model.ILineLocation;
import org.eclipse.mylyn.reviews.core.model.ILineRange;
-import org.eclipse.mylyn.reviews.core.model.IReview;
-import org.eclipse.mylyn.reviews.core.model.IReviewItem;
-import org.eclipse.mylyn.reviews.core.model.IReviewItemSet;
import org.eclipse.mylyn.reviews.core.model.ITopic;
import org.eclipse.mylyn.reviews.core.model.IUser;
import org.eclipse.mylyn.reviews.internal.core.model.ReviewsFactory;
import org.eclipse.osgi.util.NLS;
import com.google.gerrit.common.data.AccountDashboardInfo;
-import com.google.gerrit.common.data.AccountInfo;
import com.google.gerrit.common.data.AccountInfoCache;
import com.google.gerrit.common.data.AccountService;
import com.google.gerrit.common.data.ChangeDetail;
import com.google.gerrit.common.data.ChangeDetailService;
import com.google.gerrit.common.data.ChangeInfo;
import com.google.gerrit.common.data.ChangeListService;
-import com.google.gerrit.common.data.CommentDetail;
+import com.google.gerrit.common.data.ChangeManageService;
+import com.google.gerrit.common.data.GerritConfig;
import com.google.gerrit.common.data.PatchDetailService;
import com.google.gerrit.common.data.PatchScript;
import com.google.gerrit.common.data.PatchSetDetail;
+import com.google.gerrit.common.data.PatchSetPublishDetail;
+import com.google.gerrit.common.data.ReviewerResult;
import com.google.gerrit.common.data.SingleListChangeInfo;
import com.google.gerrit.common.data.SystemInfoService;
-import com.google.gerrit.prettify.common.SparseFileContent;
import com.google.gerrit.reviewdb.Account;
-import com.google.gerrit.reviewdb.Account.Id;
import com.google.gerrit.reviewdb.AccountDiffPreference;
import com.google.gerrit.reviewdb.AccountDiffPreference.Whitespace;
+import com.google.gerrit.reviewdb.ApprovalCategoryValue;
import com.google.gerrit.reviewdb.Change;
import com.google.gerrit.reviewdb.ContributorAgreement;
import com.google.gerrit.reviewdb.Patch;
@@ -58,6 +76,7 @@
import com.google.gerrit.reviewdb.PatchSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwtjsonrpc.client.RemoteJsonService;
+import com.google.gwtjsonrpc.client.VoidResult;
/**
* Facade to the Gerrit RPC API.
@@ -70,7 +89,7 @@ public class GerritClient {
private static final ReviewsFactory FACTORY = ReviewsFactory.eINSTANCE;
- private abstract class GerritOperation<T> implements AsyncCallback<T> {
+ private abstract class Operation<T> implements AsyncCallback<T> {
private Throwable exception;
@@ -99,17 +118,121 @@ protected void setResult(T result) {
}
}
+ // XXX belongs in GerritConnector
+ public static GerritConfig configFromString(String token) {
+ try {
+ JSonSupport support = new JSonSupport();
+ return support.getGson().fromJson(token, GerritConfig.class);
+ } catch (Exception e) {
+ StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID,
+ "Failed to deserialize configration: '" + token + "'", e));
+ return null;
+ }
+ }
+
+ // XXX belongs in GerritConnector
+ public static String configToString(GerritConfig config) {
+ try {
+ JSonSupport support = new JSonSupport();
+ return support.getGson().toJson(config);
+ } catch (Exception e) {
+ StatusHandler.log(new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Failed to serialize configration",
+ e));
+ return null;
+ }
+ }
+
+ private static String getText(HtmlStreamTokenizer tokenizer) throws IOException, ParseException {
+ StringBuilder sb = new StringBuilder();
+ for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) {
+ if (token.getType() == Token.TEXT) {
+ sb.append(token.toString());
+ } else if (token.getType() == Token.COMMENT) {
+ // ignore
+ } else {
+ break;
+ }
+ }
+ return StringEscapeUtils.unescapeHtml(sb.toString());
+ }
+
private final GerritHttpClient client;
+ private volatile GerritConfig config;
+
private Account myAcount;
+ private AccountDiffPreference myDiffPreference;
+
+// private GerritConfig createDefaultConfig() {
+// GerritConfig config = new GerritConfig();
+// List<ApprovalType> approvals = new ArrayList<ApprovalType>();
+//
+// ApprovalCategory category = new ApprovalCategory(new ApprovalCategory.Id("VRIF"), "Verified");
+// category.setAbbreviatedName("V");
+// category.setPosition((short) 0);
+// List<ApprovalCategoryValue> values = new ArrayList<ApprovalCategoryValue>();
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) -1), "Fails"));
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) 0), "No score"));
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) 1), "Verified"));
+// approvals.add(new ApprovalType(category, values));
+//
+// category = new ApprovalCategory(new ApprovalCategory.Id("CRVW"), "Code Review");
+// category.setAbbreviatedName("R");
+// category.setPosition((short) 1);
+// values = new ArrayList<ApprovalCategoryValue>();
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) -2),
+// "Do not submit"));
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) -1),
+// "I would prefer that you didn\u0027t submit this"));
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) 0), "No score"));
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) 1),
+// "Looks good to me, but someone else must approve"));
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) 2),
+// "Looks good to me, approved"));
+// approvals.add(new ApprovalType(category, values));
+//
+// category = new ApprovalCategory(new ApprovalCategory.Id("IPCL"), "IP Clean");
+// category.setAbbreviatedName("I");
+// category.setPosition((short) 2);
+// values = new ArrayList<ApprovalCategoryValue>();
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) -1),
+// "Unclean IP, do not check in"));
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) 0), "No score"));
+// values.add(new ApprovalCategoryValue(new ApprovalCategoryValue.Id(category.getId(), (short) 1),
+// "IP review completed"));
+// approvals.add(new ApprovalType(category, values));
+//
+// List<ApprovalType> actions = new ArrayList<ApprovalType>();
+//
+// ApprovalTypes approvalTypes = new ApprovalTypes(approvals, actions);
+// config.setApprovalTypes(approvalTypes);
+// return config;
+// }
+
private final Map<Class<? extends RemoteJsonService>, RemoteJsonService> serviceByClass;
- private AccountDiffPreference myDiffPreference;
+ private volatile boolean configRefreshed;
public GerritClient(AbstractWebLocation location) {
+ this(location, null);
+ }
+
+ public GerritClient(AbstractWebLocation location, GerritConfig config) {
this.client = new GerritHttpClient(location);
this.serviceByClass = new HashMap<Class<? extends RemoteJsonService>, RemoteJsonService>();
+ this.config = config;
+ }
+
+ public ChangeDetail abondon(String reviewId, int patchSetId, final String message, IProgressMonitor monitor)
+ throws GerritException {
+ final PatchSet.Id id = new PatchSet.Id(new Change.Id(id(reviewId)), patchSetId);
+ return execute(monitor, new Operation<ChangeDetail>() {
+ @Override
+ public void execute(IProgressMonitor monitor) throws GerritException {
+ getChangeManageService().abandonChange(id, message, this);
+ }
+ });
}
/**
@@ -117,7 +240,7 @@ public GerritClient(AbstractWebLocation location) {
*/
public ChangeDetail getChangeDetail(int reviewId, IProgressMonitor monitor) throws GerritException {
final Change.Id id = new Change.Id(reviewId);
- return execute(monitor, new GerritOperation<ChangeDetail>() {
+ return execute(monitor, new Operation<ChangeDetail>() {
@Override
public void execute(IProgressMonitor monitor) throws GerritException {
getChangeDetailService().changeDetail(id, this);
@@ -125,6 +248,47 @@ public void execute(IProgressMonitor monitor) throws GerritException {
});
}
+ public GerritPatchSetContent getPatchSetContent(String reviewId, int patchSetId, IProgressMonitor monitor)
+ throws GerritException {
+ Map<Patch.Key, PatchScript> patchScriptByPatchKey = new HashMap<Patch.Key, PatchScript>();
+
+ Change.Id changeId = new Change.Id(id(reviewId));
+ PatchSetDetail detail = getPatchSetDetail(changeId, patchSetId, monitor);
+ for (Patch patch : detail.getPatches()) {
+ PatchScript patchScript = getPatchScript(patch.getKey(), null, detail.getPatchSet().getId(), monitor);
+ if (patchScript != null) {
+ patchScriptByPatchKey.put(patch.getKey(), patchScript);
+ }
+ }
+
+ GerritPatchSetContent result = new GerritPatchSetContent();
+ result.setPatchScriptByPatchKey(patchScriptByPatchKey);
+ return result;
+ }
+
+ public GerritConfig getConfig() {
+ return config;
+ }
+
+ public AccountDiffPreference getDiffPreference(IProgressMonitor monitor) throws GerritException {
+ synchronized (this) {
+ if (myDiffPreference != null) {
+ return myDiffPreference;
+ }
+ }
+ AccountDiffPreference diffPreference = execute(monitor, new Operation<AccountDiffPreference>() {
+ @Override
+ public void execute(IProgressMonitor monitor) throws GerritException {
+ getAccountService().myDiffPreferences(this);
+ }
+ });
+
+ synchronized (this) {
+ myDiffPreference = diffPreference;
+ }
+ return myDiffPreference;
+ }
+
public GerritSystemInfo getInfo(IProgressMonitor monitor) throws GerritException {
List<ContributorAgreement> contributorAgreements = null;
Account account = null;
@@ -135,7 +299,7 @@ public GerritSystemInfo getInfo(IProgressMonitor monitor) throws GerritException
// getSystemInfoService().contributorAgreements(this);
// }
// });
- account = execute(monitor, new GerritOperation<Account>() {
+ account = execute(monitor, new Operation<Account>() {
@Override
public void execute(IProgressMonitor monitor) throws GerritException {
getAccountService().myAccount(this);
@@ -145,13 +309,10 @@ public void execute(IProgressMonitor monitor) throws GerritException {
// XXX should run some more meaningful validation as anonymous, for now any call is good to validate the URL etc.
executeQuery(monitor, "status:open"); //$NON-NLS-1$
}
+ refreshConfigOnce(monitor);
return new GerritSystemInfo(contributorAgreements, account);
}
- private boolean isAnonymous() {
- return client.isAnonymous();
- }
-
public PatchScript getPatchScript(final Patch.Key key, final PatchSet.Id leftId, final PatchSet.Id rightId,
IProgressMonitor monitor) throws GerritException {
//final AccountDiffPreference diffPrefs = getDiffPreference(monitor);
@@ -162,7 +323,7 @@ public PatchScript getPatchScript(final Patch.Key key, final PatchSet.Id leftId,
diffPrefs.setContext(AccountDiffPreference.WHOLE_FILE_CONTEXT);
diffPrefs.setIgnoreWhitespace(Whitespace.IGNORE_NONE);
diffPrefs.setIntralineDifference(false);
- return execute(monitor, new GerritOperation<PatchScript>() {
+ return execute(monitor, new Operation<PatchScript>() {
@Override
public void execute(IProgressMonitor monitor) throws GerritException {
getPatchDetailService().patchScript(key, leftId, rightId, diffPrefs, this);
@@ -173,7 +334,11 @@ public void execute(IProgressMonitor monitor) throws GerritException {
public PatchSetDetail getPatchSetDetail(Change.Id changeId, int patchSetId, IProgressMonitor monitor)
throws GerritException {
final PatchSet.Id id = new PatchSet.Id(changeId, patchSetId);
- return execute(monitor, new GerritOperation<PatchSetDetail>() {
+ return getPatchSetDetail(id, monitor);
+ }
+
+ public PatchSetDetail getPatchSetDetail(final PatchSet.Id id, IProgressMonitor monitor) throws GerritException {
+ return execute(monitor, new Operation<PatchSetDetail>() {
@Override
public void execute(IProgressMonitor monitor) throws GerritException {
getChangeDetailService().patchSetDetail(id, this);
@@ -181,6 +346,35 @@ public void execute(IProgressMonitor monitor) throws GerritException {
});
}
+ public PatchSetPublishDetail getPatchSetPublishDetail(final PatchSet.Id id, IProgressMonitor monitor)
+ throws GerritException {
+ return execute(monitor, new Operation<PatchSetPublishDetail>() {
+ @Override
+ public void execute(IProgressMonitor monitor) throws GerritException {
+ getChangeDetailService().patchSetPublishDetail(id, this);
+ }
+ });
+ }
+
+ public GerritChange getChange(String reviewId, IProgressMonitor monitor) throws GerritException {
+ GerritChange change = new GerritChange();
+ ChangeDetail changeDetail = getChangeDetail(id(reviewId), monitor);
+ List<PatchSetDetail> patchSets = new ArrayList<PatchSetDetail>(changeDetail.getPatchSets().size());
+ Map<PatchSet.Id, PatchSetPublishDetail> patchSetPublishDetailByPatchSetId = new HashMap<PatchSet.Id, PatchSetPublishDetail>();
+ for (PatchSet patchSet : changeDetail.getPatchSets()) {
+ PatchSetDetail patchSetDetail = getPatchSetDetail(patchSet.getId(), monitor);
+ patchSets.add(patchSetDetail);
+ if (!isAnonymous()) {
+ PatchSetPublishDetail patchSetPublishDetail = getPatchSetPublishDetail(patchSet.getId(), monitor);
+ patchSetPublishDetailByPatchSetId.put(patchSet.getId(), patchSetPublishDetail);
+ }
+ }
+ change.setChangeDetail(changeDetail);
+ change.setPatchSets(patchSets);
+ change.setPatchSetPublishDetailByPatchSetId(patchSetPublishDetailByPatchSetId);
+ return change;
+ }
+
public int id(String id) throws GerritException {
if (id == null) {
throw new GerritException("Invalid ID (null)");
@@ -192,6 +386,28 @@ public int id(String id) throws GerritException {
}
}
+ public void publishComments(String reviewId, int patchSetId, final String message,
+ final Set<ApprovalCategoryValue.Id> approvals, IProgressMonitor monitor) throws GerritException {
+ final PatchSet.Id id = new PatchSet.Id(new Change.Id(id(reviewId)), patchSetId);
+ execute(monitor, new Operation<VoidResult>() {
+ @Override
+ public void execute(IProgressMonitor monitor) throws GerritException {
+ getPatchDetailService().publishComments(id, message, approvals, this);
+ }
+ });
+ }
+
+ public ReviewerResult addReviewers(String reviewId, final List<String> reviewers, IProgressMonitor monitor)
+ throws GerritException {
+ final Change.Id id = new Change.Id(id(reviewId));
+ return execute(monitor, new Operation<ReviewerResult>() {
+ @Override
+ public void execute(IProgressMonitor monitor) throws GerritException {
+ getPatchDetailService().addReviewers(id, reviewers, this);
+ }
+ });
+ }
+
/**
* Returns the latest 25 reviews.
*/
@@ -206,23 +422,13 @@ public List<ChangeInfo> queryByProject(IProgressMonitor monitor, final String pr
return executeQuery(monitor, "status:open project:" + project); //$NON-NLS-1$
}
- private List<ChangeInfo> executeQuery(IProgressMonitor monitor, final String queryString) throws GerritException {
- SingleListChangeInfo sl = execute(monitor, new GerritOperation<SingleListChangeInfo>() {
- @Override
- public void execute(IProgressMonitor monitor) throws GerritException {
- getChangeListService().allQueryNext(queryString, "z", 25, this); //$NON-NLS-1$
- }
- });
- return sl.getChanges();
- }
-
/**
* Called to get all gerrit tasks associated with the id of the user. This includes all open, closed and reviewable
* reviews for the user.
*/
public List<ChangeInfo> queryMyReviews(IProgressMonitor monitor) throws GerritException {
final Account account = getAccount(monitor);
- AccountDashboardInfo ad = execute(monitor, new GerritOperation<AccountDashboardInfo>() {
+ AccountDashboardInfo ad = execute(monitor, new Operation<AccountDashboardInfo>() {
@Override
public void execute(IProgressMonitor monitor) throws GerritException {
getChangeListService().forAccount(account.getId(), this);
@@ -235,23 +441,131 @@ public void execute(IProgressMonitor monitor) throws GerritException {
return allMyChanges;
}
- public AccountDiffPreference getDiffPreference(IProgressMonitor monitor) throws GerritException {
- synchronized (this) {
- if (myDiffPreference != null) {
- return myDiffPreference;
+ /**
+ * Retrieves the root URL for the Gerrit instance and attempts to parse the configuration from the JavaScript
+ * portion of the page.
+ */
+ public GerritConfig refreshConfig(IProgressMonitor monitor) throws GerritException {
+ configRefreshed = true;
+ GerritConfig config = null;
+ try {
+ GetMethod method = client.getRequest("/", monitor); //$NON-NLS-1$
+ try {
+ if (method.getStatusCode() == HttpStatus.SC_OK) {
+ InputStream in = WebUtil.getResponseBodyAsStream(method, monitor);
+ try {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in,
+ method.getResponseCharSet()));
+ HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(reader, null);
+ try {
+ for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) {
+ if (token.getType() == Token.TAG) {
+ HtmlTag tag = (HtmlTag) token.getValue();
+ if (tag.getTagType() == Tag.SCRIPT) {
+ String text = getText(tokenizer);
+ text = text.replaceAll("\n", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ text = text.replaceAll("\\s+", " "); //$NON-NLS-1$ //$NON-NLS-2$
+ config = parseConfig(text);
+ break;
+ }
+ }
+ }
+ } catch (ParseException e) {
+ throw new IOException("Error reading url"); //$NON-NLS-1$
+ }
+ } finally {
+ in.close();
+ }
+ }
+
+ if (config == null) {
+ throw new GerritException("Failed to obtain Gerrit configuration");
+ }
+
+ this.config = config;
+ configurationChanged(config);
+ return config;
+ } finally {
+ method.releaseConnection();
}
+ } catch (IOException cause) {
+ GerritException e = new GerritException();
+ e.initCause(cause);
+ throw e;
}
- AccountDiffPreference diffPreference = execute(monitor, new GerritOperation<AccountDiffPreference>() {
+ }
+
+ public GerritConfig refreshConfigOnce(IProgressMonitor monitor) throws GerritException {
+ if (!configRefreshed && config == null) {
+ try {
+ refreshConfig(monitor);
+ } catch (GerritException e) {
+ // don't fail validation in case config parsing fails
+ }
+ }
+ return getConfig();
+ }
+
+ public ChangeDetail restore(String reviewId, int patchSetId, final String message, IProgressMonitor monitor)
+ throws GerritException {
+ final PatchSet.Id id = new PatchSet.Id(new Change.Id(id(reviewId)), patchSetId);
+ return execute(monitor, new Operation<ChangeDetail>() {
@Override
public void execute(IProgressMonitor monitor) throws GerritException {
- getAccountService().myDiffPreferences(this);
+ getChangeManageService().restoreChange(id, message, this);
}
});
+ }
- synchronized (this) {
- myDiffPreference = diffPreference;
+ public ChangeDetail submit(String reviewId, int patchSetId, final String message, IProgressMonitor monitor)
+ throws GerritException {
+ final PatchSet.Id id = new PatchSet.Id(new Change.Id(id(reviewId)), patchSetId);
+ return execute(monitor, new Operation<ChangeDetail>() {
+ @Override
+ public void execute(IProgressMonitor monitor) throws GerritException {
+ getChangeManageService().submit(id, this);
+ }
+ });
+ }
+
+ private void addComments(IFileRevision revision, List<PatchLineComment> comments, AccountInfoCache accountInfoCache) {
+ if (comments == null) {
+ return;
}
- return myDiffPreference;
+ for (PatchLineComment comment : comments) {
+ ILineRange line = FACTORY.createLineRange();
+ line.setStart(comment.getLine());
+ line.setEnd(comment.getLine());
+ ILineLocation location = FACTORY.createLineLocation();
+ location.getRanges().add(line);
+
+ IUser author = GerritUtil.createUser(comment.getAuthor(), accountInfoCache);
+
+ IComment topicComment = FACTORY.createComment();
+ topicComment.setAuthor(author);
+ topicComment.setCreationDate(comment.getWrittenOn());
+ topicComment.setDescription(comment.getMessage());
+
+ ITopic topic = FACTORY.createTopic();
+ topic.setAuthor(author);
+ topic.setCreationDate(comment.getWrittenOn());
+ topic.setLocation(location);
+ topic.setItem(revision);
+ topic.setDescription(comment.getMessage());
+ topic.getComments().add(topicComment);
+
+ revision.getTopics().add(topic);
+ }
+ }
+
+ private List<ChangeInfo> executeQuery(IProgressMonitor monitor, final String queryString) throws GerritException {
+ SingleListChangeInfo sl = execute(monitor, new Operation<SingleListChangeInfo>() {
+ @Override
+ public void execute(IProgressMonitor monitor) throws GerritException {
+ getChangeListService().allQueryNext(queryString, "z", 25, this); //$NON-NLS-1$
+ }
+ });
+ return sl.getChanges();
}
private Account getAccount(IProgressMonitor monitor) throws GerritException {
@@ -267,7 +581,7 @@ private Account getAccount(IProgressMonitor monitor) throws GerritException {
return myAcount;
}
}
- Account account = execute(monitor, new GerritOperation<Account>() {
+ Account account = execute(monitor, new Operation<Account>() {
@Override
public void execute(IProgressMonitor monitor) throws GerritException {
getAccountService().myAccount(this);
@@ -280,10 +594,6 @@ public void execute(IProgressMonitor monitor) throws GerritException {
return myAcount;
}
- private SystemInfoService getSystemInfoService() {
- return getService(SystemInfoService.class);
- }
-
private AccountService getAccountService() {
return getService(AccountService.class);
}
@@ -296,16 +606,48 @@ private ChangeListService getChangeListService() {
return getService(ChangeListService.class);
}
+ private ChangeManageService getChangeManageService() {
+ return getService(ChangeManageService.class);
+ }
+
private PatchDetailService getPatchDetailService() {
return getService(PatchDetailService.class);
}
- protected <T> T execute(IProgressMonitor monitor, GerritOperation<T> operation) throws GerritException {
+ private SystemInfoService getSystemInfoService() {
+ return getService(SystemInfoService.class);
+ }
+
+ public boolean isAnonymous() {
+ return client.isAnonymous();
+ }
+
+ /**
+ * Parses the configuration from <code>text</code>.
+ */
+ private GerritConfig parseConfig(String text) {
+ String prefix = "var gerrit_hostpagedata={\"config\":"; //$NON-NLS-1$
+ String[] tokens = text.split("};"); //$NON-NLS-1$
+ for (String token : tokens) {
+ if (token.startsWith(prefix)) {
+ token = token.substring(prefix.length());
+ return configFromString(token);
+ }
+ }
+ return null;
+ }
+
+ protected void configurationChanged(GerritConfig config) {
+ }
+
+ protected <T> T execute(IProgressMonitor monitor, Operation<T> operation) throws GerritException {
try {
GerritRequest.setCurrentRequest(new GerritRequest(monitor));
operation.execute(monitor);
if (operation.getException() instanceof GerritException) {
throw (GerritException) operation.getException();
+ } else if (operation.getException() instanceof OperationCanceledException) {
+ throw (OperationCanceledException) operation.getException();
} else if (operation.getException() != null) {
GerritException e = new GerritException();
e.initCause(operation.getException());
@@ -326,92 +668,4 @@ protected synchronized <T extends RemoteJsonService> T getService(Class<T> clazz
return clazz.cast(service);
}
- public IReview getReview(String reviewId, IProgressMonitor monitor) throws GerritException {
- IReview review = FACTORY.createReview();
- review.setId(reviewId);
- ChangeDetail detail = getChangeDetail(id(reviewId), monitor);
- List<PatchSet> patchSets = detail.getPatchSets();
- for (PatchSet patchSet : patchSets) {
- IReviewItemSet itemSet = FACTORY.createReviewItemSet();
- itemSet.setName(NLS.bind("Patch Set {0}", patchSet.getPatchSetId()));
- itemSet.setId(patchSet.getPatchSetId() + "");
- itemSet.setAddedBy(createUser(patchSet.getUploader(), detail.getAccounts()));
- itemSet.setRevision(patchSet.getRevision().get());
- itemSet.setReview(review);
- // TODO store patchSet.getRefName()
- review.getItems().add(itemSet);
- }
- return review;
- }
-
- public List<IReviewItem> getChangeSetDetails(IReviewItemSet itemSet, IProgressMonitor monitor)
- throws GerritException {
- List<IReviewItem> result = new ArrayList<IReviewItem>();
- Change.Id changeId = new Change.Id(id(itemSet.getReview().getId()));
- PatchSetDetail detail = getPatchSetDetail(changeId, id(itemSet.getId()), monitor);
- for (Patch patch : detail.getPatches()) {
- IFileItem item = FACTORY.createFileItem();
- PatchScript patchScript = getPatchScript(patch.getKey(), null, detail.getPatchSet().getId(), monitor);
- if (patchScript != null) {
- CommentDetail commentDetail = patchScript.getCommentDetail();
-
- IFileRevision revisionA = FACTORY.createFileRevision();
- revisionA.setContent(patchScript.getA().asString());
- revisionA.setPath(patchScript.getA().getPath());
- revisionA.setRevision("Base");
- addComments(revisionA, commentDetail.getCommentsA(), commentDetail.getAccounts());
- item.setBase(revisionA);
-
- IFileRevision revisionB = FACTORY.createFileRevision();
- SparseFileContent target = patchScript.getB().apply(patchScript.getA(), patchScript.getEdits());
- revisionB.setContent(target.asString());
- revisionB.setPath(patchScript.getB().getPath());
- revisionB.setRevision(itemSet.getName());
- addComments(revisionB, commentDetail.getCommentsB(), commentDetail.getAccounts());
- item.setTarget(revisionB);
- }
- item.setName(patch.getFileName());
- result.add(item);
- }
- return result;
- }
-
- private void addComments(IFileRevision revision, List<PatchLineComment> comments, AccountInfoCache accountInfoCache) {
- if (comments == null) {
- return;
- }
- for (PatchLineComment comment : comments) {
- ILineRange line = FACTORY.createLineRange();
- line.setStart(comment.getLine());
- line.setEnd(comment.getLine());
- ILineLocation location = FACTORY.createLineLocation();
- location.getRanges().add(line);
-
- IUser author = createUser(comment.getAuthor(), accountInfoCache);
-
- IComment topicComment = FACTORY.createComment();
- topicComment.setAuthor(author);
- topicComment.setCreationDate(comment.getWrittenOn());
- topicComment.setDescription(comment.getMessage());
-
- ITopic topic = FACTORY.createTopic();
- topic.setAuthor(author);
- topic.setCreationDate(comment.getWrittenOn());
- topic.setLocation(location);
- topic.setItem(revision);
- topic.setDescription(comment.getMessage());
- topic.getComments().add(topicComment);
-
- revision.getTopics().add(topic);
- }
- }
-
- private IUser createUser(Id id, AccountInfoCache accountInfoCache) {
- AccountInfo info = accountInfoCache.get(id);
- IUser user = FACTORY.createUser();
- user.setDisplayName(info.getFullName());
- user.setId(Integer.toString(id.get()));
- return user;
- }
-
-}
+}
\ No newline at end of file
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritHttpClient.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritHttpClient.java
index 7847bcfd..b503e11b 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritHttpClient.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritHttpClient.java
@@ -128,7 +128,7 @@ public String postJsonRequest(String serviceUri, JsonEntity entity, IProgressMon
private PostMethod postJsonRequestInternal(String serviceUri, JsonEntity entity, IProgressMonitor monitor)
throws IOException {
- PostMethod method = new PostMethod(location.getUrl() + serviceUri);
+ PostMethod method = new PostMethod(getUrl() + serviceUri);
method.setRequestHeader("Content-Type", "application/json; charset=utf-8"); //$NON-NLS-1$//$NON-NLS-2$
method.setRequestHeader("Accept", "application/json"); //$NON-NLS-1$//$NON-NLS-2$
@@ -149,6 +149,29 @@ private PostMethod postJsonRequestInternal(String serviceUri, JsonEntity entity,
}
+ GetMethod getRequest(String serviceUri, IProgressMonitor monitor) throws IOException {
+ GetMethod method = new GetMethod(getUrl() + serviceUri);
+ try {
+ // Execute the method.
+ WebUtil.execute(httpClient, hostConfiguration, method, monitor);
+ return method;
+ } catch (IOException e) {
+ WebUtil.releaseConnection(method, monitor);
+ throw e;
+ } catch (RuntimeException e) {
+ WebUtil.releaseConnection(method, monitor);
+ throw e;
+ }
+ }
+
+ private String getUrl() {
+ String url = location.getUrl();
+ if (url.endsWith("/")) { //$NON-NLS-1$
+ url = url.substring(0, url.length() - 1);
+ }
+ return url;
+ }
+
private void authenticate(IProgressMonitor monitor) throws GerritException, IOException {
while (true) {
AuthenticationCredentials credentials = location.getCredentials(AuthenticationType.REPOSITORY);
@@ -216,7 +239,7 @@ public String getContent() {
private int authenticateTestMode(AuthenticationCredentials credentials, IProgressMonitor monitor)
throws IOException, GerritException {
- String repositoryUrl = location.getUrl();
+ String repositoryUrl = getUrl();
GetMethod method = new GetMethod(WebUtil.getRequestPath(repositoryUrl + BECOME_URL + "?user_name=" //$NON-NLS-1$
+ credentials.getUserName()));
method.setFollowRedirects(false);
@@ -238,7 +261,7 @@ private int authenticateTestMode(AuthenticationCredentials credentials, IProgres
private int authenticateForm(AuthenticationCredentials credentials, IProgressMonitor monitor) throws IOException,
GerritException {
// try standard basic/digest/ntlm authentication first
- String repositoryUrl = location.getUrl();
+ String repositoryUrl = getUrl();
AuthScope authScope = new AuthScope(WebUtil.getHost(repositoryUrl), WebUtil.getPort(repositoryUrl), null,
AuthScope.ANY_SCHEME);
Credentials httpCredentials = WebUtil.getHttpClientCredentials(credentials, WebUtil.getHost(repositoryUrl));
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritPatchSetContent.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritPatchSetContent.java
new file mode 100644
index 00000000..1d350b23
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/GerritPatchSetContent.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.client;
+
+import java.util.Map;
+
+import com.google.gerrit.common.data.PatchScript;
+import com.google.gerrit.reviewdb.Patch;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritPatchSetContent {
+
+ Map<Patch.Key, PatchScript> patchScriptByPatchKey;
+
+ public Map<Patch.Key, PatchScript> getPatchScriptByPatchKey() {
+ return patchScriptByPatchKey;
+ }
+
+ void setPatchScriptByPatchKey(Map<Patch.Key, PatchScript> patchScriptByPatchKey) {
+ this.patchScriptByPatchKey = patchScriptByPatchKey;
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java
index 41375c3e..422df45f 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/client/JSonSupport.java
@@ -19,6 +19,8 @@
import org.eclipse.jgit.diff.Edit;
+import com.google.gson.ExclusionStrategy;
+import com.google.gson.FieldAttributes;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonDeserializationContext;
@@ -85,6 +87,20 @@ static class JSonResponse {
private Gson gson;
public JSonSupport() {
+ ExclusionStrategy exclustionStrategy = new ExclusionStrategy() {
+
+ public boolean shouldSkipField(FieldAttributes f) {
+ // commentLinks requires instantiation of com.google.gwtexpui.safehtml.client.RegexFindReplace which is not on classpath
+ if (f.getDeclaredClass() == List.class && f.getName().equals("commentLinks")) { //$NON-NLS-1$
+ return true;
+ }
+ return false;
+ }
+
+ public boolean shouldSkipClass(Class<?> clazz) {
+ return false;
+ }
+ };
gson = JsonServlet.defaultGsonBuilder()
.registerTypeAdapter(JSonResponse.class, new JSonResponseDeserializer())
.registerTypeAdapter(Edit.class, new JsonDeserializer<Edit>() {
@@ -100,9 +116,14 @@ public Edit deserialize(JsonElement json, Type typeOfT, JsonDeserializationConte
return new Edit(0, 0);
}
})
+ .setExclusionStrategies(exclustionStrategy)
.create();
}
+ public Gson getGson() {
+ return gson;
+ }
+
String createRequest(int id, String xsrfKey, String methodName, Collection<Object> args) {
JsonRequest msg = new JsonRequest();
msg.method = methodName;
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AbandonRequest.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AbandonRequest.java
new file mode 100644
index 00000000..d8849117
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AbandonRequest.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.operations;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+
+import com.google.gerrit.common.data.ChangeDetail;
+
+/**
+ * @author Steffen Pingel
+ */
+public class AbandonRequest extends AbstractRequest<ChangeDetail> {
+
+ int patchSetId;
+
+ String reviewId;
+
+ public AbandonRequest(String reviewId, int patchSetId) {
+ Assert.isNotNull(reviewId);
+ this.reviewId = reviewId;
+ this.patchSetId = patchSetId;
+ }
+
+ public int getPatchSetId() {
+ return patchSetId;
+ }
+
+ public String getReviewId() {
+ return reviewId;
+ }
+
+ @Override
+ protected ChangeDetail execute(GerritClient client, IProgressMonitor monitor) throws GerritException {
+ return client.abondon(getReviewId(), getPatchSetId(), getMessage(), monitor);
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AbstractRequest.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AbstractRequest.java
new file mode 100644
index 00000000..3ea3beec
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AbstractRequest.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.operations;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+
+/**
+ * @author Steffen Pingel
+ */
+public abstract class AbstractRequest<T> {
+
+ String message;
+
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
+
+ abstract T execute(GerritClient client, IProgressMonitor monitor) throws GerritException;
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AddReviewersRequest.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AddReviewersRequest.java
new file mode 100644
index 00000000..f146b565
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/AddReviewersRequest.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.operations;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+
+import com.google.gerrit.common.data.ReviewerResult;
+
+/**
+ * @author Steffen Pingel
+ */
+public class AddReviewersRequest extends AbstractRequest<ReviewerResult> {
+
+ private final List<String> reviewers;
+
+ private final String reviewId;
+
+ public AddReviewersRequest(String reviewId, List<String> reviewers) {
+ Assert.isNotNull(reviewId);
+ Assert.isNotNull(reviewers);
+ this.reviewId = reviewId;
+ this.reviewers = Collections.unmodifiableList(new ArrayList<String>(reviewers));
+ }
+
+ public List<String> getReviewers() {
+ return reviewers;
+ }
+
+ public String getReviewId() {
+ return reviewId;
+ }
+
+ @Override
+ protected ReviewerResult execute(GerritClient client, IProgressMonitor monitor) throws GerritException {
+ return client.addReviewers(getReviewId(), getReviewers(), monitor);
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/GerritOperation.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/GerritOperation.java
new file mode 100644
index 00000000..6be4dba0
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/GerritOperation.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.operations;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.mylyn.internal.gerrit.core.GerritCorePlugin;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritOperation<T> extends Job {
+
+ private final GerritClient client;
+
+ private final AbstractRequest<T> request;
+
+ private T operationResult;
+
+ public GerritOperation(String name, GerritClient client, AbstractRequest<T> request) {
+ super(name);
+ this.client = client;
+ this.request = request;
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) {
+ SubMonitor.convert(monitor);
+ try {
+ execute(monitor);
+ } catch (OperationCanceledException e) {
+ return Status.CANCEL_STATUS;
+ } catch (GerritException e) {
+ return new Status(IStatus.ERROR, GerritCorePlugin.PLUGIN_ID, "Operation Failed: " + e.getMessage(), e);
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected void execute(IProgressMonitor monitor) throws GerritException {
+ this.operationResult = request.execute(client, monitor);
+ }
+
+ public T getOperationResult() {
+ return operationResult;
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/PublishRequest.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/PublishRequest.java
new file mode 100644
index 00000000..4a8f817d
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/PublishRequest.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.operations;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+
+import com.google.gerrit.reviewdb.ApprovalCategoryValue;
+
+/**
+ * @author Steffen Pingel
+ */
+public class PublishRequest extends AbstractRequest<Object> {
+
+ int patchSetId;
+
+ String reviewId;
+
+ Set<ApprovalCategoryValue.Id> approvals;
+
+ public PublishRequest(String reviewId, int patchSetId, Set<ApprovalCategoryValue.Id> approvals) {
+ Assert.isNotNull(reviewId);
+ this.reviewId = reviewId;
+ this.patchSetId = patchSetId;
+ this.approvals = Collections.unmodifiableSet(new HashSet<ApprovalCategoryValue.Id>(approvals));
+ }
+
+ public int getPatchSetId() {
+ return patchSetId;
+ }
+
+ public String getReviewId() {
+ return reviewId;
+ }
+
+ public Set<ApprovalCategoryValue.Id> getApprovals() {
+ return approvals;
+ }
+
+ @Override
+ protected Object execute(GerritClient client, IProgressMonitor monitor) throws GerritException {
+ client.publishComments(getReviewId(), getPatchSetId(), getMessage(), getApprovals(), monitor);
+ return null;
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/RefreshConfigRequest.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/RefreshConfigRequest.java
new file mode 100644
index 00000000..953d7553
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/RefreshConfigRequest.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.operations;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+
+import com.google.gerrit.common.data.GerritConfig;
+
+/**
+ * @author Steffen Pingel
+ */
+public class RefreshConfigRequest extends AbstractRequest<GerritConfig> {
+
+ public RefreshConfigRequest() {
+ }
+
+ @Override
+ protected GerritConfig execute(GerritClient client, IProgressMonitor monitor) throws GerritException {
+ return client.refreshConfig(monitor);
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/RestoreRequest.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/RestoreRequest.java
new file mode 100644
index 00000000..2903715b
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/RestoreRequest.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.operations;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+
+import com.google.gerrit.common.data.ChangeDetail;
+
+/**
+ * @author Steffen Pingel
+ */
+public class RestoreRequest extends AbstractRequest<ChangeDetail> {
+
+ int patchSetId;
+
+ String reviewId;
+
+ public RestoreRequest(String reviewId, int patchSetId) {
+ Assert.isNotNull(reviewId);
+ this.reviewId = reviewId;
+ this.patchSetId = patchSetId;
+ }
+
+ @Override
+ public String getMessage() {
+ return message;
+ }
+
+ public int getPatchSetId() {
+ return patchSetId;
+ }
+
+ public String getReviewId() {
+ return reviewId;
+ }
+
+ @Override
+ protected ChangeDetail execute(GerritClient client, IProgressMonitor monitor) throws GerritException {
+ return client.restore(getReviewId(), getPatchSetId(), getMessage(), monitor);
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/SubmitRequest.java b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/SubmitRequest.java
new file mode 100644
index 00000000..b2a2619e
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.core/src/org/eclipse/mylyn/internal/gerrit/core/operations/SubmitRequest.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.core.operations;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+
+import com.google.gerrit.common.data.ChangeDetail;
+
+/**
+ * @author Steffen Pingel
+ */
+public class SubmitRequest extends AbstractRequest<ChangeDetail> {
+
+ int patchSetId;
+
+ String reviewId;
+
+ public SubmitRequest(String reviewId, int patchSetId) {
+ Assert.isNotNull(reviewId);
+ this.reviewId = reviewId;
+ this.patchSetId = patchSetId;
+ }
+
+ public int getPatchSetId() {
+ return patchSetId;
+ }
+
+ public String getReviewId() {
+ return reviewId;
+ }
+
+ @Override
+ protected ChangeDetail execute(GerritClient client, IProgressMonitor monitor) throws GerritException {
+ return client.submit(getReviewId(), getPatchSetId(), getMessage(), monitor);
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.feature/.settings/org.eclipse.jdt.core.prefs b/gerrit/org.eclipse.mylyn.gerrit.feature/.settings/org.eclipse.jdt.core.prefs
index f1554b10..bc1e8f9c 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.feature/.settings/org.eclipse.jdt.core.prefs
+++ b/gerrit/org.eclipse.mylyn.gerrit.feature/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue May 12 20:42:43 PDT 2009
+#Wed Mar 02 16:00:03 PST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -81,6 +81,7 @@ org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@@ -88,9 +89,10 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
@@ -137,10 +139,16 @@ org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -153,9 +161,14 @@ org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
@@ -338,5 +351,7 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.feature/.settings/org.eclipse.jdt.ui.prefs b/gerrit/org.eclipse.mylyn.gerrit.feature/.settings/org.eclipse.jdt.ui.prefs
index 8d68e732..d92dfc1c 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.feature/.settings/org.eclipse.jdt.ui.prefs
+++ b/gerrit/org.eclipse.mylyn.gerrit.feature/.settings/org.eclipse.jdt.ui.prefs
@@ -1,16 +1,16 @@
-#Thu Sep 11 16:27:18 PDT 2008
+#Wed Mar 02 16:00:08 PST 2011
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Mylyn based on Eclipse
-formatter_settings_version=11
+formatter_settings_version=12
internal.default.compliance=default
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.javadoc=false
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2010 Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.feature/feature.properties b/gerrit/org.eclipse.mylyn.gerrit.feature/feature.properties
index 37f381cd..d250f8dc 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.feature/feature.properties
+++ b/gerrit/org.eclipse.mylyn.gerrit.feature/feature.properties
@@ -8,7 +8,7 @@
# Contributors:
# Tasktop Technologies - initial API and implementation
###############################################################################
-featureName=Mylyn Connector: Gerrit (Incubation)
+featureName=Mylyn Reviews Connector: Gerrit (Incubation)
description=Provides support for the open source Gerrit Code Review system.
providerName=Eclipse Mylyn
copyright=Copyright (c) 2011 Tasktop Technologies and others. All rights reserved.
diff --git a/gerrit/org.eclipse.mylyn.gerrit.feature/feature.xml b/gerrit/org.eclipse.mylyn.gerrit.feature/feature.xml
index 90ff6814..d61e17cd 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.feature/feature.xml
+++ b/gerrit/org.eclipse.mylyn.gerrit.feature/feature.xml
@@ -29,10 +29,10 @@
</license>
<requires>
- <import plugin="org.eclipse.mylyn.commons.net" version="3.4.0" match="compatible"/>
+ <import plugin="org.eclipse.mylyn.commons.net" version="3.5.0" match="compatible"/>
<import plugin="org.eclipse.mylyn.commons.repositories" version="0.1.0" match="compatible"/>
- <import plugin="org.eclipse.mylyn.commons.ui" version="3.4.0" match="compatible"/>
- <import feature="org.eclipse.mylyn_feature" version="3.4.0.I20100101" match="compatible"/>
+ <import plugin="org.eclipse.mylyn.commons.ui" version="3.5.0" match="compatible"/>
+ <import feature="org.eclipse.mylyn_feature" version="3.5.0.I20110304" match="compatible"/>
</requires>
<plugin
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/.settings/org.eclipse.jdt.core.prefs b/gerrit/org.eclipse.mylyn.gerrit.tests/.settings/org.eclipse.jdt.core.prefs
index fbac2391..bc1e8f9c 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue May 12 20:42:44 PDT 2009
+#Wed Mar 02 16:00:03 PST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -81,6 +81,7 @@ org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@@ -88,9 +89,10 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
@@ -137,10 +139,16 @@ org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -153,9 +161,14 @@ org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
@@ -338,5 +351,7 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/.settings/org.eclipse.jdt.ui.prefs b/gerrit/org.eclipse.mylyn.gerrit.tests/.settings/org.eclipse.jdt.ui.prefs
index 8d68e732..f6c0a161 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.tests/.settings/org.eclipse.jdt.ui.prefs
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/.settings/org.eclipse.jdt.ui.prefs
@@ -1,16 +1,16 @@
-#Thu Sep 11 16:27:18 PDT 2008
+#Wed Mar 02 16:00:06 PST 2011
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Mylyn based on Eclipse
-formatter_settings_version=11
+formatter_settings_version=12
internal.default.compliance=default
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.javadoc=false
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2010 Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/META-INF/MANIFEST.MF b/gerrit/org.eclipse.mylyn.gerrit.tests/META-INF/MANIFEST.MF
index f7c56ff4..d786e60e 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.tests/META-INF/MANIFEST.MF
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/META-INF/MANIFEST.MF
@@ -6,5 +6,8 @@ Bundle-Version: 0.7.0.qualifier
Bundle-Vendor: Eclipse Mylyn
Fragment-Host: org.eclipse.mylyn.gerrit.core
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.junit
-Export-Package: org.eclipse.mylyn.gerrit.core;x-internal:=true
+Require-Bundle: org.junit,
+ org.eclipse.mylyn.tests.util;bundle-version="3.5.0"
+Export-Package: org.eclipse.mylyn.gerrit.core;x-internal:=true,
+ org.eclipse.mylyn.gerrit.core.client;x-internal:=true,
+ org.eclipse.mylyn.gerrit.core.support;x-internal:=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/pom.xml b/gerrit/org.eclipse.mylyn.gerrit.tests/pom.xml
index 62a6b017..6724c82b 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.tests/pom.xml
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/pom.xml
@@ -22,6 +22,8 @@
<skip>${mylyn-reviews-skip-test}</skip>
<useUIHarness>true</useUIHarness>
<forkedProcessTimeoutInSeconds>7200</forkedProcessTimeoutInSeconds>
+ <testSuite>org.eclipse.mylyn.gerrit.tests</testSuite>
+ <testClass>org.eclipse.mylyn.gerrit.core.AllGerritTests</testClass>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<dependencies>
<dependency>
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/AllGerritTests.java b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/AllGerritTests.java
index 60abdce5..f08c59a6 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/AllGerritTests.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/AllGerritTests.java
@@ -23,7 +23,6 @@ public static Test suite() {
TestSuite suite = new TestSuite(AllGerritTests.class.getName());
suite.addTestSuite(GerritAttributeTest.class);
suite.addTestSuite(GerritConnectorTest.class);
- suite.addTestSuite(GerritTaskAttributeMapperTest.class);
return suite;
}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/GerritAttributeTest.java b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/GerritAttributeTest.java
index c7e35e06..0bd5565e 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/GerritAttributeTest.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/GerritAttributeTest.java
@@ -12,9 +12,9 @@
import junit.framework.TestCase;
-import org.eclipse.mylyn.internal.gerrit.core.GerritAttribute;
-import org.eclipse.mylyn.internal.gerrit.core.GerritConstants;
+import org.eclipse.mylyn.internal.gerrit.core.GerritTaskSchema;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.AbstractTaskSchema.Field;
/**
* @author Mikael Kober
@@ -22,10 +22,9 @@
public class GerritAttributeTest extends TestCase {
public void testGetters() {
- final GerritAttribute id = GerritAttribute.ID;
+ final Field id = GerritTaskSchema.getDefault().KEY;
assertTrue("should be read only", id.isReadOnly());
- assertEquals("wrong gerrit key", GerritConstants.ATTRIBUTE_ID, id.getGerritKey());
- assertEquals("wrong task key", TaskAttribute.TASK_KEY, id.getTaskKey());
+ assertEquals("wrong task key", TaskAttribute.TASK_KEY, id.getKey());
assertEquals("wrong type", TaskAttribute.TYPE_SHORT_TEXT, id.getType());
}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/GerritTaskAttributeMapperTest.java b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/GerritTaskAttributeMapperTest.java
deleted file mode 100644
index 7b38c11b..00000000
--- a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/GerritTaskAttributeMapperTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*********************************************************************
- * Copyright (c) 2010 Sony Ericsson/ST Ericsson and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Sony Ericsson/ST Ericsson - initial API and implementation
- *********************************************************************/
-package org.eclipse.mylyn.gerrit.core;
-
-import junit.framework.TestCase;
-
-import org.eclipse.mylyn.internal.gerrit.core.GerritAttribute;
-import org.eclipse.mylyn.internal.gerrit.core.GerritTaskAttributeMapper;
-import org.eclipse.mylyn.internal.gerrit.core.GerritTaskDataHandler;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Mikael Kober
- */
-public class GerritTaskAttributeMapperTest extends TestCase {
-
- public void testMapToRepositoryKeyTaskAttributeString() {
- GerritTaskAttributeMapper mapper = new GerritTaskAttributeMapper(
- new TaskRepository("gerrit", "http://some.url"));
- TaskAttribute parent = GerritTaskDataHandler.createAttribute(new TaskData(mapper, "gerrit", "http://some.url",
- "12345"), GerritAttribute.ID);
- assertEquals("wrong mapping", GerritAttribute.SUMMARY.getGerritKey(),
- mapper.mapToRepositoryKey(parent, TaskAttribute.SUMMARY));
- }
-
-}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/client/GerritClientTest.java b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/client/GerritClientTest.java
new file mode 100644
index 00000000..e38a75e1
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/client/GerritClientTest.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.gerrit.core.client;
+
+import junit.framework.TestCase;
+
+import org.eclipse.mylyn.gerrit.core.support.GerritFixture;
+import org.eclipse.mylyn.gerrit.core.support.GerritHarness;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+
+import com.google.gerrit.common.data.GerritConfig;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritClientTest extends TestCase {
+
+ private GerritHarness harness;
+
+ private GerritClient client;
+
+ @Override
+ protected void setUp() throws Exception {
+ harness = GerritFixture.current().harness();
+ client = harness.client();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ harness.dispose();
+ }
+
+ public void testRefreshConfig() throws Exception {
+ GerritConfig config = client.refreshConfig(null);
+ assertNotNull(config);
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/support/GerritFixture.java b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/support/GerritFixture.java
new file mode 100644
index 00000000..744e2b1b
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/support/GerritFixture.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.gerrit.core.support;
+
+import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
+import org.eclipse.mylyn.tests.util.TestFixture;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritFixture extends TestFixture {
+
+ public static GerritFixture GERRIT_2_1_5 = new GerritFixture("http://localhost:8080/", "2.1.5", "");
+
+ public static GerritFixture GERRIT_EGIT = new GerritFixture("http://egit.eclipse.org/r/", "2.1.5", "");
+
+ public static GerritFixture DEFAULT = GERRIT_2_1_5;
+
+ private static GerritFixture current;
+
+ public GerritFixture(String url, String version, String description) {
+ super(GerritConnector.CONNECTOR_KIND, url);
+ setInfo(url, version, description);
+ }
+
+ public static GerritFixture current() {
+ if (current == null) {
+ DEFAULT.activate();
+ }
+ return current;
+ }
+
+ @Override
+ protected GerritFixture activate() {
+ current = this;
+ setUpFramework();
+ return this;
+ }
+
+ @Override
+ protected GerritFixture getDefault() {
+ return DEFAULT;
+ }
+
+ public GerritHarness harness() {
+ return new GerritHarness(this);
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/support/GerritHarness.java b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/support/GerritHarness.java
new file mode 100644
index 00000000..29cd26c4
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.tests/src/org/eclipse/mylyn/gerrit/core/support/GerritHarness.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.gerrit.core.support;
+
+import java.net.Proxy;
+
+import org.eclipse.mylyn.commons.net.IProxyProvider;
+import org.eclipse.mylyn.commons.net.WebLocation;
+import org.eclipse.mylyn.commons.net.WebUtil;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.tests.util.TestUtil;
+import org.eclipse.mylyn.tests.util.TestUtil.Credentials;
+import org.eclipse.mylyn.tests.util.TestUtil.PrivilegeLevel;
+
+/**
+ * @author Steffen Pingel
+ */
+public class GerritHarness {
+
+ private final GerritFixture fixture;
+
+ public GerritHarness(GerritFixture fixture) {
+ this.fixture = fixture;
+ }
+
+ public GerritClient client() {
+ Credentials credentials = TestUtil.readCredentials(PrivilegeLevel.USER);
+ WebLocation location = new WebLocation(fixture.getRepositoryUrl(), credentials.username, credentials.password,
+ new IProxyProvider() {
+ public Proxy getProxyForHost(String host, String proxyType) {
+ return WebUtil.getProxyForUrl(fixture.getRepositoryUrl());
+ }
+ });
+ return new GerritClient(location);
+ }
+
+ public void dispose() {
+
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/.settings/org.eclipse.jdt.core.prefs b/gerrit/org.eclipse.mylyn.gerrit.ui/.settings/org.eclipse.jdt.core.prefs
index fbac2391..bc1e8f9c 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue May 12 20:42:44 PDT 2009
+#Wed Mar 02 16:00:03 PST 2011
eclipse.preferences.version=1
org.eclipse.jdt.core.codeComplete.argumentPrefixes=
org.eclipse.jdt.core.codeComplete.argumentSuffixes=
@@ -81,6 +81,7 @@ org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,NORMAL
org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
@@ -88,9 +89,10 @@ org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_e
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=48
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
@@ -137,10 +139,16 @@ org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
@@ -153,9 +161,14 @@ org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
@@ -338,5 +351,7 @@ org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/.settings/org.eclipse.jdt.ui.prefs b/gerrit/org.eclipse.mylyn.gerrit.ui/.settings/org.eclipse.jdt.ui.prefs
index 8d68e732..d92dfc1c 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/.settings/org.eclipse.jdt.ui.prefs
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/.settings/org.eclipse.jdt.ui.prefs
@@ -1,16 +1,16 @@
-#Thu Sep 11 16:27:18 PDT 2008
+#Wed Mar 02 16:00:08 PST 2011
cleanup_settings_version=2
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=_Mylyn based on Eclipse
-formatter_settings_version=11
+formatter_settings_version=12
internal.default.compliance=default
org.eclipse.jdt.ui.exception.name=e
org.eclipse.jdt.ui.gettersetter.use.is=true
org.eclipse.jdt.ui.javadoc=false
org.eclipse.jdt.ui.keywordthis=false
org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) 2010 Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">/*******************************************************************************\r\n * Copyright (c) ${year} Tasktop Technologies and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n *\r\n * Contributors\:\r\n * Tasktop Technologies - initial API and implementation\r\n *******************************************************************************/\r\n\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ignore\r\n${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ignore</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\r\n * @return the ${bare_field_name}\r\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\r\n * @param ${param} the ${bare_field_name} to set\r\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author ${user}\r\n *\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\r\n * \r\n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment">/* (non-Jsdoc)\r\n * ${see_to_overridden}\r\n */</template><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated function stub\r\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\r\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF b/gerrit/org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF
index 18e4e087..7af35918 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/META-INF/MANIFEST.MF
@@ -25,5 +25,11 @@ Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: Eclipse Mylyn
Export-Package: org.eclipse.mylyn.internal.gerrit.ui;x-internal:=true,
org.eclipse.mylyn.internal.gerrit.ui.editor;x-internal:=true,
+ org.eclipse.mylyn.internal.gerrit.ui.operations;x-internal:=true,
org.eclipse.mylyn.internal.gerrit.ui.wizards;x-internal:=true
-Import-Package: org.apache.commons.io;version="1.4.0"
+Import-Package: com.google.gerrit.common;version="2.1.5",
+ com.google.gerrit.common.data;version="2.1.5",
+ com.google.gerrit.reviewdb;version="2.1.5",
+ com.google.gson;version="1.6.0",
+ com.google.gwtorm.client;version="1.1.4",
+ org.apache.commons.io;version="1.4.0"
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/plugin.xml b/gerrit/org.eclipse.mylyn.gerrit.ui/plugin.xml
index 870f453f..e24f58db 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/plugin.xml
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/plugin.xml
@@ -3,7 +3,6 @@
<plugin>
<extension
point="org.eclipse.mylyn.tasks.ui.repositories">
-
<connectorCore
id="org.eclipse.mylyn.gerrit"
class="org.eclipse.mylyn.internal.gerrit.core.GerritConnector"
@@ -32,71 +31,4 @@
id="org.eclipse.mylyn.gerrit.ui.pageFactory">
</pageFactory>
</extension>
-
- <!--
- <extension id="com.atlassian.connector.eclipse.crucible.ui.popup" name="Crucible Review Actions" point="org.eclipse.ui.popupMenus">
- <objectContribution id="com.atlassian.connector.eclipse.crucible.ui.objectContribution1" objectClass="org.eclipse.ui.IEditorInput">
- <action class="com.atlassian.connector.eclipse.internal.crucible.ui.actions.AddLineCommentToFileAction"
- enablesFor="1" icon="icons/obj16/pin_addcomment.png" id="com.atlassian.connector.eclipse.crucible.ui.action.add.line.comment"
- label="Comment on Selected Lines..." menubarPath="group.undo" tooltip="Add Line Comment to Active Review">
- </action>
- <action class="com.atlassian.connector.eclipse.internal.crucible.ui.actions.AddGeneralCommentToFileAction"
- enablesFor="1" id="com.atlassian.connector.eclipse.crucible.ui.action.add.file.comment"
- label="Add General File Comment..." menubarPath="group.undo" tooltip="Add Comment to Active Review">
- </action>
- <visibility>
- <systemProperty name="com.atlassian.connector.eclipse.crucible.ui.review.active" value="true"/>
- </visibility>
- </objectContribution>
-
- </extension>
- -->
-
- <extension point="org.eclipse.ui.editors.annotationTypes">
- <type name="org.eclipse.mylyn.reviews.ui.comment.Annotation"/>
- </extension>
-
- <extension point="org.eclipse.ui.editors.markerAnnotationSpecification">
- <specification annotationType="org.eclipse.mylyn.reviews.ui.comment.Annotation"
- colorPreferenceKey="comment_color"
- colorPreferenceValue="179,215,255"
- contributesToHeader="true"
- highlightPreferenceKey="comment_highlight"
- highlightPreferenceValue="true"
- icon="icons/gerrit.png"
- includeOnPreferencePage="true"
- isGoToNextNavigationTarget="false"
- isGoToNextNavigationTargetKey="comment_isGoToNextNavigationTargetKey"
- isGoToPreviousNavigationTarget="false"
- isGoToPreviousNavigationTargetKey="commet_isGoToPreviousNavigationTargetKey"
- label="Active Review Comments"
- overviewRulerPreferenceKey="comment_overviewRuler"
- overviewRulerPreferenceValue="true"
- presentationLayer="0"
- showInNextPrevDropdownToolbarAction="false"
- showInNextPrevDropdownToolbarActionKey="comment_showInNextPrevDropdownToolbarAction"
- textPreferenceKey="comment_text"
- textPreferenceValue="true"
- textStylePreferenceKey="comment_stylePreferences"
- textStylePreferenceValue="BOX"
- verticalRulerPreferenceKey="comment_verticalRuler"
- verticalRulerPreferenceValue="true" />
- </extension>
-
- <extension point="org.eclipse.ui.workbench.texteditor.rulerColumns">
- <column id="org.eclipse.mylyn.reviews.ui.editor.AnnotationRuler" name="Review Comments"
- icon="icons/gerrit.png"
- class="org.eclipse.mylyn.internal.reviews.ui.editors.ruler.CommentAnnotationRulerColumn"
- enabled="true"
- global="true"
- includeInMenu="true">
-
- <placement gravity="1.0">
- <!--<after id="org.eclipse.ui.editors.columns.annotations"/> -->
- </placement>
-
- <targetClass class="org.eclipse.ui.texteditor.AbstractDecoratedTextEditor" />
- </column>
- </extension>
-
</plugin>
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritConnectorUi.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritConnectorUi.java
index 1963feb7..0d4b0dbf 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritConnectorUi.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritConnectorUi.java
@@ -14,6 +14,7 @@
import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
import org.eclipse.mylyn.internal.gerrit.ui.wizards.GerritCustomQueryPage;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
+import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
@@ -56,4 +57,9 @@ public boolean hasSearchPage() {
return false;
}
+ @Override
+ public String getTaskKindLabel(ITask task) {
+ return "Change";
+ }
+
}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java
index 529c64e5..0b2ebdc2 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritRepositorySettingsPage.java
@@ -19,6 +19,7 @@
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritSystemInfo;
+import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.wizards.AbstractRepositorySettingsPage;
@@ -49,6 +50,13 @@ public GerritRepositorySettingsPage(TaskRepository taskRepository) {
setNeedsValidation(true);
}
+ @SuppressWarnings("restriction")
+ @Override
+ public void applyTo(TaskRepository repository) {
+ super.applyTo(repository);
+ repository.setProperty(IRepositoryConstants.PROPERTY_CATEGORY, IRepositoryConstants.CATEGORY_REVIEW);
+ }
+
@Override
public void createControl(Composite parent) {
super.createControl(parent);
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritUiPlugin.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritUiPlugin.java
index c1ee96a9..7a5fceea 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritUiPlugin.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/GerritUiPlugin.java
@@ -11,7 +11,9 @@
package org.eclipse.mylyn.internal.gerrit.ui;
import org.eclipse.mylyn.internal.gerrit.core.GerritCorePlugin;
+import org.eclipse.mylyn.internal.gerrit.core.GerritOperationFactory;
import org.eclipse.mylyn.tasks.ui.TaskRepositoryLocationUiFactory;
+import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -26,6 +28,8 @@ public class GerritUiPlugin extends AbstractUIPlugin {
private static GerritUiPlugin plugin;
+ private GerritOperationFactory operationFactory;
+
public GerritUiPlugin() {
}
@@ -54,4 +58,11 @@ public static GerritUiPlugin getDefault() {
return plugin;
}
+ public GerritOperationFactory getOperationFactory() {
+ if (operationFactory == null) {
+ operationFactory = new GerritOperationFactory(TasksUi.getRepositoryManager());
+ }
+ return operationFactory;
+ }
+
}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/AbstractGerritSection.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/AbstractGerritSection.java
new file mode 100644
index 00000000..0ddc3862
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/AbstractGerritSection.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.ui.editor;
+
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.mylyn.internal.gerrit.ui.operations.GerritOperationDialog;
+import org.eclipse.mylyn.internal.tasks.ui.actions.SynchronizeEditorAction;
+import org.eclipse.mylyn.internal.tasks.ui.editors.AbstractTaskEditorSection;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+/**
+ * @author Steffen Pingel
+ */
+public abstract class AbstractGerritSection extends AbstractTaskEditorSection {
+
+ public Label addTextClient(final FormToolkit toolkit, final Section section, String text) {
+ final Label label = new Label(section, SWT.NONE);
+ label.setText(" " + text); //$NON-NLS-1$
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ label.setVisible(!section.isExpanded());
+
+ section.setTextClient(label);
+ section.addExpansionListener(new ExpansionAdapter() {
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ label.setVisible(!section.isExpanded());
+ }
+ });
+
+ return label;
+ }
+
+ protected Shell getShell() {
+ return getTaskEditorPage().getSite().getShell();
+ }
+
+ protected ITask getTask() {
+ return getTaskEditorPage().getTask();
+ }
+
+ protected void openOperationDialog(GerritOperationDialog dialog) {
+ if (dialog.open() == Window.OK) {
+ SynchronizeEditorAction action = new SynchronizeEditorAction();
+ action.selectionChanged(new StructuredSelection(getTaskEditorPage().getEditor()));
+ action.run();
+ }
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/GerritTaskEditorPage.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/GerritTaskEditorPage.java
index 3f4837b2..5388af00 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/GerritTaskEditorPage.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/GerritTaskEditorPage.java
@@ -14,8 +14,15 @@
import java.util.Set;
import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
+import org.eclipse.mylyn.internal.gerrit.core.GerritTaskSchema;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
+import org.eclipse.mylyn.tasks.ui.editors.AttributeEditorFactory;
+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor;
@@ -31,6 +38,21 @@ public GerritTaskEditorPage(TaskEditor editor) {
setNeedsSubmitButton(false);
}
+ @Override
+ protected AttributeEditorFactory createAttributeEditorFactory() {
+ return new AttributeEditorFactory(getModel(), getTaskRepository(), getEditorSite()) {
+ @Override
+ public AbstractAttributeEditor createEditor(String type, TaskAttribute taskAttribute) {
+ if (taskAttribute.getId().equals(GerritTaskSchema.getDefault().CHANGE_ID.getKey())) {
+ AbstractAttributeEditor editor = super.createEditor(type, taskAttribute);
+ editor.setLayoutHint(new LayoutHint(RowSpan.SINGLE, ColumnSpan.MULTIPLE));
+ return editor;
+ }
+ return super.createEditor(type, taskAttribute);
+ }
+ };
+ }
+
@Override
protected Set<TaskEditorPartDescriptor> createPartDescriptors() {
Set<TaskEditorPartDescriptor> descriptors = super.createPartDescriptors();
@@ -39,13 +61,22 @@ protected Set<TaskEditorPartDescriptor> createPartDescriptors() {
if (PATH_ACTIONS.equals(descriptor.getPath())) {
it.remove();
}
+ if (PATH_PEOPLE.equals(descriptor.getPath())) {
+ it.remove();
+ }
}
- descriptors.add(new TaskEditorPartDescriptor("review") { //$NON-NLS-1$
+ descriptors.add(new TaskEditorPartDescriptor(ReviewSection.class.getName()) {
@Override
public AbstractTaskEditorPart createPart() {
return new ReviewSection();
}
});
+ descriptors.add(new TaskEditorPartDescriptor(PatchSetSection.class.getName()) {
+ @Override
+ public AbstractTaskEditorPart createPart() {
+ return new PatchSetSection();
+ }
+ });
return descriptors;
}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java
new file mode 100644
index 00000000..ea29823a
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/PatchSetSection.java
@@ -0,0 +1,364 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.ui.editor;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.compare.CompareConfiguration;
+import org.eclipse.compare.CompareUI;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
+import org.eclipse.mylyn.internal.gerrit.core.GerritTaskSchema;
+import org.eclipse.mylyn.internal.gerrit.core.GerritUtil;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritChange;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritPatchSetContent;
+import org.eclipse.mylyn.internal.gerrit.ui.GerritUiPlugin;
+import org.eclipse.mylyn.internal.gerrit.ui.operations.AbandonDialog;
+import org.eclipse.mylyn.internal.gerrit.ui.operations.PublishDialog;
+import org.eclipse.mylyn.internal.gerrit.ui.operations.RestoreDialog;
+import org.eclipse.mylyn.internal.gerrit.ui.operations.SubmitDialog;
+import org.eclipse.mylyn.internal.reviews.ui.annotations.ReviewCompareAnnotationModel;
+import org.eclipse.mylyn.internal.reviews.ui.operations.ReviewCompareEditorInput;
+import org.eclipse.mylyn.reviews.core.model.IFileItem;
+import org.eclipse.mylyn.reviews.core.model.IReviewItem;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.ui.TasksUi;
+import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.events.ExpansionAdapter;
+import org.eclipse.ui.forms.events.ExpansionEvent;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Section;
+
+import com.google.gerrit.common.data.ChangeDetail;
+import com.google.gerrit.common.data.PatchSetDetail;
+import com.google.gerrit.common.data.PatchSetPublishDetail;
+import com.google.gerrit.reviewdb.ApprovalCategory;
+import com.google.gerrit.reviewdb.Patch;
+import com.google.gerrit.reviewdb.PatchSet;
+import com.google.gerrit.reviewdb.PatchSet.Id;
+
+/**
+ * @author Steffen Pingel
+ */
+public class PatchSetSection extends AbstractGerritSection {
+
+ private class GetPatchSetContentJob extends Job {
+
+ private GerritPatchSetContent patchSetContent;
+
+ private final PatchSetDetail patchSetDetail;
+
+ private final TaskRepository repository;
+
+ public GetPatchSetContentJob(TaskRepository repository, PatchSetDetail patchSetDetail) {
+ super("Caching Patch Set Content");
+ this.repository = repository;
+ this.patchSetDetail = patchSetDetail;
+ }
+
+ public GerritPatchSetContent getPatchSetContent() {
+ return patchSetContent;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ GerritConnector connector = (GerritConnector) TasksUi.getRepositoryConnector(repository.getConnectorKind());
+ GerritClient client = connector.getClient(repository);
+ try {
+ int reviewId = patchSetDetail.getInfo().getKey().getParentKey().get();
+ patchSetContent = client.getPatchSetContent(
+ reviewId + "", patchSetDetail.getPatchSet().getId().get(), monitor); //$NON-NLS-1$
+ } catch (OperationCanceledException e) {
+ return Status.CANCEL_STATUS;
+ } catch (GerritException e) {
+ return new Status(IStatus.ERROR, GerritUiPlugin.PLUGIN_ID, "Review retrieval failed", e);
+ }
+ return Status.OK_STATUS;
+ }
+ }
+
+ private Composite composite;
+
+ private final List<Job> jobs;
+
+ private FormToolkit toolkit;
+
+ public PatchSetSection() {
+ setPartName("Patch Sets");
+ jobs = new ArrayList<Job>();
+ }
+
+ @Override
+ public void dispose() {
+ for (Job job : jobs) {
+ job.cancel();
+ }
+ super.dispose();
+ }
+
+ public String getTextClientText(final PatchSetDetail patchSetDetail) {
+ int numComments = getNumComments(patchSetDetail);
+ if (numComments > 0) {
+ return NLS.bind("{0} Comments", numComments);
+ } else {
+ return " ";
+ }
+ }
+
+ @Override
+ public void initialize(AbstractTaskEditorPage taskEditorPage) {
+ super.initialize(taskEditorPage);
+ }
+
+ private Composite createActions(final ChangeDetail changeDetail, final PatchSetDetail patchSetDetail,
+ final PatchSetPublishDetail publishDetail, Composite composite) {
+ Composite buttonComposite = new Composite(composite, SWT.NONE);
+ RowLayout layout = new RowLayout();
+ layout.center = true;
+ layout.spacing = 10;
+ buttonComposite.setLayout(layout);
+
+ boolean canPublish = getTaskData().getAttributeMapper().getBooleanValue(
+ getTaskData().getRoot().getAttribute(GerritTaskSchema.getDefault().CAN_PUBLISH.getKey()));
+ boolean canSubmit = false;
+ if (changeDetail.getCurrentActions() != null) {
+ canSubmit = changeDetail.getCurrentActions().contains(ApprovalCategory.SUBMIT);
+ }
+
+ if (canPublish) {
+ Button publishButton = toolkit.createButton(buttonComposite, "Publish Comments...", SWT.PUSH);
+ publishButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ doPublish(publishDetail);
+ }
+ });
+ }
+
+ if (canSubmit) {
+ Button submitButton = toolkit.createButton(buttonComposite, "Submit", SWT.PUSH);
+ submitButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ doSubmit(patchSetDetail.getPatchSet());
+ }
+ });
+ }
+
+ if (changeDetail != null && changeDetail.isCurrentPatchSet(patchSetDetail)) {
+ if (changeDetail.canAbandon()) {
+ Button abondonButton = toolkit.createButton(buttonComposite, "Abandon...", SWT.PUSH);
+ abondonButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ doAbandon(patchSetDetail.getPatchSet());
+ }
+ });
+ } else if (changeDetail.canRestore()) {
+ Button restoreButton = toolkit.createButton(buttonComposite, "Restore...", SWT.PUSH);
+ restoreButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ doRestore(patchSetDetail.getPatchSet());
+ }
+ });
+ }
+ }
+ return buttonComposite;
+ }
+
+ private void createSubSection(final ChangeDetail changeDetail, final PatchSetDetail patchSetDetail,
+ final PatchSetPublishDetail publishDetail, Section section) {
+ int style = ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT
+ | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT;
+ if (changeDetail.isCurrentPatchSet(patchSetDetail)) {
+ style |= ExpandableComposite.EXPANDED;
+ }
+ final Section subSection = toolkit.createSection(composite, style);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(subSection);
+ subSection.setText(NLS.bind("Patch Set {0}", patchSetDetail.getPatchSet().getId().get()));
+
+ String message = getTextClientText(patchSetDetail);
+ addTextClient(toolkit, subSection, message);
+
+ if (subSection.isExpanded()) {
+ createSubSectionContents(changeDetail, patchSetDetail, publishDetail, subSection);
+ }
+ subSection.addExpansionListener(new ExpansionAdapter() {
+ @Override
+ public void expansionStateChanged(ExpansionEvent e) {
+ if (subSection.getClient() == null) {
+ createSubSectionContents(changeDetail, patchSetDetail, publishDetail, subSection);
+ }
+ }
+ });
+ }
+
+ private int getNumComments(PatchSetDetail patchSetDetail) {
+ int numComments = 0;
+ for (Patch patch : patchSetDetail.getPatches()) {
+ numComments += patch.getCommentCount();
+ }
+ return numComments;
+ }
+
+ private void subSectionExpanded(final PatchSetDetail patchSetDetail, final Section composite, final Viewer viewer) {
+ final Label progressLabel = (Label) composite.getTextClient();
+ final String message = " Caching contents...";
+ progressLabel.setText(message);
+ progressLabel.setVisible(true);
+
+ final GetPatchSetContentJob job = new GetPatchSetContentJob(getTaskEditorPage().getTaskRepository(),
+ patchSetDetail);
+ job.addJobChangeListener(new JobChangeAdapter() {
+ @Override
+ public void done(final IJobChangeEvent event) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ if (getControl() != null && !getControl().isDisposed()) {
+ if (event.getResult().isOK()) {
+ GerritPatchSetContent content = job.getPatchSetContent();
+ if (content != null && content.getPatchScriptByPatchKey() != null) {
+ List<IReviewItem> items = GerritUtil.toReviewItems(patchSetDetail,
+ content.getPatchScriptByPatchKey());
+ viewer.setInput(items);
+ }
+ }
+
+ progressLabel.setText(getTextClientText(patchSetDetail));
+ progressLabel.setVisible(!composite.isExpanded());
+ getTaskEditorPage().reflow();
+ }
+ }
+ });
+ }
+ });
+ jobs.add(job);
+ job.schedule();
+ }
+
+ @Override
+ protected Control createContent(FormToolkit toolkit, Composite parent) {
+ this.toolkit = toolkit;
+
+ composite = toolkit.createComposite(parent);
+ GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 5).applyTo(composite);
+
+ GerritChange change = GerritUtil.getChange(getTaskData());
+ if (change != null) {
+ for (PatchSetDetail patchSetDetail : change.getPatchSetDetails()) {
+ Id patchSetId = patchSetDetail.getPatchSet().getId();
+ PatchSetPublishDetail publishDetail = change.getPublishDetailByPatchSetId().get(patchSetId);
+ createSubSection(change.getChangeDetail(), patchSetDetail, publishDetail, getSection());
+ }
+ }
+
+ return composite;
+ }
+
+ protected void doAbandon(PatchSet patchSet) {
+ AbandonDialog dialog = new AbandonDialog(getShell(), getTask(), patchSet);
+ openOperationDialog(dialog);
+ }
+
+ protected void doPublish(PatchSetPublishDetail publishDetail) {
+ PublishDialog dialog = new PublishDialog(getShell(), getTask(), publishDetail);
+ openOperationDialog(dialog);
+ }
+
+ protected void doRestore(PatchSet patchSet) {
+ RestoreDialog dialog = new RestoreDialog(getShell(), getTask(), patchSet);
+ openOperationDialog(dialog);
+ }
+
+ protected void doSubmit(PatchSet patchSet) {
+ SubmitDialog dialog = new SubmitDialog(getShell(), getTask(), patchSet);
+ openOperationDialog(dialog);
+ }
+
+ @Override
+ protected boolean shouldExpandOnCreate() {
+ return true;
+ }
+
+ void createSubSectionContents(final ChangeDetail changeDetail, final PatchSetDetail patchSetDetail,
+ PatchSetPublishDetail publishDetail, Section subSection) {
+ Composite composite = toolkit.createComposite(subSection);
+ GridLayoutFactory.fillDefaults().applyTo(composite);
+ subSection.setClient(composite);
+
+ TableViewer viewer = new TableViewer(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL);
+ GridDataFactory.fillDefaults().grab(true, true).hint(500, SWT.DEFAULT).applyTo(viewer.getControl());
+ viewer.setContentProvider(new IStructuredContentProvider() {
+ public void dispose() {
+ // ignore
+ }
+
+ public Object[] getElements(Object inputElement) {
+ return ((List) inputElement).toArray();
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ // ignore
+ }
+ });
+ viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new ReviewItemLabelProvider()));
+ viewer.addOpenListener(new IOpenListener() {
+ public void open(OpenEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ IFileItem item = (IFileItem) selection.getFirstElement();
+ ReviewCompareAnnotationModel model = new ReviewCompareAnnotationModel(item, null);
+ CompareConfiguration configuration = new CompareConfiguration();
+ CompareUI.openCompareEditor(new ReviewCompareEditorInput(item, model, configuration));
+ }
+ });
+
+ List<IReviewItem> items = GerritUtil.toReviewItems(patchSetDetail, null);
+ viewer.setInput(items);
+
+ Composite actionComposite = createActions(changeDetail, patchSetDetail, publishDetail, composite);
+
+ subSectionExpanded(patchSetDetail, subSection, viewer);
+
+ getTaskEditorPage().reflow();
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/ReviewItemLabelProvider.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/ReviewItemLabelProvider.java
index 34d065f3..f68e3414 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/ReviewItemLabelProvider.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/ReviewItemLabelProvider.java
@@ -58,11 +58,14 @@ public StyledString getStyledText(Object element) {
if (text != null) {
StyledString styledString = new StyledString(text);
if (element instanceof IFileItem) {
- int i = ((IFileItem) element).getTopics().size();
- i += ((IFileItem) element).getBase().getTopics().size();
- i += ((IFileItem) element).getTarget().getTopics().size();
- if (i > 0) {
- styledString.append(NLS.bind(" [{0} comments]", i), StyledString.DECORATIONS_STYLER);
+ IFileItem fileItem = (IFileItem) element;
+ if (fileItem.getBase() != null && fileItem.getTarget() != null) {
+ int i = fileItem.getTopics().size();
+ i += fileItem.getBase().getTopics().size();
+ i += fileItem.getTarget().getTopics().size();
+ if (i > 0) {
+ styledString.append(NLS.bind(" [{0} comments]", i), StyledString.DECORATIONS_STYLER);
+ }
}
}
return styledString;
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/ReviewSection.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/ReviewSection.java
index e6e84c73..5ff8cc71 100644
--- a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/ReviewSection.java
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/editor/ReviewSection.java
@@ -11,277 +11,265 @@
package org.eclipse.mylyn.internal.gerrit.ui.editor;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.IJobChangeEvent;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylyn.internal.gerrit.core.GerritConnector;
+import org.eclipse.mylyn.internal.gerrit.core.GerritUtil;
+import org.eclipse.mylyn.internal.gerrit.core.client.GerritChange;
import org.eclipse.mylyn.internal.gerrit.core.client.GerritClient;
-import org.eclipse.mylyn.internal.gerrit.core.client.GerritException;
-import org.eclipse.mylyn.internal.gerrit.ui.GerritUiPlugin;
-import org.eclipse.mylyn.internal.reviews.ui.annotations.ReviewCompareAnnotationModel;
-import org.eclipse.mylyn.internal.reviews.ui.operations.ReviewCompareEditorInput;
-import org.eclipse.mylyn.internal.tasks.ui.editors.AbstractTaskEditorSection;
-import org.eclipse.mylyn.reviews.core.model.IFileItem;
-import org.eclipse.mylyn.reviews.core.model.IReview;
-import org.eclipse.mylyn.reviews.core.model.IReviewItem;
-import org.eclipse.mylyn.reviews.core.model.IReviewItemSet;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.internal.gerrit.ui.operations.AddReviewersDialog;
import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
+import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.events.ExpansionAdapter;
-import org.eclipse.ui.forms.events.ExpansionEvent;
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
+import com.google.gerrit.common.data.AccountInfo;
+import com.google.gerrit.common.data.ApprovalDetail;
+import com.google.gerrit.common.data.ApprovalType;
+import com.google.gerrit.common.data.ChangeDetail;
+import com.google.gerrit.common.data.ChangeInfo;
+import com.google.gerrit.common.data.GerritConfig;
+import com.google.gerrit.reviewdb.ApprovalCategory;
+import com.google.gerrit.reviewdb.ApprovalCategoryValue;
+import com.google.gerrit.reviewdb.Change;
+import com.google.gerrit.reviewdb.PatchSetApproval;
+
/**
* @author Steffen Pingel
*/
-public class ReviewSection extends AbstractTaskEditorSection {
-
- private class GetReviewJob extends Job {
+public class ReviewSection extends AbstractGerritSection {
- private final TaskRepository repository;
+ private Composite composite;
- private IReview review;
+ private FormToolkit toolkit;
- private final String reviewId;
+ public ReviewSection() {
+ setPartName("Review");
+ }
- public GetReviewJob(TaskRepository repository, String reviewId) {
- super("Get Review");
- this.repository = repository;
- this.reviewId = reviewId;
- }
+ @Override
+ protected Control createContent(FormToolkit toolkit, Composite parent) {
+ this.toolkit = toolkit;
- public IReview getReview() {
- return review;
- }
+ composite = toolkit.createComposite(parent);
+ GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 5).applyTo(composite);
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- GerritConnector connector = (GerritConnector) TasksUi.getRepositoryConnector(repository.getConnectorKind());
- GerritClient client = connector.getClient(repository);
- try {
- review = client.getReview(reviewId, monitor);
- } catch (GerritException e) {
- return new Status(IStatus.ERROR, GerritUiPlugin.PLUGIN_ID, "Review retrieval failed", e);
- }
- return Status.OK_STATUS;
+ GerritChange review = GerritUtil.getChange(getTaskData());
+ if (review != null) {
+ createReviewContent(toolkit, composite, review.getChangeDetail());
}
-
+ return composite;
}
- private class GetChangeSetDetailsJob extends Job {
+ private void createReviewContent(FormToolkit toolkit, Composite composite, ChangeDetail changeDetail) {
+ GerritConfig config = getConfig();
- private final TaskRepository repository;
+ createPeopleSubSection(composite, changeDetail, config);
- private final IReviewItemSet itemSet;
-
- private List<IReviewItem> items;
-
- public GetChangeSetDetailsJob(TaskRepository repository, IReviewItemSet itemSet) {
- super("Get Review");
- this.repository = repository;
- this.itemSet = itemSet;
+ if (changeDetail.getMissingApprovals() != null && changeDetail.getMissingApprovals().size() > 0) {
+ createRequirementsSubSection(toolkit, composite, config, changeDetail);
}
- public List<IReviewItem> getItems() {
- return items;
+ if (changeDetail.getDependsOn() != null && changeDetail.getDependsOn().size() > 0) {
+ createDependenciesSubSection(toolkit, composite, "Depends On", changeDetail, changeDetail.getDependsOn());
}
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- GerritConnector connector = (GerritConnector) TasksUi.getRepositoryConnector(repository.getConnectorKind());
- GerritClient client = connector.getClient(repository);
- try {
- items = client.getChangeSetDetails(itemSet, monitor);
- } catch (GerritException e) {
- return new Status(IStatus.ERROR, GerritUiPlugin.PLUGIN_ID, "Review retrieval failed", e);
- }
- return Status.OK_STATUS;
+ if (changeDetail.getNeededBy() != null && changeDetail.getNeededBy().size() > 0) {
+ createDependenciesSubSection(toolkit, composite, "Needed By", changeDetail, changeDetail.getNeededBy());
}
}
- private Composite composite;
+ void createPeopleSubSection(Composite parent, ChangeDetail changeDetail, GerritConfig config) {
+ if (changeDetail.getApprovals().isEmpty() && !canAddReviewers(changeDetail)) {
+ return;
+ }
- private final List<Job> jobs;
+ int style = ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT
+ | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT;
- private FormToolkit toolkit;
+ final Section subSection = toolkit.createSection(parent, style);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(subSection);
+ subSection.setText("Reviewers");
- private Label progressLabel;
+ List<ApprovalType> approvalTypes;
+ if (config != null) {
+ approvalTypes = config.getApprovalTypes().getApprovalTypes();
+ } else {
+ approvalTypes = Collections.emptyList();
+ }
- public ReviewSection() {
- setPartName("Review");
- jobs = new ArrayList<Job>();
- }
+ Composite composite = toolkit.createComposite(subSection);
+ int numColumns = approvalTypes.size() + 1;
+ GridLayoutFactory.fillDefaults()
+ .numColumns(numColumns)
+ .extendedMargins(0, 0, 0, 5)
+ .spacing(20, 5)
+ .applyTo(composite);
+ subSection.setClient(composite);
+
+ if (changeDetail.getApprovals().size() > 0) {
+ StringBuilder names = new StringBuilder();
+
+ // column headers
+ Label label = new Label(composite, SWT.NONE);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ label.setText(" "); //$NON-NLS-1$
+ for (ApprovalType approvalType : approvalTypes) {
+ label = new Label(composite, SWT.NONE);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ label.setText(approvalType.getCategory().getName());
+ }
- @Override
- public void dispose() {
- for (Job job : jobs) {
- job.cancel();
+ for (ApprovalDetail approvalDetail : changeDetail.getApprovals()) {
+ AccountInfo user = changeDetail.getAccounts().get(approvalDetail.getAccount());
+
+ label = new Label(composite, SWT.NONE);
+ label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ label.setText(GerritUtil.getUserLabel(user));
+
+ for (ApprovalType approvalType : approvalTypes) {
+ PatchSetApproval approval = approvalDetail.getApprovalMap().get(approvalType.getCategory().getId());
+ if (approval != null) {
+ label = new Label(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).applyTo(label);
+
+ ApprovalCategoryValue approvalValue = approvalType.getValue(approval.getValue());
+ if (approvalValue != null) {
+ label.setText(approvalValue.formatValue());
+ label.setToolTipText(approvalValue.format());
+ } else {
+ label.setText(approval.getValue() + ""); //$NON-NLS-1$
+ }
+ } else {
+ label = new Label(composite, SWT.NONE);
+ label.setText(" "); //$NON-NLS-1$
+ }
+ }
+
+ if (names.length() > 0) {
+ names.append(", "); //$NON-NLS-1$
+ }
+ names.append(GerritUtil.getUserLabel(user));
+ }
+
+ if (names.length() > 0) {
+ addTextClient(toolkit, subSection, names.toString());
+ }
}
- super.dispose();
+
+ Composite buttonComposite = new Composite(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().span(numColumns, 1).applyTo(buttonComposite);
+ RowLayout layout = new RowLayout();
+ layout.center = true;
+ layout.spacing = 10;
+ buttonComposite.setLayout(layout);
+ Button addReviewersButton = toolkit.createButton(buttonComposite, "Add Reviewers...", SWT.PUSH);
+ addReviewersButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ doAddReviewers();
+ }
+ });
}
- @Override
- public void initialize(AbstractTaskEditorPage taskEditorPage) {
- super.initialize(taskEditorPage);
+ private void doAddReviewers() {
+ AddReviewersDialog dialog = new AddReviewersDialog(getShell(), getTask());
+ openOperationDialog(dialog);
}
- private void updateContent(IReview review) {
- progressLabel.dispose();
- for (IReviewItem item : review.getItems()) {
- if (item instanceof IReviewItemSet) {
- createSubSection(review, (IReviewItemSet) item);
- }
- }
- composite.layout(true, true);
- getTaskEditorPage().reflow();
+ private boolean canAddReviewers(ChangeDetail changeDetail) {
+ return changeDetail.getChange().getStatus() == Change.Status.NEW;
}
- private void createSubSection(final IReview review, final IReviewItemSet item) {
- int style = ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT;
- if (item.getItems().size() > 0) {
- style |= ExpandableComposite.EXPANDED;
+ private void createRequirementsSubSection(final FormToolkit toolkit, final Composite parent, GerritConfig config,
+ ChangeDetail changeDetail) {
+ if (config == null) {
+ return;
}
- final Section subSection = toolkit.createSection(composite, style);
+
+ int style = ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT
+ | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT;
+
+ final Section subSection = toolkit.createSection(parent, style);
GridDataFactory.fillDefaults().grab(true, false).applyTo(subSection);
- subSection.setText(item.getName());
+ subSection.setText("Requirements");
- subSection.setTextClient(toolkit.createLabel(subSection, item.getRevision()));
+ Composite composite = toolkit.createComposite(subSection);
+ GridLayoutFactory.fillDefaults().numColumns(2).spacing(20, 5).extendedMargins(0, 0, 0, 5).applyTo(composite);
+ subSection.setClient(composite);
- if (item.getItems().size() > 0) {
- createSubSectionContents(review, item, subSection);
- } else {
- subSection.addExpansionListener(new ExpansionAdapter() {
- @Override
- public void expansionStateChanged(ExpansionEvent e) {
- if (subSection.getClient() == null) {
- final Label progressLabel = new Label(subSection, SWT.NONE);
- progressLabel.setText("Retrieving contents...");
- progressLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- subSection.setClient(progressLabel);
- getTaskEditorPage().reflow();
-
- final GetChangeSetDetailsJob job = new GetChangeSetDetailsJob(
- getTaskEditorPage().getTaskRepository(), item);
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(final IJobChangeEvent event) {
- if (event.getResult().isOK()) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl() != null && !getControl().isDisposed()) {
- if (job.getItems() != null) {
- item.getItems().addAll(job.getItems());
-
- progressLabel.dispose();
- createSubSectionContents(review, item, subSection);
- } else {
- progressLabel.setText("No items found");
- }
- getTaskEditorPage().reflow();
- }
- }
- });
- }
- }
- });
- jobs.add(job);
- job.schedule();
- }
- }
- });
- }
- }
+ StringBuilder sb = new StringBuilder();
- void createSubSectionContents(final IReview review, IReviewItemSet item, Section subSection) {
- TableViewer viewer = new TableViewer(subSection, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL);
- viewer.setContentProvider(new IStructuredContentProvider() {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- // ignore
- }
+ for (ApprovalCategory.Id approvalCategoryId : changeDetail.getMissingApprovals()) {
+ ApprovalType type = config.getApprovalTypes().getApprovalType(approvalCategoryId);
+ if (type != null) {
+ ApprovalCategoryValue approvalValue = type.getMax();
+ if (approvalValue != null) {
+ Label label1 = new Label(composite, SWT.NONE);
+ label1.setText(type.getCategory().getName());
+ label1.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- public void dispose() {
- // ignore
- }
+ Label label2 = new Label(composite, SWT.NONE);
+ label2.setText(approvalValue.format());
+ //label2.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
- public Object[] getElements(Object inputElement) {
- return ((List) inputElement).toArray();
- }
- });
- viewer.setInput(item.getItems());
- viewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new ReviewItemLabelProvider()));
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- IFileItem item = (IFileItem) selection.getFirstElement();
- ReviewCompareAnnotationModel model = new ReviewCompareAnnotationModel(item, review, null);
- CompareConfiguration configuration = new CompareConfiguration();
- CompareUI.openCompareEditor(new ReviewCompareEditorInput(item, model, configuration));
+ if (sb.length() > 0) {
+ sb.append(", "); //$NON-NLS-1$
+ }
+ sb.append(type.getCategory().getName());
+ }
}
- });
- subSection.setClient(viewer.getControl());
- }
-
- @Override
- protected Control createContent(FormToolkit toolkit, Composite parent) {
- this.toolkit = toolkit;
+ }
- composite = toolkit.createComposite(parent);
- GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 5).applyTo(composite);
+ addTextClient(toolkit, subSection, sb.toString());
+ }
- progressLabel = new Label(composite, SWT.NONE);
- progressLabel.setText("Retrieving contents...");
- progressLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ private void createDependenciesSubSection(final FormToolkit toolkit, final Composite parent, String title,
+ ChangeDetail changeDetail, List<ChangeInfo> changeInfos) {
+ int style = ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT;
- initializeUpdateJob();
+ final Section subSection = toolkit.createSection(parent, style);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(subSection);
+ subSection.setText(title);
- return composite;
+ Composite composite = toolkit.createComposite(subSection);
+ GridLayoutFactory.fillDefaults().extendedMargins(0, 0, 0, 5).applyTo(composite);
+ subSection.setClient(composite);
+
+ for (final ChangeInfo changeInfo : changeInfos) {
+ AccountInfo user = changeDetail.getAccounts().get(changeInfo.getOwner());
+ Link link = new Link(composite, SWT.NONE);
+ link.setText(NLS.bind(
+ "<a>{0}</a>: {1} by {2}",
+ new String[] { changeInfo.getKey().abbreviate(), changeInfo.getSubject(),
+ GerritUtil.getUserLabel(user) }));
+ link.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ TasksUiUtil.openTask(getTaskEditorPage().getTaskRepository(), changeInfo.getId() + ""); //$NON-NLS-1$
+ }
+ });
+ }
}
- void initializeUpdateJob() {
- GetReviewJob job = new GetReviewJob(getTaskEditorPage().getTaskRepository(), getTaskEditorPage().getTask()
- .getTaskId());
- job.addJobChangeListener(new JobChangeAdapter() {
- @Override
- public void done(final IJobChangeEvent event) {
- if (event.getResult().isOK()) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- if (getControl() != null && !getControl().isDisposed()) {
- updateContent(((GetReviewJob) event.getJob()).getReview());
- }
- }
- });
- }
- }
- });
- jobs.add(job);
- job.schedule();
+ private GerritConfig getConfig() {
+ GerritConnector connector = (GerritConnector) TasksUi.getRepositoryConnector(getTaskData().getConnectorKind());
+ GerritClient client = connector.getClient(getTaskEditorPage().getTaskRepository());
+ return client.getConfig();
}
@Override
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/AbandonDialog.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/AbandonDialog.java
new file mode 100644
index 00000000..5e4a7fef
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/AbandonDialog.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.ui.operations;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.mylyn.internal.gerrit.core.operations.AbandonRequest;
+import org.eclipse.mylyn.internal.gerrit.core.operations.GerritOperation;
+import org.eclipse.mylyn.internal.gerrit.ui.GerritUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import com.google.gerrit.reviewdb.PatchSet;
+
+/**
+ * @author Steffen Pingel
+ */
+public class AbandonDialog extends GerritOperationDialog {
+
+ private RichTextEditor messageEditor;
+
+ private final PatchSet patchSet;
+
+ public AbandonDialog(Shell parentShell, ITask task, PatchSet patchSet) {
+ super(parentShell, task);
+ this.patchSet = patchSet;
+ }
+
+ @Override
+ public GerritOperation createOperation() {
+ int patchSetId = patchSet.getId().get();
+ AbandonRequest request = new AbandonRequest(task.getTaskId(), patchSetId);
+ request.setMessage(messageEditor.getText());
+ return GerritUiPlugin.getDefault().getOperationFactory().createAbandonOperation(task, request);
+ }
+
+ @Override
+ protected Control createPageControls(Composite parent) {
+ setTitle("Abondon Change");
+ setMessage("Enter an optional message.");
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ messageEditor = createRichTextEditor(composite, "");
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(messageEditor.getControl());
+
+ return composite;
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/AddReviewersDialog.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/AddReviewersDialog.java
new file mode 100644
index 00000000..aa59106d
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/AddReviewersDialog.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.ui.operations;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.mylyn.internal.gerrit.core.operations.AddReviewersRequest;
+import org.eclipse.mylyn.internal.gerrit.core.operations.GerritOperation;
+import org.eclipse.mylyn.internal.gerrit.ui.GerritUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import com.google.gerrit.common.data.ReviewerResult;
+
+/**
+ * @author Steffen Pingel
+ */
+public class AddReviewersDialog extends GerritOperationDialog {
+
+ private RichTextEditor messageEditor;
+
+ public AddReviewersDialog(Shell parentShell, ITask task) {
+ super(parentShell, task);
+ }
+
+ @Override
+ public GerritOperation createOperation() {
+ AddReviewersRequest request = new AddReviewersRequest(task.getTaskId(), getReviewers());
+ return GerritUiPlugin.getDefault().getOperationFactory().createAddReviewersOperation(task, request);
+ }
+
+ private List<String> getReviewers() {
+ String[] reviewers = messageEditor.getText().split(",");
+ return Arrays.asList(reviewers);
+ }
+
+ @Override
+ protected Control createPageControls(Composite parent) {
+ setTitle("Add Reviewers");
+ setMessage("Enter a comma separated list of names or email addresses.");
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ messageEditor = createRichTextEditor(composite, "");
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(messageEditor.getControl());
+
+ return composite;
+ }
+
+ @Override
+ protected boolean processOperationResult(GerritOperation<?> operation) {
+ Object result = operation.getOperationResult();
+ if (result instanceof ReviewerResult) {
+ ReviewerResult reviewerResult = (ReviewerResult) result;
+ if (reviewerResult.getErrors() != null && reviewerResult.getErrors().size() > 0) {
+ setErrorMessage(reviewerResult.getErrors().toString());
+ return false;
+ }
+ }
+ return super.processOperationResult(operation);
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/GerritOperationDialog.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/GerritOperationDialog.java
new file mode 100644
index 00000000..6e7cca7a
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/GerritOperationDialog.java
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.ui.operations;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.atomic.AtomicReference;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.mylyn.internal.gerrit.core.GerritOperationFactory;
+import org.eclipse.mylyn.internal.gerrit.core.operations.GerritOperation;
+import org.eclipse.mylyn.internal.gerrit.core.operations.RefreshConfigRequest;
+import org.eclipse.mylyn.internal.gerrit.ui.GerritUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
+import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
+import org.eclipse.mylyn.reviews.ui.ProgressDialog;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.ui.TasksUi;
+import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorExtension;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+import com.google.gerrit.common.data.GerritConfig;
+
+/**
+ * @author Steffen Pingel
+ */
+public abstract class GerritOperationDialog extends ProgressDialog {
+
+ private boolean needsConfig;
+
+ protected final ITask task;
+
+ protected FormToolkit toolkit;
+
+ public GerritOperationDialog(Shell parentShell, ITask task) {
+ super(parentShell);
+ this.task = task;
+ }
+
+ @Override
+ public boolean close() {
+ if (getReturnCode() == OK) {
+ boolean shouldClose = performOperation(createOperation());
+ if (!shouldClose) {
+ return false;
+ }
+ }
+ return super.close();
+ }
+
+ public abstract GerritOperation<?> createOperation();
+
+ public GerritOperationFactory getOperationFactory() {
+ return GerritUiPlugin.getDefault().getOperationFactory();
+ }
+
+ public ITask getTask() {
+ return task;
+ }
+
+ public boolean needsConfig() {
+ return needsConfig;
+ }
+
+ public void setNeedsConfig(boolean needsConfig) {
+ this.needsConfig = needsConfig;
+ }
+
+ private boolean performOperation(final GerritOperation<?> operation) {
+ final AtomicReference<IStatus> result = new AtomicReference<IStatus>();
+ try {
+ run(true, true, new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ result.set(operation.run(monitor));
+ }
+ });
+ } catch (InvocationTargetException e) {
+ StatusManager.getManager().handle(
+ new Status(IStatus.ERROR, GerritUiPlugin.PLUGIN_ID,
+ "Unexpected error during execution of Gerrit operation", e),
+ StatusManager.SHOW | StatusManager.LOG);
+ } catch (InterruptedException e) {
+ // cancelled
+ return false;
+ }
+
+ if (result.get().getSeverity() == IStatus.CANCEL) {
+ return false;
+ }
+
+ if (!result.get().isOK()) {
+ StatusManager.getManager().handle(result.get(), StatusManager.SHOW | StatusManager.LOG);
+ return false;
+ }
+ return processOperationResult(operation);
+ }
+
+ protected boolean processOperationResult(GerritOperation<?> operation) {
+ return true;
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ toolkit = new FormToolkit(TasksUiPlugin.getDefault().getFormColors(parent.getDisplay()));
+ Control control = super.createDialogArea(parent);
+ if (needsConfig()) {
+ GerritConfig config = getOperationFactory().getClient(getTask()).getConfig();
+ if (config != null) {
+ doRefresh(config);
+ } else {
+ GerritOperation<GerritConfig> operation = getOperationFactory().createRefreshConfigOperation(getTask(),
+ new RefreshConfigRequest());
+ performOperation(operation);
+ config = operation.getOperationResult();
+ doRefresh(config);
+ }
+ }
+ return control;
+ }
+
+ protected RichTextEditor createRichTextEditor(Composite composite, String value) {
+ int style = SWT.FLAT | SWT.BORDER | SWT.MULTI | SWT.WRAP;
+
+ TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
+ task.getRepositoryUrl());
+ AbstractTaskEditorExtension extension = TaskEditorExtensions.getTaskEditorExtension(repository);
+
+ final RichTextEditor editor = new RichTextEditor(repository, style, null, extension, task);
+ editor.setText(value);
+ editor.createControl(composite, toolkit);
+
+ // HACK: this is to make sure that we can't have multiple things highlighted
+ editor.getViewer().getTextWidget().addFocusListener(new FocusListener() {
+
+ public void focusGained(FocusEvent e) {
+ }
+
+ public void focusLost(FocusEvent e) {
+ editor.getViewer().getTextWidget().setSelection(0);
+ }
+ });
+
+ return editor;
+ }
+
+ protected void doRefresh(GerritConfig config) {
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/PublishDialog.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/PublishDialog.java
new file mode 100644
index 00000000..e9313e9f
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/PublishDialog.java
@@ -0,0 +1,156 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.ui.operations;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.mylyn.internal.gerrit.core.operations.GerritOperation;
+import org.eclipse.mylyn.internal.gerrit.core.operations.PublishRequest;
+import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Shell;
+
+import com.google.gerrit.common.data.ApprovalType;
+import com.google.gerrit.common.data.GerritConfig;
+import com.google.gerrit.common.data.PatchSetPublishDetail;
+import com.google.gerrit.reviewdb.ApprovalCategoryValue;
+import com.google.gerrit.reviewdb.PatchSetApproval;
+
+/**
+ * @author Steffen Pingel
+ */
+public class PublishDialog extends GerritOperationDialog {
+
+ private static final String KEY_ID = "ApprovalCategoryValue.Id"; //$NON-NLS-1$
+
+ private final PatchSetPublishDetail publishDetail;
+
+ private RichTextEditor messageEditor;
+
+ private Composite approvalComposite;
+
+ private final List<Button> approvalButtons;
+
+ public PublishDialog(Shell parentShell, ITask task, PatchSetPublishDetail patchSet) {
+ super(parentShell, task);
+ this.publishDetail = patchSet;
+ this.approvalButtons = new ArrayList<Button>();
+ setNeedsConfig(true);
+ }
+
+ @Override
+ public GerritOperation createOperation() {
+ int patchSetId = publishDetail.getPatchSetInfo().getKey().get();
+ PublishRequest request = new PublishRequest(task.getTaskId(), patchSetId, getApprovals());
+ request.setMessage(messageEditor.getText());
+ return getOperationFactory().createPublishOperation(task, request);
+ }
+
+ private Set<ApprovalCategoryValue.Id> getApprovals() {
+ Set<ApprovalCategoryValue.Id> approvals = new HashSet<ApprovalCategoryValue.Id>();
+ for (Button button : approvalButtons) {
+ if (button.getSelection()) {
+ approvals.add((ApprovalCategoryValue.Id) button.getData(KEY_ID));
+ }
+ }
+ return approvals;
+ }
+
+ @Override
+ protected Control createPageControls(Composite parent) {
+ String changeId = publishDetail.getChange().getKey().abbreviate();
+
+ setTitle("Publish Comments");
+ setMessage(NLS.bind("Change {0} - {1}", changeId, publishDetail.getPatchSetInfo().getSubject()));
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ approvalComposite = new Composite(composite, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(approvalComposite);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ approvalComposite.setLayout(layout);
+
+ messageEditor = createRichTextEditor(composite, "");
+ GridDataFactory.fillDefaults().grab(true, true).minSize(400, 150).applyTo(messageEditor.getControl());
+ messageEditor.getControl().setFocus();
+
+ return composite;
+ }
+
+ @Override
+ protected void doRefresh(GerritConfig config) {
+ Control[] children = approvalComposite.getChildren();
+ for (Control child : children) {
+ child.dispose();
+ }
+ approvalButtons.clear();
+
+ if (config == null) {
+ return;
+ }
+
+ for (ApprovalType approvalType : config.getApprovalTypes().getApprovalTypes()) {
+ Set<ApprovalCategoryValue.Id> allowed = publishDetail.getAllowed(approvalType.getCategory().getId());
+ if (allowed != null && allowed.size() > 0) {
+ Group group = new Group(approvalComposite, SWT.NONE);
+ GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
+ group.setText(approvalType.getCategory().getName());
+ group.setLayout(new RowLayout(SWT.VERTICAL));
+
+ int givenValue = 0;
+ if (publishDetail.getGiven() != null) {
+ PatchSetApproval approval = publishDetail.getGiven().get(approvalType.getCategory().getId());
+ if (approval != null) {
+ givenValue = approval.getValue();
+ }
+ }
+
+ List<ApprovalCategoryValue.Id> allowedList = new ArrayList<ApprovalCategoryValue.Id>(allowed);
+ Collections.sort(allowedList, new Comparator<ApprovalCategoryValue.Id>() {
+ public int compare(ApprovalCategoryValue.Id o1, ApprovalCategoryValue.Id o2) {
+ return o1.get() - o2.get();
+ }
+ });
+ for (ApprovalCategoryValue.Id valueId : allowedList) {
+ ApprovalCategoryValue approvalValue = approvalType.getValue(valueId.get());
+
+ Button button = new Button(group, SWT.RADIO);
+ button.setText(approvalValue.format());
+ if (approvalValue.getValue() == givenValue) {
+ button.setSelection(true);
+ }
+
+ button.setData(KEY_ID, valueId);
+ approvalButtons.add(button);
+ }
+ }
+ }
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/RestoreDialog.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/RestoreDialog.java
new file mode 100644
index 00000000..22c8fc95
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/RestoreDialog.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.ui.operations;
+
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.mylyn.internal.gerrit.core.operations.GerritOperation;
+import org.eclipse.mylyn.internal.gerrit.core.operations.RestoreRequest;
+import org.eclipse.mylyn.internal.gerrit.ui.GerritUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+import com.google.gerrit.reviewdb.PatchSet;
+
+/**
+ * @author Steffen Pingel
+ */
+public class RestoreDialog extends GerritOperationDialog {
+
+ private final PatchSet patchSet;
+
+ private RichTextEditor messageEditor;
+
+ public RestoreDialog(Shell parentShell, ITask task, PatchSet patchSet) {
+ super(parentShell, task);
+ this.patchSet = patchSet;
+ }
+
+ @Override
+ public GerritOperation createOperation() {
+ int patchSetId = patchSet.getId().get();
+ RestoreRequest request = new RestoreRequest(task.getTaskId(), patchSetId);
+ request.setMessage(messageEditor.getText());
+ return GerritUiPlugin.getDefault().getOperationFactory().createRestoreOperation(task, request);
+ }
+
+ @Override
+ protected Control createPageControls(Composite parent) {
+ setTitle("Restore Change");
+ setMessage("Enter an optional message.");
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ messageEditor = createRichTextEditor(composite, "");
+ GridDataFactory.fillDefaults().grab(true, true).applyTo(messageEditor.getControl());
+
+ return composite;
+ }
+
+}
diff --git a/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/SubmitDialog.java b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/SubmitDialog.java
new file mode 100644
index 00000000..2a0c5ea1
--- /dev/null
+++ b/gerrit/org.eclipse.mylyn.gerrit.ui/src/org/eclipse/mylyn/internal/gerrit/ui/operations/SubmitDialog.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.gerrit.ui.operations;
+
+import org.eclipse.mylyn.internal.gerrit.core.operations.GerritOperation;
+import org.eclipse.mylyn.internal.gerrit.core.operations.SubmitRequest;
+import org.eclipse.mylyn.internal.gerrit.ui.GerritUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+import com.google.gerrit.reviewdb.PatchSet;
+
+/**
+ * @author Steffen Pingel
+ */
+public class SubmitDialog extends GerritOperationDialog {
+
+ private final PatchSet patchSet;
+
+ private RichTextEditor messageEditor;
+
+ public SubmitDialog(Shell parentShell, ITask task, PatchSet patchSet) {
+ super(parentShell, task);
+ this.patchSet = patchSet;
+ }
+
+ @Override
+ public GerritOperation createOperation() {
+ int patchSetId = patchSet.getId().get();
+ SubmitRequest request = new SubmitRequest(task.getTaskId(), patchSetId);
+ return GerritUiPlugin.getDefault().getOperationFactory().createSubmitOperation(task, request);
+ }
+
+ @Override
+ protected Control createPageControls(Composite parent) {
+ setTitle("Submit Change");
+ setMessage("");
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout(1, false));
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setText("Submit Change?");
+
+ return composite;
+ }
+
+}
diff --git a/releng/reviews-target-definition/mylyn-reviews-e3.5.target b/releng/reviews-target-definition/mylyn-reviews-e3.5.target
index 32c7029b..06bc5853 100644
--- a/releng/reviews-target-definition/mylyn-reviews-e3.5.target
+++ b/releng/reviews-target-definition/mylyn-reviews-e3.5.target
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.6"?>
-
<target name="mylyn-reviews-e3.5">
<locations>
-<location includeAllPlatforms="false" includeMode="slicer" includeSource="true" type="InstallableUnit">
+<location includeAllPlatforms="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+
<repository location="http://download.eclipse.org/releases/galileo"/>
<unit id="org.eclipse.sdk.ide" version="3.5.2.M20100211-1343"/>
<unit id="org.eclipse.emf.ecore.feature.group" version="2.5.0.v200906151043"/>
@@ -11,9 +11,14 @@
<unit id="org.eclipse.emf.common.feature.group" version="2.5.0.v200906151043"/>
<unit id="org.eclipse.emf.databinding.feature.group" version="1.1.0.v200906151043"/>
<unit id="org.eclipse.cdt.platform.feature.group" version="6.0.2.201002161416"/>
+
+<repository location="http://download.eclipse.org/mylyn/snapshots/weekly"/>
+<unit id="org.eclipse.mylyn.sdk_feature.feature.group" version="0.0.0"/>
+
<repository location="http://download.eclipse.org/egit/updates"/>
-<unit id="org.eclipse.jgit.feature.group" version="0.10.1"/>
-<repository location="http://download.eclipse.org/tools/orbit/committers/drops/S20110124210048/repository/"/>
+<unit id="org.eclipse.egit.feature.group" version="0.0.0"/>
+
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20110124210048/repository/"/>
<unit id="com.google.gwt.user" version="2.0.4.v20100709-0658"/>
<unit id="org.apache.commons.io" version="1.4.0.v20081110-1000"/>
<unit id="com.google.gson" version="1.6.0.v201101131530"/>
@@ -23,10 +28,7 @@
<unit id="com.google.gerrit.prettify" version="2.1.5.v201101181500"/>
<unit id="com.google.gerrit.reviewdb" version="2.1.5.v201101121030"/>
<unit id="com.google.gerrit.common" version="2.1.5.v201101200205"/>
-<unit id="org.eclipse.mylyn_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
-<repository location="http://download.eclipse.org/tools/mylyn/update/weekly"/>
-<unit id="org.eclipse.mylyn.bugzilla_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
-<unit id="org.eclipse.mylyn.sdk_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
+
</location>
</locations>
</target>
diff --git a/releng/reviews-target-definition/mylyn-reviews-e3.6.target b/releng/reviews-target-definition/mylyn-reviews-e3.6.target
index 58602a99..393ca51a 100644
--- a/releng/reviews-target-definition/mylyn-reviews-e3.6.target
+++ b/releng/reviews-target-definition/mylyn-reviews-e3.6.target
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.6"?>
-
<target name="mylyn-reviews-e3.6">
<locations>
-<location includeAllPlatforms="false" includeMode="planner" type="InstallableUnit">
+<location includeAllPlatforms="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+
<repository location="http://download.eclipse.org/releases/helios"/>
<unit id="org.eclipse.sdk.ide" version="3.6.1.M20100909-0800"/>
<unit id="org.eclipse.emf.ecore.feature.group" version="2.6.1.v20100914-1218"/>
@@ -11,9 +11,14 @@
<unit id="org.eclipse.emf.common.feature.group" version="2.6.0.v20100914-1218"/>
<unit id="org.eclipse.emf.databinding.feature.group" version="1.2.0.v20100914-1218"/>
<unit id="org.eclipse.cdt.platform.feature.group" version="7.0.1.201009141542"/>
+
+<repository location="http://download.eclipse.org/mylyn/snapshots/weekly"/>
+<unit id="org.eclipse.mylyn.sdk_feature.feature.group" version="0.0.0"/>
+
<repository location="http://download.eclipse.org/egit/updates"/>
-<unit id="org.eclipse.jgit.feature.group" version="0.10.1"/>
-<repository location="http://download.eclipse.org/tools/orbit/committers/drops/S20110124210048/repository/"/>
+<unit id="org.eclipse.egit.feature.group" version="0.0.0"/>
+
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20110124210048/repository/"/>
<unit id="com.google.gwt.user" version="2.0.4.v20100709-0658"/>
<unit id="org.apache.commons.io" version="1.4.0.v20081110-1000"/>
<unit id="com.google.gson" version="1.6.0.v201101131530"/>
@@ -23,10 +28,7 @@
<unit id="com.google.gerrit.prettify" version="2.1.5.v201101181500"/>
<unit id="com.google.gerrit.reviewdb" version="2.1.5.v201101121030"/>
<unit id="com.google.gerrit.common" version="2.1.5.v201101200205"/>
-<unit id="org.eclipse.mylyn_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
-<repository location="http://download.eclipse.org/tools/mylyn/update/weekly"/>
-<unit id="org.eclipse.mylyn.bugzilla_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
-<unit id="org.eclipse.mylyn.sdk_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
+
</location>
</locations>
</target>
diff --git a/releng/reviews-target-definition/mylyn-reviews-e3.7.target b/releng/reviews-target-definition/mylyn-reviews-e3.7.target
index dcc461c9..4533cbc5 100644
--- a/releng/reviews-target-definition/mylyn-reviews-e3.7.target
+++ b/releng/reviews-target-definition/mylyn-reviews-e3.7.target
@@ -1,21 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.6"?>
-
<target name="mylyn-reviews-e3.7">
<locations>
-<location includeAllPlatforms="false" includeMode="planner" includeSource="true" type="InstallableUnit">
+<location includeAllPlatforms="true" includeMode="planner" includeSource="true" type="InstallableUnit">
+
<repository location="http://download.eclipse.org/releases/indigo"/>
-<unit id="org.eclipse.sdk.ide" version="3.7.0.I20101208-1300"/>
-<unit id="org.eclipse.emf.ecore.feature.group" version="2.7.0.v20101215-0917"/>
-<unit id="org.eclipse.emf.edit.feature.group" version="2.7.0.v20101215-0940"/>
-<unit id="org.eclipse.emf.common.feature.group" version="2.6.0.v20101215-0917"/>
-<unit id="org.eclipse.emf.databinding.feature.group" version="1.2.0.v20101215-0940"/>
-<unit id="org.eclipse.egit.feature.group" version="0.9.3"/>
-<unit id="org.eclipse.xtext.runtime.feature.group" version="1.0.1.v201008251220"/>
-<unit id="org.eclipse.cdt.platform.feature.group" version="8.0.0.201012131338"/>
+<unit id="org.eclipse.sdk.ide" version="0.0.0"/>
+<unit id="org.eclipse.emf.ecore.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.emf.edit.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.emf.common.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.emf.databinding.feature.group" version="0.0.0"/>
+<unit id="org.eclipse.cdt.platform.feature.group" version="0.0.0"/>
+
+<repository location="http://download.eclipse.org/mylyn/snapshots/weekly"/>
+<unit id="org.eclipse.mylyn.sdk_feature.feature.group" version="0.0.0"/>
+
<repository location="http://download.eclipse.org/egit/updates"/>
-<unit id="org.eclipse.jgit.feature.group" version="0.10.1"/>
-<repository location="http://download.eclipse.org/tools/orbit/committers/drops/S20110124210048/repository/"/>
+<unit id="org.eclipse.egit.feature.group" version="0.0.0"/>
+
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20110124210048/repository/"/>
<unit id="com.google.gwt.user" version="2.0.4.v20100709-0658"/>
<unit id="org.apache.commons.io" version="1.4.0.v20081110-1000"/>
<unit id="com.google.gson" version="1.6.0.v201101131530"/>
@@ -25,10 +28,7 @@
<unit id="com.google.gerrit.prettify" version="2.1.5.v201101181500"/>
<unit id="com.google.gerrit.reviewdb" version="2.1.5.v201101121030"/>
<unit id="com.google.gerrit.common" version="2.1.5.v201101200205"/>
-<unit id="org.eclipse.mylyn_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
-<repository location="http://download.eclipse.org/tools/mylyn/update/weekly"/>
-<unit id="org.eclipse.mylyn.bugzilla_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
-<unit id="org.eclipse.mylyn.sdk_feature.feature.group" version="3.5.0.I20110104-0100-e3x"/>
+
</location>
</locations>
</target>
diff --git a/tbr/org.eclipse.mylyn.reviews.tasks/feature.properties b/tbr/org.eclipse.mylyn.reviews.tasks/feature.properties
index c71c5ccb..351c3a1b 100644
--- a/tbr/org.eclipse.mylyn.reviews.tasks/feature.properties
+++ b/tbr/org.eclipse.mylyn.reviews.tasks/feature.properties
@@ -9,7 +9,7 @@
# Tasktop Technologies - initial API and implementation
###############################################################################
featureName=Task-based Reviews for Mylyn (Incubation)
-description=Provides Review functionality for Mylyn
+description=Provides code review functionality for Mylyn.
providerName=Eclipse Mylyn
copyright=Copyright (c) 2010, 2011 Research Group for Industrial Software (INSO), Vienna University of Technology and others. All rights reserved.
license=\
|
07d58c5537eb7c63194c49de7f75c79834a3f442
|
restlet-framework-java
|
Completed implementation of apispark extension.--
|
a
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/modules/org.restlet.ext.apispark/.classpath b/modules/org.restlet.ext.apispark/.classpath
index 3474bbacbd..3d20c6d659 100644
--- a/modules/org.restlet.ext.apispark/.classpath
+++ b/modules/org.restlet.ext.apispark/.classpath
@@ -3,5 +3,7 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="src" path="src"/>
<classpathentry combineaccessrules="false" exported="true" kind="src" path="/org.restlet"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.restlet.ext.jackson"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/com.fasterxml.jackson"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/modules/org.restlet.ext.apispark/module.xml b/modules/org.restlet.ext.apispark/module.xml
index ba038b1000..baaf978298 100644
--- a/modules/org.restlet.ext.apispark/module.xml
+++ b/modules/org.restlet.ext.apispark/module.xml
@@ -9,5 +9,6 @@
<dependencies>
<dependency type="module" id="core" />
+ <dependency type="module" id="jackson" />
</dependencies>
</module>
\ No newline at end of file
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Account.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Account.java
index ba445cdac4..5f4803a777 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Account.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Account.java
@@ -2,9 +2,8 @@
public class Account {
- public void createApi(Contract api){
-
- }
-
-
+ public void createApi(Contract api) {
+
+ }
+
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Body.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Body.java
index be8e207d46..d7db2bfb7f 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Body.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Body.java
@@ -3,27 +3,27 @@
public class Body {
/**
- * Reference of the representation in the body
- * of the message
- */
- private String type;
-
- /**
- * Indicates whether you should provide an array
- * of [type] or just one [type]
+ * Indicates whether you should provide an array of [type] or just one
+ * [type].
*/
private boolean array;
-
+
+ /** Reference of the representation in the body of the message. */
+ private String type;
+
public String getRepresentation() {
return type;
}
- public void setRepresentation(String representation) {
- this.type = representation;
- }
+
public boolean isArray() {
return array;
}
+
public void setArray(boolean array) {
this.array = array;
}
+
+ public void setRepresentation(String representation) {
+ this.type = representation;
+ }
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Contract.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Contract.java
index b9ad9209eb..eacc795a92 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Contract.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Contract.java
@@ -3,57 +3,50 @@
import java.util.List;
public class Contract {
-
- /**
- * Name of the API
- */
- private String name;
-
- /**
- * Textual description of the API
- */
+
+ /** Textual description of the API. */
private String description;
-
+
+ /** Name of the API. */
+ private String name;
+
/**
- * Representations available with this API
- * Note: their "name" is used as a reference further in
- * this description
+ * Representations available with this API Note: their "name" is used as a
+ * reference further in this description.
*/
private List<Representation> Representations;
-
- /**
- * Resources provided by the API
- */
+
+ /** Resources provided by the API. */
private List<Resource> resources;
+ public String getDescription() {
+ return description;
+ }
+
public String getName() {
return name;
}
- public void setName(String name) {
- this.name = name;
+ public List<Representation> getRepresentations() {
+ return Representations;
}
- public String getDescription() {
- return description;
+ public List<Resource> getResources() {
+ return resources;
}
public void setDescription(String description) {
this.description = description;
}
- public List<Representation> getRepresentations() {
- return Representations;
+ public void setName(String name) {
+ this.name = name;
}
public void setRepresentations(List<Representation> representations) {
Representations = representations;
}
- public List<Resource> getResources() {
- return resources;
- }
-
public void setResources(List<Resource> resources) {
this.resources = resources;
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Documentation.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Documentation.java
index 7ce075cafb..310e43c177 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Documentation.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Documentation.java
@@ -2,71 +2,62 @@
public class Documentation {
- /**
- * Current version of the API
- */
- private String version;
-
- /**
- * URL of the description of the license used by the API
- */
- private String license;
-
- /**
- * Base URL on which you can access the API
- * Note: will enable multiple endpoints and protocols in
- * the future (use class Endpoint in a list)
- */
- private String endpoint;
-
- /**
- * E-mail of the person to contact for further information
- * or user acces on the API
- */
+ /** Any useful information for a user that plans to access to the API. */
private String contact;
-
+
+ /** Contract of this API. */
+ private Contract contract;
+
/**
- * Contract of this API
+ * Base URL on which you can access the API<br>
+ * Note: will enable multiple endpoints and protocols in the future (use
+ * class Endpoint in a list).
*/
- private Contract contract;
+ private String endpoint;
- public String getVersion() {
- return version;
- }
+ /** URL of the description of the license used by the API. */
+ private String license;
- public void setVersion(String version) {
- this.version = version;
- }
+ /** Current version of the API. */
+ private String version;
- public String getLicense() {
- return license;
+ public String getContact() {
+ return contact;
}
- public void setLicense(String license) {
- this.license = license;
+ public Contract getContract() {
+ return contract;
}
public String getEndpoint() {
return endpoint;
}
- public void setEndpoint(String endpoint) {
- this.endpoint = endpoint;
+ public String getLicense() {
+ return license;
}
- public String getContact() {
- return contact;
+ public String getVersion() {
+ return version;
}
public void setContact(String contact) {
this.contact = contact;
}
- public Contract getContract() {
- return contract;
- }
-
public void setContract(Contract contract) {
this.contract = contract;
}
+
+ public void setEndpoint(String endpoint) {
+ this.endpoint = endpoint;
+ }
+
+ public void setLicense(String license) {
+ this.license = license;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Endpoint.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Endpoint.java
index 556b567ae6..b84d182c93 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Endpoint.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Endpoint.java
@@ -4,37 +4,36 @@
public class Endpoint {
- /**
- * Protocol used for this endpoint
- */
- private Protocol protocol;
-
- /**
- * Address of the host
- */
+ /** The host's name. */
private String host;
-
- /**
- * Port used for this endpoint
- */
- private Integer port;
-
- public Protocol getProtocol() {
- return protocol;
- }
- public void setProtocol(Protocol protocol) {
- this.protocol = protocol;
- }
+
+ /** The endpoint's port. */
+ private int port;
+
+ /** Protocol used for this endpoint. */
+ private Protocol protocol;
+
public String getHost() {
return host;
}
+
+ public int getPort() {
+ return port;
+ }
+
+ public Protocol getProtocol() {
+ return protocol;
+ }
+
public void setHost(String host) {
this.host = host;
}
- public Integer getPort() {
- return port;
- }
- public void setPort(Integer port) {
+
+ public void setPort(int port) {
this.port = port;
}
+
+ public void setProtocol(Protocol protocol) {
+ this.protocol = protocol;
+ }
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Method.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Method.java
index 27e9ad492a..431d26def3 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Method.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Method.java
@@ -1,5 +1,26 @@
package org.restlet.ext.apispark;
public class Method {
+ /** Textual description of this method. */
+ private String description;
+
+ /** Name of this method. */
+ private String name;
+
+ public String getDescription() {
+ return description;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Operation.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Operation.java
index 31863aa858..94ef0649dd 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Operation.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Operation.java
@@ -4,105 +4,107 @@
public class Operation {
- /**
- * HTTP method for this operation
- */
- private Method method;
-
- /**
- * Textual description of this operation
- */
+ /** Textual description of this operation. */
private String description;
-
+
+ /** Headers to use for this operation. */
+ private List<Parameter> headers;
+
+ /** Representation retrieved by this operation if any. */
+ private Body inRepresentation;
+
+ /** HTTP method for this operation. */
+ private Method method;
+
/**
- * Unique name for this operation
- * Note: will be used for client SDK generation in
- * the future
+ * Unique name for this operation<br>
+ * Note: will be used for client SDK generation in the future.
*/
private String name;
-
- /**
- * Representation retrieved by this operation if any
- */
- private Body inRepresentation;
-
+
/**
- * Representation to send in the body of your request
- * for this operation if any
+ * Representation to send in the body of your request for this operation if
+ * any.
*/
private Body outRepresentation;
-
- /**
- * Query parameters available for this operation
- */
- private List<Parameter> queryParameters;
-
- /**
- * Headers to use for this operation
- */
- private List<Parameter> headers;
-
- /**
- * Path variables you must provide for this operation
- */
+
+ /** ath variables you must provide for this operation. */
private List<PathVariable> pathVariables;
-
- /**
- * Possible response messages you could encounter
- */
+
+ /** Query parameters available for this operation. */
+ private List<Parameter> queryParameters;
+
+ /** Possible response messages you could encounter. */
private List<Response> responses;
-
- public Method getMethod() {
- return method;
- }
- public void setMethod(Method method) {
- this.method = method;
- }
+
public String getDescription() {
return description;
}
- public void setDescription(String description) {
- this.description = description;
- }
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
+
+ public List<Parameter> getHeaders() {
+ return headers;
}
+
public Body getInRepresentation() {
return inRepresentation;
}
- public void setInRepresentation(Body inRepresentation) {
- this.inRepresentation = inRepresentation;
+
+ public Method getMethod() {
+ return method;
}
+
+ public String getName() {
+ return name;
+ }
+
public Body getOutRepresentation() {
return outRepresentation;
}
- public void setOutRepresentation(Body outRepresentation) {
- this.outRepresentation = outRepresentation;
+
+ public List<PathVariable> getPathVariables() {
+ return pathVariables;
}
+
public List<Parameter> getQueryParameters() {
return queryParameters;
}
- public void setQueryParameters(List<Parameter> queryParameters) {
- this.queryParameters = queryParameters;
+
+ public List<Response> getResponses() {
+ return responses;
}
- public List<Parameter> getHeaders() {
- return headers;
+
+ public void setDescription(String description) {
+ this.description = description;
}
+
public void setHeaders(List<Parameter> headers) {
this.headers = headers;
}
- public List<PathVariable> getPathVariables() {
- return pathVariables;
+
+ public void setInRepresentation(Body inRepresentation) {
+ this.inRepresentation = inRepresentation;
}
+
+ public void setMethod(Method method) {
+ this.method = method;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setOutRepresentation(Body outRepresentation) {
+ this.outRepresentation = outRepresentation;
+ }
+
public void setPathVariables(List<PathVariable> pathVariables) {
this.pathVariables = pathVariables;
}
- public List<Response> getResponses() {
- return responses;
+
+ public void setQueryParameters(List<Parameter> queryParameters) {
+ this.queryParameters = queryParameters;
}
+
public void setResponses(List<Response> responses) {
this.responses = responses;
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Parameter.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Parameter.java
index 0c13d91ad4..5cffaadc06 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Parameter.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Parameter.java
@@ -5,71 +5,74 @@
public class Parameter {
/**
- * Name of the parameter
- */
- private String name;
-
- /**
- * Textual description of this parameter
- */
- private String description;
-
- /**
- * Default value of the parameter
+ * Indicates whether you can provide multiple values for this parameter or
+ * not.
*/
+ private boolean allowMultiple;
+
+ /** Default value of the parameter. */
private String defaultValue;
-
+
+ /** Textual description of this parameter. */
+ private String description;
+
+ /** Name of the parameter. */
+ private String name;
+
/**
- * List of possible values of the parameter if there
- * is a limited number of possible values for it
+ * List of possible values of the parameter if there is a limited number of
+ * possible values for it.
*/
private List<String> possibleValues;
-
- /**
- * Indicates whether the parameter is mandatory or not
- */
+
+ /** Indicates whether the parameter is mandatory or not. */
private boolean required;
-
- /**
- * Indicates whether you can provide multiple values
- * for this parameter or not
- */
- private boolean allowMultiple;
-
+
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
public String getName() {
return name;
}
- public void setName(String name) {
- this.name = name;
+
+ public List<String> getPossibleValues() {
+ return possibleValues;
}
- public String getDescription() {
- return description;
+
+ public boolean isAllowMultiple() {
+ return allowMultiple;
}
- public void setDescription(String description) {
- this.description = description;
+
+ public boolean isRequired() {
+ return required;
}
- public String getDefaultValue() {
- return defaultValue;
+
+ public void setAllowMultiple(boolean allowMultiple) {
+ this.allowMultiple = allowMultiple;
}
+
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
- public List<String> getPossibleValues() {
- return possibleValues;
+
+ public void setDescription(String description) {
+ this.description = description;
}
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
public void setPossibleValues(List<String> possibleValues) {
this.possibleValues = possibleValues;
}
- public boolean isRequired() {
- return required;
- }
+
public void setRequired(boolean required) {
this.required = required;
}
- public boolean isAllowMultiple() {
- return allowMultiple;
- }
- public void setAllowMultiple(boolean allowMultiple) {
- this.allowMultiple = allowMultiple;
- }
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/PathVariable.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/PathVariable.java
index c472f18486..12b38dc784 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/PathVariable.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/PathVariable.java
@@ -2,36 +2,21 @@
public class PathVariable {
- /**
- * Name of this variable
- */
- private String name;
-
- /**
- * Textual description of this variable
- */
- private String description;
-
- /**
- * Indicates whether you can provide a list of values
- * or just a single one
- */
+ /** Indicates whether you can provide a list of values or just a single one. */
private boolean array;
- public String getName() {
- return name;
- }
+ /** Textual description of this variable. */
+ private String description;
- public void setName(String name) {
- this.name = name;
- }
+ /** Name of this variable. */
+ private String name;
public String getDescription() {
return description;
}
- public void setDescription(String description) {
- this.description = description;
+ public String getName() {
+ return name;
}
public boolean isArray() {
@@ -41,4 +26,12 @@ public boolean isArray() {
public void setArray(boolean array) {
this.array = array;
}
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Property.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Property.java
index 888a64cd69..26da507f76 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Property.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Property.java
@@ -5,122 +5,135 @@
public class Property {
/**
- * Name ot this property
- */
- private String name;
-
- /**
- * Textual description of this property
- */
- private String description;
-
- /**
- * Type of this property, either a primitive type or
- * a reference to a representation
+ * Type of this property, either a primitive type or a reference to a
+ * representation.
*/
private String dataType;
-
+
+ // TODO review comment
/**
- * Default value if this property is of a primitive type
- * Note: need to check casts for non-String primitive
- * types
+ * Default value if this property is of a primitive type<br>
+ * Note: need to check casts for non-String primitive types
*/
private String defaultValue;
-
+
+ /** Textual description of this property. */
+ private String description;
+
+ // TODO review comment
/**
- * A list of possible values for this property if it has
- * a limited number of possible values
+ * Maximum value of this property if it is a number Note: check casts
*/
- private List<String> possibleValues;
-
+ private String max;
+
+ // TODO review comment
+ /** Maximum number of occurences of the items of this property. */
+ private Integer maxOccurs;
+
+ // TODO review comment
/**
- * Minimum value of this property if it is a number
- * Note: check casts
+ * Minimum value of this property if it is a number Note: check casts
*/
private String min;
-
+
+ // TODO review comment
+ /** Minimum number of occurences of the items of this property. */
+ private Integer minOccurs;
+
+ /** Name of this property. */
+ private String name;
+
+ // TODO review comment
/**
- * Maximum value of this property if it is a number
- * Note: check casts
+ * A list of possible values for this property if it has a limited number of
+ * possible values.
*/
- private String max;
-
+ private List<String> possibleValues;
+
+ // TODO review comment
/**
- * If maxOccurs > 1, indicates whether each item in
- * this property is supposed to be unique or not
+ * If maxOccurs > 1, indicates whether each item in this property is
+ * supposed to be unique or not
*/
private boolean uniqueItems;
-
- /**
- * Minimum number of occurences of the items of this
- * property
- */
- private Integer minOccurs;
-
- /**
- * Maximum number of occurences of the items of this
- * property
- */
- private Integer maxOccurs;
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
+
+ public String getDefaultValue() {
+ return defaultValue;
}
+
public String getDescription() {
return description;
}
- public void setDescription(String description) {
- this.description = description;
+
+ public String getMax() {
+ return max;
}
- public String getType() {
- return dataType;
+
+ public Integer getMaxOccurs() {
+ return maxOccurs;
}
- public void setType(String type) {
- this.dataType = type;
+
+ public String getMin() {
+ return min;
}
- public String getDefaultValue() {
- return defaultValue;
+
+ public Integer getMinOccurs() {
+ return minOccurs;
}
- public void setDefaultValue(String defaultValue) {
- this.defaultValue = defaultValue;
+
+ public String getName() {
+ return name;
}
+
public List<String> getPossibleValues() {
return possibleValues;
}
- public void setPossibleValues(List<String> possibleValues) {
- this.possibleValues = possibleValues;
+
+ public String getType() {
+ return dataType;
}
- public String getMin() {
- return min;
+
+ public boolean isUniqueItems() {
+ return uniqueItems;
}
- public void setMin(String min) {
- this.min = min;
+
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
}
- public String getMax() {
- return max;
+
+ public void setDescription(String description) {
+ this.description = description;
}
+
public void setMax(String max) {
this.max = max;
}
- public boolean isUniqueItems() {
- return uniqueItems;
- }
- public void setUniqueItems(boolean uniqueItems) {
- this.uniqueItems = uniqueItems;
+
+ public void setMaxOccurs(Integer maxOccurs) {
+ this.maxOccurs = maxOccurs;
}
- public Integer getMinOccurs() {
- return minOccurs;
+
+ public void setMin(String min) {
+ this.min = min;
}
+
public void setMinOccurs(Integer minOccurs) {
this.minOccurs = minOccurs;
}
- public Integer getMaxOccurs() {
- return maxOccurs;
+
+ public void setName(String name) {
+ this.name = name;
}
- public void setMaxOccurs(Integer maxOccurs) {
- this.maxOccurs = maxOccurs;
+
+ public void setPossibleValues(List<String> possibleValues) {
+ this.possibleValues = possibleValues;
+ }
+
+ public void setType(String type) {
+ this.dataType = type;
+ }
+
+ public void setUniqueItems(boolean uniqueItems) {
+ this.uniqueItems = uniqueItems;
}
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Representation.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Representation.java
index 4524407036..a2d4d780cd 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Representation.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Representation.java
@@ -4,59 +4,58 @@
public class Representation {
- /**
- * Name of the representation
- */
- private String name;
-
- /**
- * Textual description of this representation
- */
+ /** Textual description of this representation. */
private String description;
-
- /**
- * Reference to its parent type if any
- */
+
+ /** Name of the representation. */
+ private String name;
+
+ /** Reference to its parent type if any. */
private String parentType;
-
- /**
- * List of variants available for this representation
- */
- private List<Variant> variants;
-
- /**
- * List of this representation's properties
- */
+
+ /** List of this representation's properties. */
private List<Property> properties;
-
- public String getName() {
- return name;
- }
- public void setName(String name) {
- this.name = name;
- }
+
+ /** List of variants available for this representation. */
+ private List<Variant> variants;
+
public String getDescription() {
return description;
}
- public void setDescription(String description) {
- this.description = description;
+
+ public String getName() {
+ return name;
}
+
public String getParentType() {
return parentType;
}
- public void setParentType(String parentType) {
- this.parentType = parentType;
+
+ public List<Property> getProperties() {
+ return properties;
}
+
public List<Variant> getVariants() {
return variants;
}
- public void setVariants(List<Variant> variants) {
- this.variants = variants;
+
+ public void setDescription(String description) {
+ this.description = description;
}
- public List<Property> getProperties() {
- return properties;
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setParentType(String parentType) {
+ this.parentType = parentType;
}
+
public void setProperties(List<Property> properties) {
this.properties = properties;
}
+
+ public void setVariants(List<Variant> variants) {
+ this.variants = variants;
+ }
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Resource.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Resource.java
index 36f64d2597..a65bc9354e 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Resource.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Resource.java
@@ -4,55 +4,47 @@
public class Resource {
- /**
- * Name of this resource
- */
+ /** Textual description of this resource */
+ private String description;
+
+ /** Name of this resource */
private String name;
-
- /**
- * Relative path from the endpoint to this resource
- */
- private String resourcePath;
-
- /**
- * List of the APIs this resource provides
- */
+
+ /** List of the APIs this resource provides */
private List<Operation> operations;
-
- /**
- * Textual description of this resource
- */
- private String description;
+
+ /** Relative path from the endpoint to this resource */
+ private String resourcePath;
+
+ public String getDescription() {
+ return description;
+ }
public String getName() {
return name;
}
- public void setName(String name) {
- this.name = name;
+ public List<Operation> getOperations() {
+ return operations;
}
public String getResourcePath() {
return resourcePath;
}
- public void setResourcePath(String resourcePath) {
- this.resourcePath = resourcePath;
+ public void setDescription(String description) {
+ this.description = description;
}
- public List<Operation> getOperations() {
- return operations;
+ public void setName(String name) {
+ this.name = name;
}
public void setOperations(List<Operation> operations) {
this.operations = operations;
}
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
+ public void setResourcePath(String resourcePath) {
+ this.resourcePath = resourcePath;
}
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Response.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Response.java
index 20d2a3ce97..e4b50812c2 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Response.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Response.java
@@ -1,71 +1,69 @@
package org.restlet.ext.apispark;
+import org.restlet.data.Status;
+
public class Response {
- /**
- * Name of this response
- */
- private String name;
-
- /**
- * Textual description of this response
- */
+ /** Custom content of the body if any. */
+ private Body body;
+
+ /** Status code of the response */
+ private int code;
+
+ /** Textual description of this response */
private String description;
-
- /**
- * HTTP code for the response
- * See: http://fr.wikipedia.org/wiki/Liste_des_codes_HTTP
- */
- private Integer code;
-
- /**
- * Textual message associated with code in RCF
- * See: http://fr.wikipedia.org/wiki/Liste_des_codes_HTTP
- */
+
+ /** Status message of the response. */
private String message;
-
+
+ /** Name of this response */
+ private String name;
+
/**
- * Custom content of the body if any
+ * Constructor. The default status code is {@link Status#SUCCESS_OK}.
*/
- private Body body;
+ public Response() {
+ setCode(Status.SUCCESS_OK.getCode());
+ setMessage(Status.SUCCESS_OK.getDescription());
+ }
- public String getName() {
- return name;
+ public Body getBody() {
+ return body;
}
- public void setName(String name) {
- this.name = name;
+ public int getCode() {
+ return code;
}
public String getDescription() {
return description;
}
- public void setDescription(String description) {
- this.description = description;
+ public String getMessage() {
+ return message;
}
- public Integer getCode() {
- return code;
+ public String getName() {
+ return name;
+ }
+
+ public void setBody(Body body) {
+ this.body = body;
}
- public void setCode(Integer code) {
+ public void setCode(int code) {
this.code = code;
}
- public String getMessage() {
- return message;
+ public void setDescription(String description) {
+ this.description = description;
}
public void setMessage(String message) {
this.message = message;
}
- public Body getBody() {
- return body;
- }
-
- public void setBody(Body body) {
- this.body = body;
+ public void setName(String name) {
+ this.name = name;
}
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Variant.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Variant.java
index 772478d232..a302c63414 100644
--- a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Variant.java
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/Variant.java
@@ -2,29 +2,25 @@
public class Variant {
- /**
- * Textual description of this variant
- */
- private String description;
-
- /**
- * Must be a MIME type
- */
+ /** Must be a MIME type. */
private String dataType;
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
+ /** Textual description of this variant. */
+ private String description;
public String getDataType() {
return dataType;
}
+ public String getDescription() {
+ return description;
+ }
+
public void setDataType(String dataType) {
this.dataType = dataType;
}
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkApplication.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkApplication.java
new file mode 100644
index 0000000000..6d6a1766f6
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkApplication.java
@@ -0,0 +1,855 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.restlet.Application;
+import org.restlet.Component;
+import org.restlet.Context;
+import org.restlet.Request;
+import org.restlet.Response;
+import org.restlet.Restlet;
+import org.restlet.Server;
+import org.restlet.data.MediaType;
+import org.restlet.data.Method;
+import org.restlet.data.Protocol;
+import org.restlet.data.Reference;
+import org.restlet.data.Status;
+import org.restlet.engine.Engine;
+import org.restlet.representation.Representation;
+import org.restlet.representation.Variant;
+import org.restlet.resource.Directory;
+import org.restlet.resource.Finder;
+import org.restlet.resource.ServerResource;
+import org.restlet.routing.Filter;
+import org.restlet.routing.Route;
+import org.restlet.routing.Router;
+import org.restlet.routing.TemplateRoute;
+import org.restlet.routing.VirtualHost;
+
+/**
+ * APISpark enabled application. This {@link Application} subclass can describe
+ * itself in APISpark by introspecting its content. You can obtain this
+ * representation with an OPTIONS request addressed exactly to the application
+ * URI (e.g. "http://host:port/path/to/application"). By default, the returned
+ * representation gleans the list of all attached {@link ServerResource} classes
+ * and calls {@link #getName()} to get the title and {@link #getDescription()}
+ * the textual content of the APISpark document generated. This default behavior
+ * can be customized by overriding the
+ * {@link #getApplicationInfo(Request, Response)} method.<br>
+ * <br>
+ * In case you want to customize the XSLT stylesheet, you can override the
+ * {@link #createAPISparkRepresentation(ApplicationInfo)} method and return an
+ * instance of an {@link ApisparkRepresentation} subclass overriding the
+ * {@link ApisparkRepresentation#getHtmlRepresentation()} method.<br>
+ * <br>
+ * In addition, this class can create an instance and configure it with an
+ * user-provided APISpark/XML document. In this case, it creates a root
+ * {@link Router} and for each resource found in the APISpark document, it tries
+ * to attach a {@link ServerResource} class to the router using its APISpark
+ * path. For this, it looks up the qualified name of the {@link ServerResource}
+ * subclass using the APISpark's "id" attribute of the "resource" elements. This
+ * is the only Restlet specific convention on the original APISpark document.<br>
+ * <br>
+ * To attach an application configured in this way to an existing component, you
+ * can call the {@link #attachToComponent(Component)} or the
+ * {@link #attachToHost(VirtualHost)} methods. In this case, it uses the "base"
+ * attribute of the APISpark "resources" element as the URI attachment path to
+ * the virtual host.<br>
+ * <br>
+ * Concurrency note: instances of this class or its subclasses can be invoked by
+ * several threads at the same time and therefore must be thread-safe. You
+ * should be especially careful when storing state in member variables. <br>
+ *
+ * @author Jerome Louvel
+ */
+public class ApisparkApplication extends Application {
+
+ /**
+ * Indicates if the application should be automatically described via
+ * APISpark when an OPTIONS request handles a "*" target URI.
+ */
+ private volatile boolean autoDescribing;
+
+ /** The APISpark base reference. */
+ private volatile Reference baseRef;
+
+ /** The router to {@link ServerResource} classes. */
+ private volatile Router router;
+
+ /**
+ * Creates an application that can automatically introspect and expose
+ * itself as with a APISpark description upon reception of an OPTIONS
+ * request on the "*" target URI.
+ */
+ public ApisparkApplication() {
+ this((Context) null);
+ }
+
+ /**
+ * Creates an application that can automatically introspect and expose
+ * itself as with a APISpark description upon reception of an OPTIONS
+ * request on the "*" target URI.
+ *
+ * @param context
+ * The context to use based on parent component context. This
+ * context should be created using the
+ * {@link Context#createChildContext()} method to ensure a proper
+ * isolation with the other applications.
+ */
+ public ApisparkApplication(Context context) {
+ super(context);
+ this.autoDescribing = true;
+ }
+
+ /**
+ * Creates an application described using a APISpark document. Creates a
+ * router where Resource classes are attached and set it as the root
+ * Restlet.
+ *
+ * By default the application is not automatically described. If you want
+ * to, you can call {@link #setAutoDescribing(boolean)}.
+ *
+ * @param context
+ * The context to use based on parent component context. This
+ * context should be created using the
+ * {@link Context#createChildContext()} method to ensure a proper
+ * isolation with the other applications.
+ * @param apispark
+ * The APISpark description document.
+ */
+ public ApisparkApplication(Context context, Representation apispark) {
+ super(context);
+ this.autoDescribing = false;
+
+ try {
+ // Instantiates a APISparkRepresentation of the APISpark document
+ ApisparkRepresentation apisparkRep = null;
+
+ if (apispark instanceof ApisparkRepresentation) {
+ apisparkRep = (ApisparkRepresentation) apispark;
+ } else {
+ // TODO to be done
+ // apisparkRep = new APISparkRepresentation(apispark);
+ }
+
+ final Router root = new Router(getContext());
+ this.router = root;
+ setInboundRoot(root);
+
+ if (apisparkRep.getApplication() != null) {
+ if (apisparkRep.getApplication().getResources() != null) {
+ for (final ResourceInfo resource : apisparkRep
+ .getApplication().getResources().getResources()) {
+ attachResource(resource, null, this.router);
+ }
+
+ // Analyzes the APISpark resources base
+ setBaseRef(apisparkRep.getApplication().getResources()
+ .getBaseRef());
+ }
+
+ // Set the name of the application as the title of the first
+ // documentation tag.
+ if (!apisparkRep.getApplication().getDocumentations().isEmpty()) {
+ setName(apisparkRep.getApplication().getDocumentations()
+ .get(0).getTitle());
+ }
+ }
+ } catch (Exception e) {
+ getLogger().log(Level.WARNING,
+ "Error during the attachment of the APISpark application",
+ e);
+ }
+ }
+
+ /**
+ * Creates an application described using a APISpark document. Creates a
+ * router where Resource classes are attached and set it as the root
+ * Restlet.
+ *
+ * By default the application is not automatically described. If you want
+ * to, you can call {@link #setAutoDescribing(boolean)}.
+ *
+ * @param apispark
+ * The APISpark description document.
+ */
+ public ApisparkApplication(Representation apispark) {
+ this(null, apispark);
+ }
+
+ /**
+ * Adds the necessary server connectors to the component.
+ *
+ * @param component
+ * The parent component to update.
+ */
+ private void addConnectors(Component component) {
+ // Create the server connector
+ Protocol protocol = getBaseRef().getSchemeProtocol();
+ int port = getBaseRef().getHostPort();
+ boolean exists = false;
+
+ if (port == -1) {
+ for (Server server : component.getServers()) {
+ if (server.getProtocols().contains(protocol)
+ && (server.getPort() == protocol.getDefaultPort())) {
+ exists = true;
+ }
+ }
+
+ if (!exists) {
+ component.getServers().add(protocol);
+ }
+ } else {
+ for (Server server : component.getServers()) {
+ if (server.getProtocols().contains(protocol)
+ && (server.getPort() == port)) {
+ exists = true;
+ }
+ }
+
+ if (!exists) {
+ component.getServers().add(protocol, port);
+ }
+ }
+ }
+
+ /**
+ * Represents the resource as a APISpark description.
+ *
+ * @param request
+ * The current request.
+ * @param response
+ * The current response.
+ * @return The APISpark description.
+ */
+ protected Representation apisparkRepresent(Request request,
+ Response response) {
+ return apisparkRepresent(getPreferredAPISparkVariant(request), request,
+ response);
+ }
+
+ /**
+ * Represents the resource as a APISpark description for the given variant.
+ *
+ * @param variant
+ * The APISpark variant.
+ * @param request
+ * The current request.
+ * @param response
+ * The current response.
+ * @return The APISpark description.
+ */
+ protected Representation apisparkRepresent(Variant variant,
+ Request request, Response response) {
+ Representation result = null;
+
+ if (variant != null) {
+ ApplicationInfo applicationInfo = getApplicationInfo(request,
+ response);
+ DocumentationInfo doc = null;
+
+ if ((getName() != null) && !"".equals(getName())) {
+ if (applicationInfo.getDocumentations().isEmpty()) {
+ doc = new DocumentationInfo();
+ applicationInfo.getDocumentations().add(doc);
+ } else {
+ doc = applicationInfo.getDocumentations().get(0);
+ }
+
+ doc.setTitle(getName());
+ }
+
+ if ((doc != null) && (getDescription() != null)
+ && !"".equals(getDescription())) {
+ doc.setTextContent(getDescription());
+ }
+
+ if (MediaType.APPLICATION_JSON.equals(variant.getMediaType())) {
+ result = createAPISparkRepresentation(applicationInfo);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Attaches a resource, as specified in a APISpark document, to a specified
+ * router, then recursively attaches its child resources.
+ *
+ * @param currentResource
+ * The resource to attach.
+ * @param parentResource
+ * The parent resource. Needed to correctly resolve the "path" of
+ * the resource. Should be null if the resource is root-level.
+ * @param router
+ * The router to which to attach the resource and its children.
+ * @throws ClassNotFoundException
+ * If the class name specified in the "id" attribute of the
+ * resource does not exist, this exception will be thrown.
+ */
+ private void attachResource(ResourceInfo currentResource,
+ ResourceInfo parentResource, Router router)
+ throws ClassNotFoundException {
+
+ String uriPattern = currentResource.getPath();
+
+ // If there is a parentResource, add its uriPattern to this one
+ if (parentResource != null) {
+ String parentUriPattern = parentResource.getPath();
+
+ if ((parentUriPattern.endsWith("/") == false)
+ && (uriPattern.startsWith("/") == false)) {
+ parentUriPattern += "/";
+ }
+
+ uriPattern = parentUriPattern + uriPattern;
+ currentResource.setPath(uriPattern);
+ } else if (!uriPattern.startsWith("/")) {
+ uriPattern = "/" + uriPattern;
+ currentResource.setPath(uriPattern);
+ }
+
+ Finder finder = createFinder(router, uriPattern, currentResource);
+
+ if (finder != null) {
+ // Attach the resource itself
+ router.attach(uriPattern, finder);
+ }
+
+ // Attach children of the resource
+ for (ResourceInfo childResource : currentResource.getChildResources()) {
+ attachResource(childResource, currentResource, router);
+ }
+ }
+
+ /**
+ * Attaches the application to the given component if the application has a
+ * APISpark base reference. The application will be attached to an existing
+ * virtual host if possible, otherwise a new one will be created.
+ *
+ * @param component
+ * The parent component to update.
+ * @return The parent virtual host.
+ */
+ public VirtualHost attachToComponent(Component component) {
+ VirtualHost result = null;
+
+ if (getBaseRef() != null) {
+ // Create the virtual host
+ result = getVirtualHost(component);
+
+ // Attach the application to the virtual host
+ attachToHost(result);
+
+ // Adds the necessary server connectors
+ addConnectors(component);
+ } else {
+ getLogger()
+ .warning(
+ "The APISpark application has no base reference defined. Unable to guess the virtual host.");
+ }
+
+ return result;
+ }
+
+ /**
+ * Attaches the application to the given host using the APISpark base
+ * reference.
+ *
+ * @param host
+ * The virtual host to attach to.
+ */
+ public void attachToHost(VirtualHost host) {
+ if (getBaseRef() != null) {
+ final String path = getBaseRef().getPath();
+ if (path == null) {
+ host.attach("", this);
+ } else {
+ host.attach(path, this);
+ }
+
+ } else {
+ getLogger()
+ .warning(
+ "The APISpark application has no base reference defined. Unable to guess the virtual host.");
+ }
+ }
+
+ /**
+ * Indicates if the application and all its resources can be described using
+ * APISpark.
+ *
+ * @param remainingPart
+ * The URI remaining part.
+ * @param request
+ * The request to handle.
+ * @param response
+ * The response to update.
+ */
+ protected boolean canDescribe(String remainingPart, Request request,
+ Response response) {
+ return isAutoDescribing()
+ && Method.OPTIONS.equals(request.getMethod())
+ && (response.getStatus().isClientError() || !response
+ .isEntityAvailable())
+ && ("/".equals(remainingPart) || "".equals(remainingPart));
+ }
+
+ /**
+ * Creates a new APISpark representation for a given {@link ApplicationInfo}
+ * instance describing an application.
+ *
+ * @param applicationInfo
+ * The application description.
+ * @return The created {@link ApisparkRepresentation}.
+ */
+ protected Representation createAPISparkRepresentation(
+ ApplicationInfo applicationInfo) {
+ return new ApisparkRepresentation(applicationInfo);
+ }
+
+ /**
+ * Creates a finder for the given resource info. By default, it looks up for
+ * an "id" attribute containing a fully qualified class name.
+ *
+ * @param router
+ * The parent router.
+ * @param resourceInfo
+ * The APISpark resource descriptor.
+ * @return The created finder.
+ * @throws ClassNotFoundException
+ */
+ @SuppressWarnings("unchecked")
+ protected Finder createFinder(Router router, String uriPattern,
+ ResourceInfo resourceInfo) throws ClassNotFoundException {
+ Finder result = null;
+
+ if (resourceInfo.getIdentifier() != null) {
+ // The "id" attribute conveys the target class name
+ Class<? extends ServerResource> targetClass = (Class<? extends ServerResource>) Engine
+ .loadClass(resourceInfo.getIdentifier());
+ result = router.createFinder(targetClass);
+ } else {
+ getLogger()
+ .fine("Unable to find the 'id' attribute of the resource element with this path attribute \""
+ + uriPattern + "\"");
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the available APISpark variants.
+ *
+ * @return The available APISpark variants.
+ */
+ protected List<Variant> getAPISparkVariants() {
+ final List<Variant> result = new ArrayList<Variant>();
+ result.add(new Variant(MediaType.APPLICATION_JSON));
+ result.add(new Variant(MediaType.APPLICATION_XML));
+ result.add(new Variant(MediaType.TEXT_XML));
+ return result;
+ }
+
+ /**
+ * Returns a APISpark description of the current application. By default,
+ * this method discovers all the resources attached to this application. It
+ * can be overridden to add documentation, list of representations, etc.
+ *
+ * @param request
+ * The current request.
+ * @param response
+ * The current response.
+ * @return An application description.
+ */
+ protected ApplicationInfo getApplicationInfo(Request request,
+ Response response) {
+ ApplicationInfo applicationInfo = new ApplicationInfo();
+ applicationInfo.getResources().setBaseRef(
+ request.getResourceRef().getBaseRef());
+ applicationInfo.getResources().setResources(
+ getResourceInfos(applicationInfo,
+ getNextRouter(getInboundRoot()), request, response));
+ return applicationInfo;
+ }
+
+ /**
+ * Returns the APISpark base reference.
+ *
+ * @return The APISpark base reference.
+ */
+ public Reference getBaseRef() {
+ return this.baseRef;
+ }
+
+ /**
+ * Returns the next router available.
+ *
+ * @param current
+ * The current Restlet to inspect.
+ * @return The first router available.
+ */
+ private Router getNextRouter(Restlet current) {
+ Router result = getRouter();
+
+ if (result == null) {
+ if (current instanceof Router) {
+ result = (Router) current;
+ } else if (current instanceof Filter) {
+ result = getNextRouter(((Filter) current).getNext());
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the preferred APISpark variant according to the client
+ * preferences specified in the request.
+ *
+ * @param request
+ * The request including client preferences.
+ * @return The preferred APISpark variant.
+ */
+ protected Variant getPreferredAPISparkVariant(Request request) {
+ return getConnegService().getPreferredVariant(getAPISparkVariants(),
+ request, getMetadataService());
+ }
+
+ /**
+ * Completes the data available about a given Filter instance.
+ *
+ * @param applicationInfo
+ * The parent application.
+ * @param filter
+ * The Filter instance to document.
+ * @param path
+ * The base path.
+ * @param request
+ * The current request.
+ * @param response
+ * The current response.
+ * @return The resource description.
+ */
+ private ResourceInfo getResourceInfo(ApplicationInfo applicationInfo,
+ Filter filter, String path, Request request, Response response) {
+ return getResourceInfo(applicationInfo, filter.getNext(), path,
+ request, response);
+ }
+
+ /**
+ * Completes the data available about a given Finder instance.
+ *
+ * @param applicationInfo
+ * The parent application.
+ * @param resourceInfo
+ * The ResourceInfo object to complete.
+ * @param finder
+ * The Finder instance to document.
+ * @param request
+ * The current request.
+ * @param response
+ * The current response.
+ */
+ private ResourceInfo getResourceInfo(ApplicationInfo applicationInfo,
+ Finder finder, String path, Request request, Response response) {
+ ResourceInfo result = null;
+ Object resource = null;
+
+ // Save the current application
+ Application.setCurrent(this);
+
+ if (finder instanceof Directory) {
+ resource = finder;
+ } else {
+ // The handler instance targeted by this finder.
+ ServerResource sr = finder.find(request, response);
+
+ if (sr != null) {
+ sr.init(getContext(), request, response);
+ sr.updateAllowedMethods();
+ resource = sr;
+ }
+ }
+
+ if (resource != null) {
+ result = new ResourceInfo();
+ ResourceInfo.describe(applicationInfo, result, resource, path);
+ }
+
+ return result;
+ }
+
+ /**
+ * Completes the data available about a given Restlet instance.
+ *
+ * @param applicationInfo
+ * The parent application.
+ * @param resourceInfo
+ * The ResourceInfo object to complete.
+ * @param restlet
+ * The Restlet instance to document.
+ * @param request
+ * The current request.
+ * @param response
+ * The current response.
+ */
+ private ResourceInfo getResourceInfo(ApplicationInfo applicationInfo,
+ Restlet restlet, String path, Request request, Response response) {
+ ResourceInfo result = null;
+
+ if (restlet instanceof ApisparkDescribable) {
+ result = ((ApisparkDescribable) restlet)
+ .getResourceInfo(applicationInfo);
+ result.setPath(path);
+ } else if (restlet instanceof Finder) {
+ result = getResourceInfo(applicationInfo, (Finder) restlet, path,
+ request, response);
+ } else if (restlet instanceof Router) {
+ result = new ResourceInfo();
+ result.setPath(path);
+ result.setChildResources(getResourceInfos(applicationInfo,
+ (Router) restlet, request, response));
+ } else if (restlet instanceof Filter) {
+ result = getResourceInfo(applicationInfo, (Filter) restlet, path,
+ request, response);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the APISpark data about the given Route instance.
+ *
+ * @param applicationInfo
+ * The parent application.
+ * @param route
+ * The Route instance to document.
+ * @param basePath
+ * The base path.
+ * @param request
+ * The current request.
+ * @param response
+ * The current response.
+ * @return The APISpark data about the given Route instance.
+ */
+ private ResourceInfo getResourceInfo(ApplicationInfo applicationInfo,
+ Route route, String basePath, Request request, Response response) {
+ ResourceInfo result = null;
+
+ if (route instanceof TemplateRoute) {
+ TemplateRoute templateRoute = (TemplateRoute) route;
+ String path = templateRoute.getTemplate().getPattern();
+
+ // APISpark requires resource paths to be relative to parent path
+ if (path.startsWith("/") && basePath.endsWith("/")) {
+ path = path.substring(1);
+ }
+
+ result = getResourceInfo(applicationInfo, route.getNext(), path,
+ request, response);
+ }
+
+ return result;
+ }
+
+ /**
+ * Completes the list of ResourceInfo instances for the given Router
+ * instance.
+ *
+ * @param applicationInfo
+ * The parent application.
+ * @param router
+ * The router to document.
+ * @param request
+ * The current request.
+ * @param response
+ * The current response.
+ * @return The list of ResourceInfo instances to complete.
+ */
+ private List<ResourceInfo> getResourceInfos(
+ ApplicationInfo applicationInfo, Router router, Request request,
+ Response response) {
+ List<ResourceInfo> result = new ArrayList<ResourceInfo>();
+
+ for (Route route : router.getRoutes()) {
+ ResourceInfo resourceInfo = getResourceInfo(applicationInfo, route,
+ "/", request, response);
+
+ if (resourceInfo != null) {
+ result.add(resourceInfo);
+ }
+ }
+
+ if (router.getDefaultRoute() != null) {
+ ResourceInfo resourceInfo = getResourceInfo(applicationInfo,
+ router.getDefaultRoute(), "/", request, response);
+ if (resourceInfo != null) {
+ result.add(resourceInfo);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the router where the {@link ServerResource} classes created from
+ * the APISpark description document are attached.
+ *
+ * @return The root router.
+ */
+ public Router getRouter() {
+ return this.router;
+ }
+
+ /**
+ * Returns the virtual host matching the APISpark application's base
+ * reference. Creates a new one and attaches it to the component if
+ * necessary.
+ *
+ * @param component
+ * The parent component.
+ * @return The related virtual host.
+ */
+ private VirtualHost getVirtualHost(Component component) {
+ // Create the virtual host if necessary
+ final String hostDomain = this.baseRef.getHostDomain();
+ final String hostPort = Integer.toString(this.baseRef.getHostPort());
+ final String hostScheme = this.baseRef.getScheme();
+
+ VirtualHost host = null;
+ for (final VirtualHost vh : component.getHosts()) {
+ if (vh.getHostDomain().equals(hostDomain)
+ && vh.getHostPort().equals(hostPort)
+ && vh.getHostScheme().equals(hostScheme)) {
+ host = vh;
+ }
+ }
+
+ if (host == null) {
+ // A new virtual host needs to be created
+ host = new VirtualHost(component.getContext().createChildContext());
+ host.setHostDomain(hostDomain);
+ host.setHostPort(hostPort);
+ host.setHostScheme(hostScheme);
+ component.getHosts().add(host);
+ }
+
+ return host;
+ }
+
+ /**
+ * Handles the requests normally in all cases then handles the special case
+ * of the OPTIONS requests that exactly target the application. In this
+ * case, the application is automatically introspected and described as a
+ * APISpark representation based on the result of the
+ * {@link #getApplicationInfo(Request, Response)} method.<br>
+ * The automatic introspection happens only if the request hasn't already
+ * been successfully handled. That is to say, it lets users provide their
+ * own handling of OPTIONS requests.
+ *
+ * @param request
+ * The request to handle.
+ * @param response
+ * The response to update.
+ */
+ @Override
+ public void handle(Request request, Response response) {
+ // Preserve the resource reference.
+ Reference rr = request.getResourceRef().clone();
+
+ // Do the regular handling
+ super.handle(request, response);
+
+ // Restore the resource reference
+ request.setResourceRef(rr);
+
+ // Handle OPTIONS requests.
+ String rp = rr.getRemainingPart(false, false);
+
+ if (canDescribe(rp, request, response)) {
+ // Make sure that the base of the "resources" element ends with a
+ // "/".
+ if (!rr.getBaseRef().getIdentifier().endsWith("/")) {
+ rr.setBaseRef(rr.getBaseRef() + "/");
+ }
+
+ // Returns a APISpark representation of the application.
+ response.setEntity(apisparkRepresent(request, response));
+
+ if (response.isEntityAvailable()) {
+ response.setStatus(Status.SUCCESS_OK);
+ }
+ }
+ }
+
+ /**
+ * Indicates if the application should be automatically described via
+ * APISpark when an OPTIONS request handles a "*" target URI.
+ *
+ * @return True if the application should be automatically described via
+ * APISpark.
+ */
+ public boolean isAutoDescribing() {
+ return autoDescribing;
+ }
+
+ /**
+ * Indicates if the application should be automatically described via
+ * APISpark when an OPTIONS request handles a "*" target URI.
+ *
+ * @param autoDescribed
+ * True if the application should be automatically described via
+ * APISpark.
+ */
+ public void setAutoDescribing(boolean autoDescribed) {
+ this.autoDescribing = autoDescribed;
+ }
+
+ /**
+ * Sets the APISpark base reference.
+ *
+ * @param baseRef
+ * The APISpark base reference.
+ */
+ public void setBaseRef(Reference baseRef) {
+ this.baseRef = baseRef;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkComponent.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkComponent.java
new file mode 100644
index 0000000000..0dd6b985b1
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkComponent.java
@@ -0,0 +1,176 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import org.restlet.Component;
+import org.restlet.Request;
+import org.restlet.Response;
+import org.restlet.data.Method;
+import org.restlet.data.Reference;
+import org.restlet.representation.Representation;
+
+/**
+ * Component that can configure itself given a APISpark document. First, it
+ * creates the server connectors and the virtual hosts if needed, trying to
+ * reuse existing ones if available. Then it creates a
+ * {@link ApisparkApplication} using this
+ * {@link ApisparkApplication#APISparkApplication(Representation)} constructor.<br>
+ * <br>
+ * Concurrency note: instances of this class or its subclasses can be invoked by
+ * several threads at the same time and therefore must be thread-safe. You
+ * should be especially careful when storing state in member variables.
+ *
+ * @author Jerome Louvel
+ */
+public class ApisparkComponent extends Component {
+
+ /**
+ * Main method capable of configuring and starting a whole Restlet Component
+ * based on a list of local APISpark documents URIs, for example
+ * "file:///C:/YahooSearch.apispark".<br>
+ * <br>
+ * The necessary client connectors are automatically created.
+ *
+ * @param args
+ * List of local APISpark document URIs.
+ * @throws Exception
+ */
+ public static void main(String[] args) throws Exception {
+ // Create a new APISpark-aware component
+ final ApisparkComponent component = new ApisparkComponent();
+
+ // For each APISpark document URI attach a matching Application
+ for (final String arg : args) {
+ component.attach(arg);
+ }
+
+ // Start the component
+ component.start();
+ }
+
+ /**
+ * Default constructor.
+ */
+ public ApisparkComponent() {
+ }
+
+ /**
+ * Constructor loading a APISpark description document at a given URI.<br>
+ * <br>
+ * The necessary client connectors are automatically created.
+ *
+ * @param apisparkRef
+ * The URI reference to the APISpark description document.
+ */
+ public ApisparkComponent(Reference apisparkRef) {
+ attach(apisparkRef);
+ }
+
+ /**
+ * Constructor based on a given APISpark description document.
+ *
+ * @param apispark
+ * The APISpark description document.
+ */
+ public ApisparkComponent(Representation apispark) {
+ attach(apispark);
+ }
+
+ /**
+ * Constructor loading a APISpark description document at a given URI.<br>
+ * <br>
+ * The necessary client connectors are automatically created.
+ *
+ * @param apisparkUri
+ * The URI to the APISpark description document.
+ */
+ public ApisparkComponent(String apisparkUri) {
+ attach(apisparkUri);
+ }
+
+ /**
+ * Attaches an application created from a APISpark description document
+ * available at a given URI reference.
+ *
+ * @param apisparkRef
+ * The URI reference to the APISpark description document.
+ * @return The created APISpark application.
+ */
+ public ApisparkApplication attach(Reference apisparkRef) {
+ ApisparkApplication result = null;
+
+ // Adds some common client connectors to load the APISpark documents
+ if (!getClients().contains(apisparkRef.getSchemeProtocol())) {
+ getClients().add(apisparkRef.getSchemeProtocol());
+ }
+
+ // Get the APISpark document
+ final Response response = getContext().getClientDispatcher().handle(
+ new Request(Method.GET, apisparkRef));
+
+ if (response.getStatus().isSuccess() && response.isEntityAvailable()) {
+ result = attach(response.getEntity());
+ }
+
+ return result;
+ }
+
+ /**
+ * Attaches an application created from a APISpark description document to
+ * the component.
+ *
+ * @param apispark
+ * The APISpark description document.
+ * @return The created APISpark application.
+ */
+ public ApisparkApplication attach(Representation apispark) {
+ final ApisparkApplication result = new ApisparkApplication(getContext()
+ .createChildContext(), apispark);
+ result.attachToComponent(this);
+ return result;
+ }
+
+ /**
+ * Attaches an application created from a APISpark description document
+ * available at a given URI.
+ *
+ * @param apisparkUri
+ * The URI to the APISpark description document.
+ * @return The created APISpark application.
+ */
+ public ApisparkApplication attach(String apisparkUri) {
+ return attach(new Reference(apisparkUri));
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkConverter.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkConverter.java
new file mode 100644
index 0000000000..76479f8c63
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkConverter.java
@@ -0,0 +1,141 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.io.IOException;
+import java.util.List;
+
+import org.restlet.data.MediaType;
+import org.restlet.data.Preference;
+import org.restlet.engine.converter.ConverterHelper;
+import org.restlet.engine.resource.VariantInfo;
+import org.restlet.representation.Representation;
+import org.restlet.representation.Variant;
+import org.restlet.resource.Resource;
+
+/**
+ * A converter helper to convert between {@link ApplicationInfo} objects and
+ * {@link ApisparkRepresentation} ones.
+ *
+ * @author Thierry Boileau
+ */
+public class ApisparkConverter extends ConverterHelper {
+
+ private static final VariantInfo VARIANT_APPLICATION_SWAGGER = new VariantInfo(
+ MediaType.APPLICATION_JSON);
+
+ @Override
+ public List<Class<?>> getObjectClasses(Variant source) {
+ List<Class<?>> result = null;
+
+ if (VARIANT_APPLICATION_SWAGGER.includes(source)) {
+ result = addObjectClass(result, ApplicationInfo.class);
+ }
+
+ return result;
+ }
+
+ @Override
+ public List<VariantInfo> getVariants(Class<?> source) {
+ List<VariantInfo> result = null;
+
+ if (ApplicationInfo.class.isAssignableFrom(source)) {
+ result = addVariant(result, VARIANT_APPLICATION_SWAGGER);
+ }
+
+ return result;
+ }
+
+ @Override
+ public float score(Object source, Variant target, Resource resource) {
+ if (source instanceof ApplicationInfo) {
+ return 1.0f;
+ }
+
+ return -1.0f;
+ }
+
+ @Override
+ public <T> float score(Representation source, Class<T> target,
+ Resource resource) {
+ float result = -1.0F;
+
+ if ((source != null)
+ && (ApplicationInfo.class.isAssignableFrom(target))) {
+ result = 1.0F;
+ }
+
+ return result;
+ }
+
+ @Override
+ public <T> T toObject(Representation source, Class<T> target,
+ Resource resource) throws IOException {
+ ApisparkRepresentation apisparkSource = null;
+ if (source instanceof ApisparkRepresentation) {
+ apisparkSource = (ApisparkRepresentation) source;
+ } else {
+ // TODO
+ // apisparkSource = new APISparkRepresentation(source);
+ }
+
+ T result = null;
+ if (target != null) {
+ if (ApplicationInfo.class.isAssignableFrom(target)) {
+ result = target.cast(apisparkSource.getApplication());
+ }
+ }
+
+ return result;
+ }
+
+ @Override
+ public Representation toRepresentation(Object source, Variant target,
+ Resource resource) throws IOException {
+ if (source instanceof ApplicationInfo) {
+ return new ApisparkRepresentation((ApplicationInfo) source);
+ }
+
+ return null;
+ }
+
+ @Override
+ public <T> void updatePreferences(List<Preference<MediaType>> preferences,
+ Class<T> entity) {
+ if (ApplicationInfo.class.isAssignableFrom(entity)) {
+ updatePreferences(preferences, MediaType.APPLICATION_JSON, 1.0F);
+ updatePreferences(preferences, MediaType.APPLICATION_XML, 0.9F);
+ }
+ }
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkDescribable.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkDescribable.java
new file mode 100644
index 0000000000..6de8f3a68d
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkDescribable.java
@@ -0,0 +1,60 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import org.restlet.resource.Directory;
+import org.restlet.resource.ServerResource;
+
+/**
+ * Interface that any Restlet can implement in order to provide their own
+ * APISpark documentation. This is especially useful for subclasses of
+ * {@link Directory} or other resource finders when the APISpark introspection
+ * can't reach {@link ServerResource} or better {@link ApisparkServerResource}
+ * instances.
+ *
+ * @author Thierry Boileau
+ */
+public interface ApisparkDescribable {
+
+ /**
+ * Returns a full documented {@link ResourceInfo} instance.
+ *
+ * @param applicationInfo
+ * The parent APISpark application descriptor.
+ *
+ * @return A full documented {@link ResourceInfo} instance.
+ */
+ public ResourceInfo getResourceInfo(ApplicationInfo applicationInfo);
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkRepresentation.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkRepresentation.java
new file mode 100644
index 0000000000..2a5750efde
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkRepresentation.java
@@ -0,0 +1,311 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.restlet.Server;
+import org.restlet.data.Protocol;
+import org.restlet.data.Status;
+import org.restlet.engine.Engine;
+import org.restlet.engine.connector.ConnectorHelper;
+import org.restlet.ext.apispark.Body;
+import org.restlet.ext.apispark.Contract;
+import org.restlet.ext.apispark.Documentation;
+import org.restlet.ext.apispark.Method;
+import org.restlet.ext.apispark.Operation;
+import org.restlet.ext.apispark.Parameter;
+import org.restlet.ext.apispark.PathVariable;
+import org.restlet.ext.apispark.Property;
+import org.restlet.ext.apispark.Representation;
+import org.restlet.ext.apispark.Resource;
+import org.restlet.ext.apispark.Response;
+import org.restlet.ext.apispark.Variant;
+import org.restlet.ext.jackson.JacksonRepresentation;
+
+/**
+ * Root of a APISpark description document.<br>
+ *
+ * @author Jerome Louvel
+ */
+public class ApisparkRepresentation extends
+ JacksonRepresentation<Documentation> {
+
+ private static Documentation toDocumentation(ApplicationInfo application) {
+ Documentation result = null;
+ if (application != null) {
+ result = new Documentation();
+ result.setVersion(application.getVersion());
+
+ Contract contract = new Contract();
+ result.setContract(contract);
+ contract.setDescription(toString(application.getDocumentations()));
+ contract.setName(application.getName());
+
+ // List of representations.
+ contract.setRepresentations(new ArrayList<Representation>());
+ for (RepresentationInfo ri : application.getRepresentations()) {
+ Representation rep = new Representation();
+
+ // TODO analyze
+ // The models differ : one representation / one variant for
+ // Restlet
+ // one representation / several variants for APIspark
+ rep.setDescription(toString(ri.getDocumentations()));
+ rep.setName(ri.getIdentifier());
+ Variant variant = new Variant();
+ variant.setDataType(ri.getMediaType().getName());
+ rep.setVariants(new ArrayList<Variant>());
+ rep.getVariants().add(variant);
+
+ rep.setProperties(new ArrayList<Property>());
+ for (int i = 0; i < ri.getParameters().size(); i++) {
+ ParameterInfo pi = ri.getParameters().get(i);
+
+ Property property = new Property();
+ property.setName(pi.getName());
+ property.setDescription(toString(pi.getDocumentations()));
+ property.setType(pi.getType());
+
+ rep.getProperties().add(property);
+ }
+
+ contract.getRepresentations().add(rep);
+ }
+
+ // List of resources.
+ // TODO Resource path/basePath?
+ contract.setResources(new ArrayList<Resource>());
+ for (ResourceInfo ri : application.getResources().getResources()) {
+
+ Resource resource = new Resource();
+ resource.setDescription(toString(ri.getDocumentations()));
+ resource.setName(ri.getIdentifier());
+ resource.setResourcePath(ri.getPath());
+
+ resource.setOperations(new ArrayList<Operation>());
+ int i = 0;
+ for (MethodInfo mi : ri.getMethods()) {
+
+ Operation operation = new Operation();
+ operation.setDescription(toString(mi.getDocumentations()));
+ operation.setName(mi.getName().getName());
+ // TODO complete Method class with mi.getName()
+ operation.setMethod(new Method());
+ operation.getMethod().setDescription(mi.getName().getDescription());
+ operation.getMethod().setName(mi.getName().getName());
+
+ // Complete parameters
+ operation.setHeaders(new ArrayList<Parameter>());
+ operation.setPathVariables(new ArrayList<PathVariable>());
+ operation.setQueryParameters(new ArrayList<Parameter>());
+ if (mi.getRequest() != null
+ && mi.getRequest().getParameters() != null) {
+ for (ParameterInfo pi : mi.getRequest().getParameters()) {
+ if (ParameterStyle.HEADER.equals(pi.getStyle())) {
+ Parameter parameter = new Parameter();
+ parameter.setAllowMultiple(pi.isRepeating());
+ parameter.setDefaultValue(pi.getDefaultValue());
+ parameter.setDescription(toString(pi
+ .getDocumentations()));
+ parameter.setName(pi.getName());
+ parameter
+ .setPossibleValues(new ArrayList<String>());
+ parameter.setRequired(pi.isRequired());
+
+ operation.getHeaders().add(parameter);
+ } else if (ParameterStyle.TEMPLATE.equals(pi
+ .getStyle())) {
+ PathVariable pathVariable = new PathVariable();
+
+ pathVariable.setDescription(toString(pi
+ .getDocumentations()));
+ pathVariable.setName(pi.getName());
+
+ operation.getPathVariables().add(pathVariable);
+ } else if (ParameterStyle.QUERY.equals(pi
+ .getStyle())) {
+ Parameter parameter = new Parameter();
+ parameter.setAllowMultiple(pi.isRepeating());
+ parameter.setDefaultValue(pi.getDefaultValue());
+ parameter.setDescription(toString(pi
+ .getDocumentations()));
+ parameter.setName(pi.getName());
+ parameter
+ .setPossibleValues(new ArrayList<String>());
+ parameter.setRequired(pi.isRequired());
+
+ operation.getHeaders().add(parameter);
+ }
+ }
+ }
+
+ if (mi.getRequest() != null
+ && mi.getRequest().getRepresentations() != null
+ && !mi.getRequest().getRepresentations().isEmpty()) {
+ Body body = new Body();
+ // TODO analyze
+ // The models differ : one representation / one variant
+ // for Restlet one representation / several variants for
+ // APIspark
+ body.setRepresentation(mi.getRequest()
+ .getRepresentations().get(0).getIdentifier());
+
+ operation.setInRepresentation(body);
+ }
+
+ if (mi.getResponses() != null
+ && !mi.getResponses().isEmpty()) {
+ operation.setResponses(new ArrayList<Response>());
+
+ Body body = new Body();
+ // TODO analyze
+ // The models differ : one representation / one variant
+ // for Restlet one representation / several variants for
+ // APIspark
+
+ operation.setOutRepresentation(body);
+
+ for (ResponseInfo rio : mi.getResponses()) {
+ if (!rio.getStatuses().isEmpty()) {
+ Status status = rio.getStatuses().get(0);
+ // TODO analyze
+ // The models differ : one representation / one variant
+ // for Restlet one representation / several variants for
+ // APIspark
+
+ Response response = new Response();
+ response.setBody(body);
+ response.setCode(status.getCode());
+ response.setDescription(toString(rio.getDocumentations()));
+ response.setMessage(status.getDescription());
+ //response.setName();
+
+ operation.getResponses().add(response);
+ }
+ }
+ }
+
+ resource.getOperations().add(operation);
+ }
+
+ contract.getResources().add(resource);
+ }
+
+ java.util.List<String> protocols = new ArrayList<String>();
+ for (ConnectorHelper<Server> helper : Engine.getInstance()
+ .getRegisteredServers()) {
+ for (Protocol protocol : helper.getProtocols()) {
+ if (!protocols.contains(protocol.getName())) {
+ protocols.add(protocol.getName());
+ }
+ }
+ }
+
+ }
+ return result;
+ }
+
+ private static String toString(List<DocumentationInfo> di) {
+ StringBuilder d = new StringBuilder();
+ for (DocumentationInfo doc : di) {
+ d.append(doc.getTextContent());
+ }
+ return d.toString();
+ }
+
+ /** The root element of the APISpark document. */
+ private ApplicationInfo application;
+
+ /**
+ * Constructor.
+ *
+ * @param application
+ * The root element of the APISpark document.
+ */
+ public ApisparkRepresentation(ApplicationInfo application) {
+ super(toDocumentation(application));
+
+ this.application = application;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param documentation
+ * The description of the APISpark document.
+ */
+ public ApisparkRepresentation(Documentation documentation) {
+ super(documentation);
+ // Transform contract to ApplicationInfo
+ }
+
+ // /**
+ // * Constructor.
+ // *
+ // * @param representation
+ // * The XML APISpark document.
+ // * @throws IOException
+ // */
+ // public APISparkRepresentation(Representation representation)
+ // throws IOException {
+ // super(representation);
+ // setMediaType(MediaType.APPLICATION_JSON);
+ //
+ // // Parse the given document using SAX to produce an ApplicationInfo
+ // // instance.
+ // // parse(new ContentReader(this));
+ // }
+
+ /**
+ * Returns the root element of the APISpark document.
+ *
+ * @return The root element of the APISpark document.
+ */
+ public ApplicationInfo getApplication() {
+ return this.application;
+ }
+
+ /**
+ * Sets the root element of the APISpark document.
+ *
+ * @param application
+ * The root element of the APISpark document.
+ */
+ public void setApplication(ApplicationInfo application) {
+ this.application = application;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkServerResource.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkServerResource.java
new file mode 100644
index 0000000000..a4ca8787d2
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkServerResource.java
@@ -0,0 +1,591 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.restlet.data.Header;
+import org.restlet.data.MediaType;
+import org.restlet.data.Method;
+import org.restlet.data.Parameter;
+import org.restlet.data.Reference;
+import org.restlet.engine.header.HeaderConstants;
+import org.restlet.representation.Representation;
+import org.restlet.representation.Variant;
+import org.restlet.resource.ResourceException;
+import org.restlet.resource.ServerResource;
+import org.restlet.util.NamedValue;
+import org.restlet.util.Series;
+
+/**
+ * Resource that is able to automatically describe itself with APISpark. This
+ * description can be customized by overriding the {@link #describe()} and
+ * {@link #describeMethod(Method, MethodInfo)} methods.<br>
+ * <br>
+ * When used to describe a class of resources in the context of a parent
+ * application, a special instance will be created using the default constructor
+ * (with no request, response associated). In this case, the resource should do
+ * its best to return the generic information when the APISpark description
+ * methods are invoked, like {@link #describe()} and delegate methods.
+ *
+ * @author Jerome Louvel
+ */
+public class ApisparkServerResource extends ServerResource {
+
+ /**
+ * Indicates if the resource should be automatically described via APISpark
+ * when an OPTIONS request is handled.
+ */
+ private volatile boolean autoDescribing;
+
+ /**
+ * The description of this documented resource. Is seen as the text content
+ * of the "doc" tag of the "resource" element in a APISpark document.
+ */
+ private volatile String description;
+
+ /**
+ * The name of this documented resource. Is seen as the title of the "doc"
+ * tag of the "resource" element in a APISpark document.
+ */
+ private volatile String name;
+
+ /**
+ * Constructor.
+ */
+ public ApisparkServerResource() {
+ this.autoDescribing = true;
+ }
+
+ /**
+ * Indicates if the given method exposes its APISpark description. By
+ * default, HEAD and OPTIONS are not exposed. This method is called by
+ * {@link #describe(String, ResourceInfo)}.
+ *
+ * @param method
+ * The method
+ * @return True if the method exposes its description, false otherwise.
+ */
+ public boolean canDescribe(Method method) {
+ return !(Method.HEAD.equals(method) || Method.OPTIONS.equals(method));
+ }
+
+ /**
+ * Creates a new APISpark representation for a given {@link ApplicationInfo}
+ * instance describing an application.
+ *
+ * @param applicationInfo
+ * The application description.
+ * @return The created {@link ApisparkRepresentation}.
+ */
+ protected Representation createAPISparkRepresentation(
+ ApplicationInfo applicationInfo) {
+ return new ApisparkRepresentation(applicationInfo);
+ }
+
+ /**
+ * Describes the resource as a standalone APISpark document.
+ *
+ * @return The APISpark description.
+ */
+ protected Representation describe() {
+ return describe(getPreferredAPISparkVariant());
+ }
+
+ /**
+ * Updates the description of the parent application. This is typically used
+ * to add documentation on global representations used by several methods or
+ * resources. Does nothing by default.
+ *
+ * @param applicationInfo
+ * The parent application.
+ */
+ protected void describe(ApplicationInfo applicationInfo) {
+ }
+
+ /**
+ * Describes a representation class and variant couple as APISpark
+ * information. The variant contains the target media type that can be
+ * converted to by one of the available Restlet converters.
+ *
+ * @param methodInfo
+ * The parent method description.
+ * @param representationClass
+ * The representation bean class.
+ * @param variant
+ * The target variant.
+ * @return The APISpark representation information.
+ */
+ protected RepresentationInfo describe(MethodInfo methodInfo,
+ Class<?> representationClass, Variant variant) {
+ return new RepresentationInfo(variant);
+ }
+
+ /**
+ * Describes a representation class and variant couple as APISpark
+ * information for the given method and request. The variant contains the
+ * target media type that can be converted to by one of the available
+ * Restlet converters.<br>
+ * <br>
+ * By default, it calls {@link #describe(MethodInfo, Class, Variant)}.
+ *
+ * @param methodInfo
+ * The parent method description.
+ * @param requestInfo
+ * The parent request description.
+ * @param representationClass
+ * The representation bean class.
+ * @param variant
+ * The target variant.
+ * @return The APISpark representation information.
+ */
+ protected RepresentationInfo describe(MethodInfo methodInfo,
+ RequestInfo requestInfo, Class<?> representationClass,
+ Variant variant) {
+ return describe(methodInfo, representationClass, variant);
+ }
+
+ /**
+ * Describes a representation class and variant couple as APISpark
+ * information for the given method and response. The variant contains the
+ * target media type that can be converted to by one of the available
+ * Restlet converters.<br>
+ * <br>
+ * By default, it calls {@link #describe(MethodInfo, Class, Variant)}.
+ *
+ * @param methodInfo
+ * The parent method description.
+ * @param responseInfo
+ * The parent response description.
+ * @param representationClass
+ * The representation bean class.
+ * @param variant
+ * The target variant.
+ * @return The APISpark representation information.
+ */
+ protected RepresentationInfo describe(MethodInfo methodInfo,
+ ResponseInfo responseInfo, Class<?> representationClass,
+ Variant variant) {
+ return describe(methodInfo, representationClass, variant);
+ }
+
+ /**
+ * Returns a APISpark description of the current resource, leveraging the
+ * {@link #getResourcePath()} method.
+ *
+ * @param info
+ * APISpark description of the current resource to update.
+ */
+ public void describe(ResourceInfo info) {
+ describe(getResourcePath(), info);
+ }
+
+ /**
+ * Returns a APISpark description of the current resource.
+ *
+ * @param path
+ * Path of the current resource.
+ * @param info
+ * APISpark description of the current resource to update.
+ */
+ public void describe(String path, ResourceInfo info) {
+ ResourceInfo.describe(null, info, this, path);
+ }
+
+ /**
+ * Describes the resource as a APISpark document for the given variant.
+ *
+ * @param variant
+ * The APISpark variant.
+ * @return The APISpark description.
+ */
+ protected Representation describe(Variant variant) {
+ Representation result = null;
+
+ if (variant != null) {
+ ResourceInfo resource = new ResourceInfo();
+ describe(resource);
+ ApplicationInfo application = resource.createApplication();
+ describe(application);
+
+ if (MediaType.APPLICATION_JSON.equals(variant.getMediaType())) {
+ result = createAPISparkRepresentation(application);
+ } else if (MediaType.APPLICATION_XML.equals(variant.getMediaType())) {
+ result = createAPISparkRepresentation(application);
+ } else if (MediaType.TEXT_XML.equals(variant.getMediaType())) {
+ result = createAPISparkRepresentation(application);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Describes the DELETE method.
+ *
+ * @param info
+ * The method description to update.
+ */
+ protected void describeDelete(MethodInfo info) {
+ MethodInfo.describeAnnotations(info, this);
+ }
+
+ /**
+ * Describes the GET method.<br>
+ * By default, it describes the response with the available variants based
+ * on the {@link #getVariants()} method. Thus in the majority of cases, the
+ * method of the super class must be called when overridden.
+ *
+ * @param info
+ * The method description to update.
+ */
+ protected void describeGet(MethodInfo info) {
+ MethodInfo.describeAnnotations(info, this);
+ }
+
+ /**
+ * Returns a APISpark description of the current method.
+ *
+ * @return A APISpark description of the current method.
+ */
+ protected MethodInfo describeMethod() {
+ MethodInfo result = new MethodInfo();
+ describeMethod(getMethod(), result);
+ return result;
+ }
+
+ /**
+ * Returns a APISpark description of the given method.
+ *
+ * @param method
+ * The method to describe.
+ * @param info
+ * The method description to update.
+ */
+ protected void describeMethod(Method method, MethodInfo info) {
+ info.setName(method);
+
+ if (Method.GET.equals(method)) {
+ describeGet(info);
+ } else if (Method.POST.equals(method)) {
+ describePost(info);
+ } else if (Method.PUT.equals(method)) {
+ describePut(info);
+ } else if (Method.DELETE.equals(method)) {
+ describeDelete(info);
+ } else if (Method.OPTIONS.equals(method)) {
+ describeOptions(info);
+ } else if (Method.PATCH.equals(method)) {
+ describePatch(info);
+ }
+ }
+
+ /**
+ * Describes the OPTIONS method.<br>
+ * By default it describes the response with the available variants based on
+ * the {@link #getAPISparkVariants()} method.
+ *
+ * @param info
+ * The method description to update.
+ */
+ protected void describeOptions(MethodInfo info) {
+ // Describe each variant
+ for (Variant variant : getAPISparkVariants()) {
+ RepresentationInfo result = new RepresentationInfo(variant);
+ info.getResponse().getRepresentations().add(result);
+ }
+ }
+
+ /**
+ * Returns the description of the parameters of this resource. Returns null
+ * by default.
+ *
+ * @return The description of the parameters.
+ */
+ protected List<ParameterInfo> describeParameters() {
+ return null;
+ }
+
+ /**
+ * Describes the Patch method.
+ *
+ * @param info
+ * The method description to update.
+ */
+ protected void describePatch(MethodInfo info) {
+ MethodInfo.describeAnnotations(info, this);
+ }
+
+ /**
+ * Describes the POST method.
+ *
+ * @param info
+ * The method description to update.
+ */
+ protected void describePost(MethodInfo info) {
+ MethodInfo.describeAnnotations(info, this);
+ }
+
+ /**
+ * Describes the PUT method.
+ *
+ * @param info
+ * The method description to update.
+ */
+ protected void describePut(MethodInfo info) {
+ MethodInfo.describeAnnotations(info, this);
+ }
+
+ @Override
+ protected void doInit() throws ResourceException {
+ super.doInit();
+ this.autoDescribing = true;
+ }
+
+ /**
+ * Returns the available APISpark variants.
+ *
+ * @return The available APISpark variants.
+ */
+ protected List<Variant> getAPISparkVariants() {
+ List<Variant> result = new ArrayList<Variant>();
+ result.add(new Variant(MediaType.APPLICATION_JSON));
+ result.add(new Variant(MediaType.TEXT_HTML));
+ return result;
+ }
+
+ /**
+ * Returns the description of this documented resource. Is seen as the text
+ * content of the "doc" tag of the "resource" element in a APISpark
+ * document.
+ *
+ * @return The description of this documented resource.
+ */
+ public String getDescription() {
+ return description;
+ }
+
+ /**
+ * Returns the set of headers as a collection of {@link Parameter} objects.
+ *
+ * @return The set of headers as a collection of {@link Parameter} objects.
+ */
+ @SuppressWarnings("unchecked")
+ private Series<Header> getHeaders() {
+ return (Series<Header>) getRequestAttributes().get(
+ HeaderConstants.ATTRIBUTE_HEADERS);
+ }
+
+ /**
+ * Returns the name of this documented resource. Is seen as the title of the
+ * "doc" tag of the "resource" element in a APISpark document.
+ *
+ * @return The name of this documented resource.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the first parameter found in the current context (entity, query,
+ * headers, etc) with the given name.
+ *
+ * @param name
+ * The parameter name.
+ * @return The first parameter found with the given name.
+ */
+ protected NamedValue<String> getParameter(String name) {
+ NamedValue<String> result = null;
+ Series<? extends NamedValue<String>> set = getParameters(name);
+
+ if (set != null) {
+ result = set.getFirst(name);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns a collection of parameters objects contained in the current
+ * context (entity, query, headers, etc) given a ParameterInfo instance.
+ *
+ * @param parameterInfo
+ * The ParameterInfo instance.
+ * @return A collection of parameters objects
+ */
+ private Series<? extends NamedValue<String>> getParameters(
+ ParameterInfo parameterInfo) {
+ Series<? extends NamedValue<String>> result = null;
+
+ if (parameterInfo.getFixed() != null) {
+ result = new Series<Parameter>(Parameter.class);
+ result.add(parameterInfo.getName(), parameterInfo.getFixed());
+ } else if (ParameterStyle.HEADER.equals(parameterInfo.getStyle())) {
+ result = getHeaders().subList(parameterInfo.getName());
+ } else if (ParameterStyle.TEMPLATE.equals(parameterInfo.getStyle())) {
+ Object parameter = getRequest().getAttributes().get(
+ parameterInfo.getName());
+
+ if (parameter != null) {
+ result = new Series<Parameter>(Parameter.class);
+ result.add(parameterInfo.getName(),
+ Reference.decode((String) parameter));
+ }
+ } else if (ParameterStyle.MATRIX.equals(parameterInfo.getStyle())) {
+ result = getMatrix().subList(parameterInfo.getName());
+ } else if (ParameterStyle.QUERY.equals(parameterInfo.getStyle())) {
+ result = getQuery().subList(parameterInfo.getName());
+ } else if (ParameterStyle.PLAIN.equals(parameterInfo.getStyle())) {
+ // TODO not yet implemented.
+ }
+
+ if (result == null && parameterInfo.getDefaultValue() != null) {
+ result = new Series<Parameter>(Parameter.class);
+ result.add(parameterInfo.getName(), parameterInfo.getDefaultValue());
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns a collection of parameters found in the current context (entity,
+ * query, headers, etc) given a parameter name. It returns null if the
+ * parameter name is unknown.
+ *
+ * @param name
+ * The name of the parameter.
+ * @return A collection of parameters.
+ */
+ protected Series<? extends NamedValue<String>> getParameters(String name) {
+ Series<? extends NamedValue<String>> result = null;
+
+ if (describeParameters() != null) {
+ for (ParameterInfo parameter : describeParameters()) {
+ if (name.equals(parameter.getName())) {
+ result = getParameters(parameter);
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the preferred APISpark variant according to the client
+ * preferences specified in the request.
+ *
+ * @return The preferred APISpark variant.
+ */
+ protected Variant getPreferredAPISparkVariant() {
+ return getConnegService().getPreferredVariant(getAPISparkVariants(),
+ getRequest(), getMetadataService());
+ }
+
+ /**
+ * Returns the resource's relative path.
+ *
+ * @return The resource's relative path.
+ */
+ protected String getResourcePath() {
+ Reference ref = new Reference(getRequest().getRootRef(), getRequest()
+ .getResourceRef());
+ return ref.getRemainingPart();
+ }
+
+ /**
+ * Returns the application resources base URI.
+ *
+ * @return The application resources base URI.
+ */
+ protected Reference getResourcesBase() {
+ return getRequest().getRootRef();
+ }
+
+ /**
+ * Indicates if the resource should be automatically described via APISpark
+ * when an OPTIONS request is handled.
+ *
+ * @return True if the resource should be automatically described via
+ * APISpark.
+ */
+ public boolean isAutoDescribing() {
+ return this.autoDescribing;
+ }
+
+ @Override
+ public Representation options() {
+ if (isAutoDescribing()) {
+ return describe();
+ }
+
+ return null;
+ }
+
+ /**
+ * Indicates if the resource should be automatically described via APISpark
+ * when an OPTIONS request is handled.
+ *
+ * @param autoDescribed
+ * True if the resource should be automatically described via
+ * APISpark.
+ */
+ public void setAutoDescribing(boolean autoDescribed) {
+ this.autoDescribing = autoDescribed;
+ }
+
+ /**
+ * Sets the description of this documented resource. Is seen as the text
+ * content of the "doc" tag of the "resource" element in a APISpark
+ * document.
+ *
+ * @param description
+ * The description of this documented resource.
+ */
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ /**
+ * Sets the name of this documented resource. Is seen as the title of the
+ * "doc" tag of the "resource" element in a APISpark document.
+ *
+ * @param name
+ * The name of this documented resource.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkWrapper.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkWrapper.java
new file mode 100644
index 0000000000..fd1e6d5e32
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApisparkWrapper.java
@@ -0,0 +1,82 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import org.restlet.Restlet;
+import org.restlet.resource.Directory;
+import org.restlet.util.WrapperRestlet;
+
+/**
+ * APISpark wrapper for {@link Restlet} instances. Useful if you need to provide
+ * the APISpark documentation for instances of classes such as {@link Directory}
+ * .
+ *
+ * @author Thierry Boileau
+ */
+public abstract class ApisparkWrapper extends WrapperRestlet implements
+ ApisparkDescribable {
+
+ /** The description of the wrapped Restlet. */
+ private ResourceInfo resourceInfo;
+
+ /**
+ * Constructor.
+ *
+ * @param wrappedRestlet
+ * The Restlet to wrap.
+ */
+ public ApisparkWrapper(Restlet wrappedRestlet) {
+ super(wrappedRestlet);
+ }
+
+ /**
+ * Returns the description of the wrapped Restlet.
+ *
+ * @return The ResourceInfo object of the wrapped Restlet.
+ */
+ public ResourceInfo getResourceInfo() {
+ return this.resourceInfo;
+ }
+
+ /**
+ * Sets the description of the wrapped Restlet.
+ *
+ * @param resourceInfo
+ * The ResourceInfo object of the wrapped Restlet.
+ */
+ public void setResourceInfo(ResourceInfo resourceInfo) {
+ this.resourceInfo = resourceInfo;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApplicationInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApplicationInfo.java
new file mode 100644
index 0000000000..878b63e0a9
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ApplicationInfo.java
@@ -0,0 +1,247 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Root of a APISpark description document.
+ *
+ * @author Jerome Louvel
+ */
+public class ApplicationInfo extends DocumentedInfo {
+
+ /** List of methods. */
+ private List<MethodInfo> methods;
+
+ /** Name. */
+ private String name;
+
+ /** List of representations. */
+ private List<RepresentationInfo> representations;
+
+ /** Resources provided by the application. */
+ private ResourcesInfo resources;
+
+ /**
+ * Describes a set of methods that define the behavior of a type of
+ * resource.
+ */
+ private List<ResourceTypeInfo> resourceTypes;
+
+ /** The version of the Application. */
+ private String version;
+
+ /**
+ * Constructor.
+ */
+ public ApplicationInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ApplicationInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public ApplicationInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ApplicationInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Returns the list of method elements.
+ *
+ * @return The list of method elements.
+ */
+ public List<MethodInfo> getMethods() {
+ // Lazy initialization with double-check.
+ List<MethodInfo> m = this.methods;
+ if (m == null) {
+ synchronized (this) {
+ m = this.methods;
+ if (m == null) {
+ this.methods = m = new ArrayList<MethodInfo>();
+ }
+ }
+ }
+ return m;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the list of representation elements.
+ *
+ * @return The list of representation elements.
+ */
+ public List<RepresentationInfo> getRepresentations() {
+ // Lazy initialization with double-check.
+ List<RepresentationInfo> r = this.representations;
+ if (r == null) {
+ synchronized (this) {
+ r = this.representations;
+ if (r == null) {
+ this.representations = r = new ArrayList<RepresentationInfo>();
+ }
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Returns the resources root element.
+ *
+ * @return The resources root element.
+ */
+ public ResourcesInfo getResources() {
+ // Lazy initialization with double-check.
+ ResourcesInfo r = this.resources;
+ if (r == null) {
+ synchronized (this) {
+ r = this.resources;
+ if (r == null) {
+ this.resources = r = new ResourcesInfo();
+ }
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Returns the list of resource type elements.
+ *
+ * @return The list of resource type elements.
+ */
+ public List<ResourceTypeInfo> getResourceTypes() {
+ // Lazy initialization with double-check.
+ List<ResourceTypeInfo> rt = this.resourceTypes;
+ if (rt == null) {
+ synchronized (this) {
+ rt = this.resourceTypes;
+ if (rt == null) {
+ this.resourceTypes = rt = new ArrayList<ResourceTypeInfo>();
+ }
+ }
+ }
+ return rt;
+ }
+
+ /**
+ * Returns the version of the Application.
+ *
+ * @return The version of the Application.
+ */
+ public String getVersion() {
+ return version;
+ }
+
+ /**
+ * Sets the list of documentation elements.
+ *
+ * @param methods
+ * The list of method elements.
+ */
+ public void setMethods(List<MethodInfo> methods) {
+ this.methods = methods;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the list of representation elements.
+ *
+ * @param representations
+ * The list of representation elements.
+ */
+ public void setRepresentations(List<RepresentationInfo> representations) {
+ this.representations = representations;
+ }
+
+ /**
+ * Sets the list of resource elements.
+ *
+ * @param resources
+ * The list of resource elements.
+ */
+ public void setResources(ResourcesInfo resources) {
+ this.resources = resources;
+ }
+
+ /**
+ * Sets the list of resource type elements.
+ *
+ * @param resourceTypes
+ * The list of resource type elements.
+ */
+ public void setResourceTypes(List<ResourceTypeInfo> resourceTypes) {
+ this.resourceTypes = resourceTypes;
+ }
+
+ /**
+ * Sets the version of the Application.
+ *
+ * @param version
+ * The version of the Application.
+ */
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/DocumentationInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/DocumentationInfo.java
new file mode 100644
index 0000000000..0b0ec2aa0b
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/DocumentationInfo.java
@@ -0,0 +1,129 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import org.restlet.data.Language;
+
+/**
+ * Document APISpark description elements.
+ *
+ * @author Jerome Louvel
+ */
+public class DocumentationInfo {
+
+ /** The language of that documentation element. */
+ private Language language;
+
+ /** The content as a String. */
+ private String textContent;
+
+ /** The title of that documentation element. */
+ private String title;
+
+ /**
+ * Constructor.
+ */
+ public DocumentationInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with text content.
+ *
+ * @param textContent
+ * The text content.
+ */
+ public DocumentationInfo(String textContent) {
+ super();
+ setTextContent(textContent);
+ }
+
+ /**
+ * Returns the language of that documentation element.
+ *
+ * @return The language of this documentation element.
+ */
+ public Language getLanguage() {
+ return this.language;
+ }
+
+ /**
+ * Returns the language of that documentation element.
+ *
+ * @return The content of that element as text.
+ */
+ public String getTextContent() {
+ return this.textContent;
+ }
+
+ /**
+ * Returns the title of that documentation element.
+ *
+ * @return The title of that documentation element.
+ */
+ public String getTitle() {
+ return this.title;
+ }
+
+ /**
+ * The language of that documentation element.
+ *
+ * @param language
+ * The language of that documentation element.
+ */
+ public void setLanguage(Language language) {
+ this.language = language;
+ }
+
+ /**
+ * Sets the content of that element as text.
+ *
+ * @param textContent
+ * The content of that element as text.
+ */
+ public void setTextContent(String textContent) {
+ this.textContent = textContent;
+ }
+
+ /**
+ * Sets the title of that documentation element.
+ *
+ * @param title
+ * The title of that documentation element.
+ */
+ public void setTitle(String title) {
+ this.title = title;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/DocumentedInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/DocumentedInfo.java
new file mode 100644
index 0000000000..1663f701fd
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/DocumentedInfo.java
@@ -0,0 +1,136 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Superclass of APISpark elements that supports dcumentation.
+ *
+ */
+public abstract class DocumentedInfo {
+ /** Doc elements used to document that element. */
+ private List<DocumentationInfo> documentations;
+
+ /**
+ * Constructor.
+ */
+ public DocumentedInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public DocumentedInfo(DocumentationInfo documentation) {
+ super();
+ getDocumentations().add(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public DocumentedInfo(List<DocumentationInfo> documentations) {
+ super();
+ this.documentations = documentations;
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public DocumentedInfo(String documentation) {
+ this(new DocumentationInfo(documentation));
+ }
+
+ /**
+ * Returns the list of documentation elements.
+ *
+ * @return The list of documentation elements.
+ */
+ public List<DocumentationInfo> getDocumentations() {
+ // Lazy initialization with double-check.
+ List<DocumentationInfo> d = this.documentations;
+ if (d == null) {
+ synchronized (this) {
+ d = this.documentations;
+ if (d == null) {
+ this.documentations = d = new ArrayList<DocumentationInfo>();
+ }
+ }
+ }
+ return d;
+ }
+
+ /**
+ * Set the list of documentation elements with a single element.
+ *
+ * @param documentationInfo
+ * A single documentation element.
+ */
+ public void setDocumentation(DocumentationInfo documentationInfo) {
+ getDocumentations().clear();
+ getDocumentations().add(documentationInfo);
+ }
+
+ /**
+ * Set the list of documentation elements with a single element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public void setDocumentation(String documentation) {
+ getDocumentations().clear();
+ getDocumentations().add(new DocumentationInfo(documentation));
+ }
+
+ /**
+ * Sets the list of documentation elements.
+ *
+ * @param doc
+ * The list of documentation elements.
+ */
+ public void setDocumentations(List<DocumentationInfo> doc) {
+ this.documentations = doc;
+ }
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/LinkInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/LinkInfo.java
new file mode 100644
index 0000000000..d38a1960c0
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/LinkInfo.java
@@ -0,0 +1,157 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.List;
+
+import org.restlet.data.Reference;
+
+/**
+ * Allows description of links between representations and resources.
+ *
+ * @author Jerome Louvel
+ */
+public class LinkInfo extends DocumentedInfo {
+ /**
+ * Identifies the relationship of the resource identified by the link to the
+ * resource whose representation the link is embedded in.
+ */
+ private String relationship;
+
+ /**
+ * Defines the capabilities of the resource that the link identifies.
+ */
+ private Reference resourceType;
+
+ /**
+ * Identifies the relationship of the resource whose representation the link
+ * is embedded in to the resource identified by the link.
+ */
+ private String reverseRelationship;
+
+ /**
+ * Constructor.
+ */
+ public LinkInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public LinkInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public LinkInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public LinkInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Returns the relationship attribute value.
+ *
+ * @return The relationship attribute value.
+ */
+ public String getRelationship() {
+ return this.relationship;
+ }
+
+ /**
+ * Returns the reference to the resource type of the linked resource.
+ *
+ * @return The reference to the resource type of the linked resource.
+ */
+ public Reference getResourceType() {
+ return this.resourceType;
+ }
+
+ /**
+ * Returns the reverse relationship attribute value.
+ *
+ * @return The reverse relationship attribute value.
+ */
+ public String getReverseRelationship() {
+ return this.reverseRelationship;
+ }
+
+ /**
+ * Sets the relationship attribute value.
+ *
+ * @param relationship
+ * The relationship attribute value.
+ */
+ public void setRelationship(String relationship) {
+ this.relationship = relationship;
+ }
+
+ /**
+ * Sets the reference to the resource type of the linked resource.
+ *
+ * @param resourceType
+ * The reference to the resource type of the linked resource.
+ */
+ public void setResourceType(Reference resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ /**
+ * Sets the reverse relationship attribute value.
+ *
+ * @param reverseRelationship
+ * The reverse relationship attribute value.
+ */
+ public void setReverseRelationship(String reverseRelationship) {
+ this.reverseRelationship = reverseRelationship;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/MethodInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/MethodInfo.java
new file mode 100644
index 0000000000..efaed5a253
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/MethodInfo.java
@@ -0,0 +1,328 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.restlet.data.Method;
+import org.restlet.data.Reference;
+import org.restlet.engine.resource.AnnotationInfo;
+import org.restlet.engine.resource.AnnotationUtils;
+import org.restlet.representation.Variant;
+import org.restlet.resource.ResourceException;
+import org.restlet.resource.ServerResource;
+import org.restlet.service.MetadataService;
+
+/**
+ * Describes the expected requests and responses of a resource method.
+ *
+ * @author Jerome Louvel
+ */
+public class MethodInfo extends DocumentedInfo {
+
+ /**
+ * Automatically describe a method by discovering the resource's
+ * annotations.
+ *
+ * @param info
+ * The method description to update.
+ * @param resource
+ * The server resource to describe.
+ */
+ public static void describeAnnotations(MethodInfo info,
+ ServerResource resource) {
+ // Loop over the annotated Java methods
+ MetadataService metadataService = resource.getMetadataService();
+ List<AnnotationInfo> annotations = resource.isAnnotated() ? AnnotationUtils
+ .getInstance().getAnnotations(resource.getClass()) : null;
+
+ if (annotations != null && metadataService != null) {
+ for (AnnotationInfo annotationInfo : annotations) {
+ try {
+ if (info.getName()
+ .equals(annotationInfo.getRestletMethod())) {
+ // Describe the request
+ Class<?>[] classes = annotationInfo.getJavaInputTypes();
+
+ List<Variant> requestVariants = annotationInfo
+ .getRequestVariants(
+ resource.getMetadataService(),
+ resource.getConverterService());
+
+ if (requestVariants != null) {
+ for (Variant variant : requestVariants) {
+ if ((variant.getMediaType() != null)
+ && ((info.getRequest() == null) || !info
+ .getRequest()
+ .getRepresentations()
+ .contains(variant))) {
+ RepresentationInfo representationInfo = null;
+
+ if (info.getRequest() == null) {
+ info.setRequest(new RequestInfo());
+ }
+
+ if (resource instanceof ApisparkServerResource) {
+ representationInfo = ((ApisparkServerResource) resource)
+ .describe(info,
+ info.getRequest(),
+ classes[0], variant);
+ } else {
+ representationInfo = new RepresentationInfo(
+ variant);
+ }
+
+ info.getRequest().getRepresentations()
+ .add(representationInfo);
+ }
+ }
+ }
+
+ // Describe the response
+ Class<?> outputClass = annotationInfo
+ .getJavaOutputType();
+
+ if (outputClass != null) {
+ List<Variant> responseVariants = annotationInfo
+ .getResponseVariants(
+ resource.getMetadataService(),
+ resource.getConverterService());
+
+ if (responseVariants != null) {
+ for (Variant variant : responseVariants) {
+ if ((variant.getMediaType() != null)
+ && !info.getResponse()
+ .getRepresentations()
+ .contains(variant)) {
+ RepresentationInfo representationInfo = null;
+
+ if (resource instanceof ApisparkServerResource) {
+ representationInfo = ((ApisparkServerResource) resource)
+ .describe(info,
+ info.getResponse(),
+ outputClass,
+ variant);
+ } else {
+ representationInfo = new RepresentationInfo(
+ variant);
+ }
+
+ info.getResponse().getRepresentations()
+ .add(representationInfo);
+ }
+ }
+ }
+ }
+ }
+ } catch (IOException e) {
+ throw new ResourceException(e);
+ }
+ }
+ }
+ }
+
+ /** Identifier for the method. */
+ private String identifier;
+
+ /** Name of the method. */
+ private Method name;
+
+ /** Describes the input to the method. */
+ private RequestInfo request;
+
+ /** Describes the output of the method. */
+ private List<ResponseInfo> responses;
+
+ /** Reference to a method definition element. */
+ private Reference targetRef;
+
+ /**
+ * Constructor.
+ */
+ public MethodInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public MethodInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public MethodInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public MethodInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Returns the identifier for the method.
+ *
+ * @return The identifier for the method.
+ */
+ public String getIdentifier() {
+ return this.identifier;
+ }
+
+ /**
+ * Returns the name of the method.
+ *
+ * @return The name of the method.
+ */
+
+ public Method getName() {
+ return this.name;
+ }
+
+ /**
+ * Returns the input to the method.
+ *
+ * @return The input to the method.
+ */
+ public RequestInfo getRequest() {
+ return this.request;
+ }
+
+ /**
+ * Returns the last added response of the method.
+ *
+ * @return The last added response of the method.
+ */
+ public ResponseInfo getResponse() {
+ if (getResponses().isEmpty()) {
+ getResponses().add(new ResponseInfo());
+ }
+
+ return getResponses().get(getResponses().size() - 1);
+ }
+
+ /**
+ * Returns the output of the method.
+ *
+ * @return The output of the method.
+ */
+ public List<ResponseInfo> getResponses() {
+ // Lazy initialization with double-check.
+ List<ResponseInfo> r = this.responses;
+ if (r == null) {
+ synchronized (this) {
+ r = this.responses;
+ if (r == null) {
+ this.responses = r = new ArrayList<ResponseInfo>();
+ }
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Returns the reference to a method definition element.
+ *
+ * @return The reference to a method definition element.
+ */
+ public Reference getTargetRef() {
+ return this.targetRef;
+ }
+
+ /**
+ * Sets the identifier for the method.
+ *
+ * @param identifier
+ * The identifier for the method.
+ */
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * Sets the name of the method.
+ *
+ * @param name
+ * The name of the method.
+ */
+ public void setName(Method name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the input to the method.
+ *
+ * @param request
+ * The input to the method.
+ */
+ public void setRequest(RequestInfo request) {
+ this.request = request;
+ }
+
+ /**
+ * Sets the output of the method.
+ *
+ * @param responses
+ * The output of the method.
+ */
+ public void setResponses(List<ResponseInfo> responses) {
+ this.responses = responses;
+ }
+
+ /**
+ * Sets the reference to a method definition element.
+ *
+ * @param targetRef
+ * The reference to a method definition element.
+ */
+ public void setTargetRef(Reference targetRef) {
+ this.targetRef = targetRef;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/OptionInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/OptionInfo.java
new file mode 100644
index 0000000000..8d5aa0d309
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/OptionInfo.java
@@ -0,0 +1,104 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.List;
+
+/**
+ * Defines a potential value for a parent parameter description.
+ *
+ * @author Jerome Louvel
+ */
+public class OptionInfo extends DocumentedInfo {
+
+ /** Value of this option element. */
+ private String value;
+
+ /**
+ * Constructor.
+ */
+ public OptionInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public OptionInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public OptionInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public OptionInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Returns the value of this option element.
+ *
+ * @return The value of this option element.
+ */
+ public String getValue() {
+ return this.value;
+ }
+
+ /**
+ * Sets the value of this option element.
+ *
+ * @param value
+ * The value of this option element.
+ */
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ParameterInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ParameterInfo.java
new file mode 100644
index 0000000000..c9137da42c
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ParameterInfo.java
@@ -0,0 +1,402 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Describes a parameterized aspect of a parent {@link ResourceInfo},
+ * {@link RequestInfo}, {@link ResponseInfo} or {@link RepresentationInfo}
+ * element.
+ *
+ * @author Jerome Louvel
+ */
+public class ParameterInfo extends DocumentedInfo {
+
+ /** Default value of this parameter. */
+ private String defaultValue;
+
+ /** Provides a fixed value for the parameter. */
+ private String fixed;
+
+ /** Identifier of this parameter element. */
+ private String identifier;
+
+ /** Link element. */
+ private LinkInfo link;
+
+ /** Name of this element. */
+ private String name;
+
+ /** List of option elements for that element. */
+ private List<OptionInfo> options;
+
+ /**
+ * Path to the value of this parameter (within a parent representation).
+ */
+ private String path;
+
+ /**
+ * Indicates whether the parameter is single valued or may have multiple
+ * values.
+ */
+ private boolean repeating;
+
+ /**
+ * Indicates whether the parameter is required.
+ */
+ private boolean required;
+
+ /** Parameter style. */
+ private ParameterStyle style;
+
+ /** Parameter type. */
+ private String type;
+
+ /**
+ * Constructor.
+ */
+ public ParameterInfo() {
+ super();
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param name
+ * The name of the parameter.
+ * @param required
+ * True if thes parameter is required.
+ * @param type
+ * The type of the parameter.
+ * @param style
+ * The style of the parameter.
+ * @param documentation
+ * A single documentation element.
+ */
+ public ParameterInfo(String name, boolean required, String type,
+ ParameterStyle style, String documentation) {
+ super(documentation);
+ this.name = name;
+ this.required = required;
+ this.style = style;
+ this.type = type;
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param name
+ * The required name of the parameter.
+ * @param style
+ * The required style of the parameter.
+ * @param documentation
+ * A single documentation element.
+ */
+ public ParameterInfo(String name, ParameterStyle style,
+ DocumentationInfo documentation) {
+ super(documentation);
+ this.name = name;
+ this.style = style;
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param name
+ * The required name of the parameter.
+ * @param style
+ * The required style of the parameter.
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public ParameterInfo(String name, ParameterStyle style,
+ List<DocumentationInfo> documentations) {
+ super(documentations);
+ this.name = name;
+ this.style = style;
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param name
+ * The required name of the parameter.
+ * @param style
+ * The required style of the parameter.
+ * @param documentation
+ * A single documentation element.
+ */
+ public ParameterInfo(String name, ParameterStyle style, String documentation) {
+ super(documentation);
+ this.name = name;
+ this.style = style;
+ }
+
+ /**
+ * Returns the default value of this parameter.
+ *
+ * @return The default value of this parameter.
+ */
+ public String getDefaultValue() {
+ return this.defaultValue;
+ }
+
+ /**
+ * Returns the fixed value for the parameter.
+ *
+ * @return The fixed value for the parameter.
+ */
+ public String getFixed() {
+ return this.fixed;
+ }
+
+ /**
+ * Returns the identifier of this parameter element.
+ *
+ * @return The identifier of this parameter element.
+ */
+
+ public String getIdentifier() {
+ return this.identifier;
+ }
+
+ /**
+ * Returns the link element.
+ *
+ * @return The link element.
+ */
+
+ public LinkInfo getLink() {
+ return this.link;
+ }
+
+ /**
+ * Returns the name of this element.
+ *
+ * @return The name of this element.
+ */
+
+ public String getName() {
+ return this.name;
+ }
+
+ /**
+ * Returns the list of option elements for that element.
+ *
+ * @return The list of option elements for that element.
+ */
+
+ public List<OptionInfo> getOptions() {
+ // Lazy initialization with double-check.
+ List<OptionInfo> o = this.options;
+ if (o == null) {
+ synchronized (this) {
+ o = this.options;
+ if (o == null) {
+ this.options = o = new ArrayList<OptionInfo>();
+ }
+ }
+ }
+ return o;
+ }
+
+ /**
+ * Returns the path to the value of this parameter (within a parent
+ * representation).
+ *
+ * @return The path to the value of this parameter (within a parent
+ * representation).
+ */
+
+ public String getPath() {
+ return this.path;
+ }
+
+ /**
+ * Returns the parameter style.
+ *
+ * @return The parameter style.
+ */
+
+ public ParameterStyle getStyle() {
+ return this.style;
+ }
+
+ /**
+ * Returns the parameter type.
+ *
+ * @return The parameter type.
+ */
+ public String getType() {
+ return this.type;
+ }
+
+ /**
+ * Returns true if the parameter is single valued or may have multiple
+ * values, false otherwise.
+ *
+ * @return True if the parameter is single valued or may have multiple
+ * values, false otherwise.
+ */
+
+ public boolean isRepeating() {
+ return this.repeating;
+ }
+
+ /**
+ * Indicates whether the parameter is required.
+ *
+ * @return True if the parameter is required, false otherwise.
+ */
+ public boolean isRequired() {
+ return this.required;
+ }
+
+ /**
+ * Sets the default value of this parameter.
+ *
+ * @param defaultValue
+ * The default value of this parameter.
+ */
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * Sets the fixed value for the parameter.
+ *
+ * @param fixed
+ * The fixed value for the parameter.
+ */
+ public void setFixed(String fixed) {
+ this.fixed = fixed;
+ }
+
+ /**
+ * Sets the identifier of this parameter element.
+ *
+ * @param identifier
+ * The identifier of this parameter element.
+ */
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * Sets the link element.
+ *
+ * @param link
+ * The link element.
+ */
+ public void setLink(LinkInfo link) {
+ this.link = link;
+ }
+
+ /**
+ * Sets the name of this element.
+ *
+ * @param name
+ * The name of this element.
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Sets the list of option elements for that element.
+ *
+ * @param options
+ * The list of option elements for that element.
+ */
+ public void setOptions(List<OptionInfo> options) {
+ this.options = options;
+ }
+
+ /**
+ * Sets the path to the value of this parameter (within a parent
+ * representation).
+ *
+ * @param path
+ * The path to the value of this parameter (within a parent
+ * representation).
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * Indicates whether the parameter is single valued or may have multiple
+ * values.
+ *
+ * @param repeating
+ * True if the parameter is single valued or may have multiple
+ * values, false otherwise.
+ */
+ public void setRepeating(boolean repeating) {
+ this.repeating = repeating;
+ }
+
+ /**
+ * Indicates whether the parameter is required.
+ *
+ * @param required
+ * True if the parameter is required, false otherwise.
+ */
+ public void setRequired(boolean required) {
+ this.required = required;
+ }
+
+ /**
+ * Sets the parameter style.
+ *
+ * @param style
+ * The parameter style.
+ */
+ public void setStyle(ParameterStyle style) {
+ this.style = style;
+ }
+
+ /**
+ * Sets the parameter type.
+ *
+ * @param type
+ * The parameter type.
+ */
+ public void setType(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ParameterStyle.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ParameterStyle.java
new file mode 100644
index 0000000000..6ee694a94b
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ParameterStyle.java
@@ -0,0 +1,63 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+/**
+ * Enumerates the supported styles of parameters.
+ *
+ * @author Jerome Louvel
+ */
+public enum ParameterStyle {
+
+ HEADER, MATRIX, PLAIN, QUERY, TEMPLATE;
+
+ @Override
+ public String toString() {
+ String result = null;
+ if (equals(HEADER)) {
+ result = "header";
+ } else if (equals(MATRIX)) {
+ result = "matrix";
+ } else if (equals(PLAIN)) {
+ result = "plain";
+ } else if (equals(QUERY)) {
+ result = "query";
+ } else if (equals(TEMPLATE)) {
+ result = "template";
+ }
+
+ return result;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/RepresentationInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/RepresentationInfo.java
new file mode 100644
index 0000000000..4d85e285ea
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/RepresentationInfo.java
@@ -0,0 +1,237 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.restlet.data.MediaType;
+import org.restlet.data.Reference;
+import org.restlet.representation.Variant;
+
+/**
+ * Describes a variant representation for a target resource.
+ *
+ * @author Jerome Louvel
+ */
+public class RepresentationInfo extends DocumentedInfo {
+
+ /** Identifier for that element. */
+ private String identifier;
+
+ /** Media type of that element. */
+ private MediaType mediaType;
+
+ /** List of parameters. */
+ private List<ParameterInfo> parameters;
+
+ /** List of locations of one or more meta data profiles. */
+ private List<Reference> profiles;
+
+ /** Reference to an representation identifier. */
+ private String reference;
+
+ /**
+ * Constructor.
+ */
+ public RepresentationInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public RepresentationInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public RepresentationInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a media type.
+ *
+ * @param mediaType
+ * The media type of the representation.
+ */
+ public RepresentationInfo(MediaType mediaType) {
+ setMediaType(mediaType);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public RepresentationInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a variant.
+ *
+ * @param variant
+ * The variant to describe.
+ */
+ public RepresentationInfo(Variant variant) {
+ setMediaType(variant.getMediaType());
+ }
+
+ /**
+ * Returns the identifier for that element.
+ *
+ * @return The identifier for that element.
+ */
+ public String getIdentifier() {
+ return this.identifier;
+ }
+
+ /**
+ * Returns the media type of that element.
+ *
+ * @return The media type of that element.
+ */
+ public MediaType getMediaType() {
+ return this.mediaType;
+ }
+
+ /**
+ * Returns the list of parameters.
+ *
+ * @return The list of parameters.
+ */
+ public List<ParameterInfo> getParameters() {
+ // Lazy initialization with double-check.
+ List<ParameterInfo> p = this.parameters;
+ if (p == null) {
+ synchronized (this) {
+ p = this.parameters;
+ if (p == null) {
+ this.parameters = p = new ArrayList<ParameterInfo>();
+ }
+ }
+ }
+ return p;
+ }
+
+ /**
+ * Returns the list of locations of one or more meta data profiles.
+ *
+ * @return The list of locations of one or more meta data profiles.
+ */
+ public List<Reference> getProfiles() {
+ // Lazy initialization with double-check.
+ List<Reference> p = this.profiles;
+ if (p == null) {
+ synchronized (this) {
+ p = this.profiles;
+ if (p == null) {
+ this.profiles = p = new ArrayList<Reference>();
+ }
+ }
+ }
+ return p;
+ }
+
+ /**
+ * Returns the reference to an representation identifier.
+ *
+ * @return The reference to an representation identifier.
+ */
+ public String getReference() {
+ return reference;
+ }
+
+ /**
+ * Sets the identifier for that element.
+ *
+ * @param identifier
+ * The identifier for that element.
+ */
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * Sets the media type of that element.
+ *
+ * @param mediaType
+ * The media type of that element.
+ */
+ public void setMediaType(MediaType mediaType) {
+ this.mediaType = mediaType;
+ }
+
+ /**
+ * Sets the list of parameters.
+ *
+ * @param parameters
+ * The list of parameters.
+ */
+ public void setParameters(List<ParameterInfo> parameters) {
+ this.parameters = parameters;
+ }
+
+ /**
+ * Sets the list of locations of one or more meta data profiles.
+ *
+ * @param profiles
+ * The list of locations of one or more meta data profiles.
+ */
+ public void setProfiles(List<Reference> profiles) {
+ this.profiles = profiles;
+ }
+
+ /**
+ * Sets the reference to an representation identifier.
+ *
+ * @param reference
+ * The reference to an representation identifier.
+ */
+ public void setReference(String reference) {
+ this.reference = reference;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/RequestInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/RequestInfo.java
new file mode 100644
index 0000000000..80070d771d
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/RequestInfo.java
@@ -0,0 +1,147 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Describes the properties of a request associated to a parent method.
+ *
+ * @author Jerome Louvel
+ */
+public class RequestInfo extends DocumentedInfo {
+
+ /** List of parameters. */
+ private List<ParameterInfo> parameters;
+
+ /** List of supported input representations. */
+ private List<RepresentationInfo> representations;
+
+ /**
+ * Constructor.
+ */
+ public RequestInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public RequestInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public RequestInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public RequestInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Returns the list of parameters.
+ *
+ * @return The list of parameters.
+ */
+ public List<ParameterInfo> getParameters() {
+ // Lazy initialization with double-check.
+ List<ParameterInfo> p = this.parameters;
+ if (p == null) {
+ synchronized (this) {
+ p = this.parameters;
+ if (p == null) {
+ this.parameters = p = new ArrayList<ParameterInfo>();
+ }
+ }
+ }
+ return p;
+ }
+
+ /**
+ * Returns the list of supported input representations.
+ *
+ * @return The list of supported input representations.
+ */
+ public List<RepresentationInfo> getRepresentations() {
+ // Lazy initialization with double-check.
+ List<RepresentationInfo> r = this.representations;
+ if (r == null) {
+ synchronized (this) {
+ r = this.representations;
+ if (r == null) {
+ this.representations = r = new ArrayList<RepresentationInfo>();
+ }
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Sets the list of parameters.
+ *
+ * @param parameters
+ * The list of parameters.
+ */
+ public void setParameters(List<ParameterInfo> parameters) {
+ this.parameters = parameters;
+ }
+
+ /**
+ * Sets the list of supported input representations.
+ *
+ * @param representations
+ * The list of supported input representations.
+ */
+ public void setRepresentations(List<RepresentationInfo> representations) {
+ this.representations = representations;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourceInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourceInfo.java
new file mode 100644
index 0000000000..92bb520674
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourceInfo.java
@@ -0,0 +1,412 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.restlet.data.MediaType;
+import org.restlet.data.Method;
+import org.restlet.data.Reference;
+import org.restlet.resource.Directory;
+import org.restlet.resource.ServerResource;
+
+/**
+ * Describes a class of closely related resources.
+ *
+ * @author Jerome Louvel
+ */
+public class ResourceInfo extends DocumentedInfo {
+
+ /**
+ * Returns a APISpark description of the current resource.
+ *
+ * @param applicationInfo
+ * The parent application.
+ * @param resource
+ * The resource to describe.
+ * @param path
+ * Path of the current resource.
+ * @param info
+ * APISpark description of the current resource to update.
+ */
+ public static void describe(ApplicationInfo applicationInfo,
+ ResourceInfo info, Object resource, String path) {
+ if ((path != null) && path.startsWith("/")) {
+ path = path.substring(1);
+ }
+
+ info.setPath(path);
+
+ // Introspect the current resource to detect the allowed methods
+ List<Method> methodsList = new ArrayList<Method>();
+
+ if (resource instanceof ServerResource) {
+ ((ServerResource) resource).updateAllowedMethods();
+ methodsList.addAll(((ServerResource) resource).getAllowedMethods());
+
+ if (resource instanceof ApisparkServerResource) {
+ info.setParameters(((ApisparkServerResource) resource)
+ .describeParameters());
+
+ if (applicationInfo != null) {
+ ((ApisparkServerResource) resource)
+ .describe(applicationInfo);
+ }
+ }
+ } else if (resource instanceof Directory) {
+ Directory directory = (Directory) resource;
+ methodsList.add(Method.GET);
+
+ if (directory.isModifiable()) {
+ methodsList.add(Method.DELETE);
+ methodsList.add(Method.PUT);
+ }
+ }
+
+ Method.sort(methodsList);
+
+ // Update the resource info with the description of the allowed methods
+ List<MethodInfo> methods = info.getMethods();
+ MethodInfo methodInfo;
+
+ for (Method method : methodsList) {
+ methodInfo = new MethodInfo();
+ methods.add(methodInfo);
+ methodInfo.setName(method);
+
+ if (resource instanceof ServerResource) {
+ if (resource instanceof ApisparkServerResource) {
+ ApisparkServerResource wsResource = (ApisparkServerResource) resource;
+
+ if (wsResource.canDescribe(method)) {
+ wsResource.describeMethod(method, methodInfo);
+ }
+ } else {
+ MethodInfo.describeAnnotations(methodInfo,
+ (ServerResource) resource);
+ }
+ }
+ }
+
+ // Document the resource
+ String title = null;
+ String textContent = null;
+
+ if (resource instanceof ApisparkServerResource) {
+ title = ((ApisparkServerResource) resource).getName();
+ textContent = ((ApisparkServerResource) resource).getDescription();
+ }
+
+ if ((title != null) && !"".equals(title)) {
+ DocumentationInfo doc = null;
+
+ if (info.getDocumentations().isEmpty()) {
+ doc = new DocumentationInfo();
+ info.getDocumentations().add(doc);
+ } else {
+ info.getDocumentations().get(0);
+ }
+
+ doc.setTitle(title);
+ doc.setTextContent(textContent);
+ }
+ }
+
+ /** List of child resources. */
+ private List<ResourceInfo> childResources;
+
+ /** Identifier for that element. */
+ private String identifier;
+
+ /** List of supported methods. */
+ private List<MethodInfo> methods;
+
+ /** List of parameters. */
+ private List<ParameterInfo> parameters;
+
+ /** URI template for the identifier of the resource. */
+ private String path;
+
+ /** Media type for the query component of the resource URI. */
+ private MediaType queryType;
+
+ /** List of references to resource type elements. */
+ private List<Reference> type;
+
+ /**
+ * Constructor.
+ */
+ public ResourceInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ResourceInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public ResourceInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ResourceInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Creates an application descriptor that wraps this resource descriptor.
+ * The title of the resource, that is to say the title of its first
+ * documentation tag is transfered to the title of the first documentation
+ * tag of the main application tag.
+ *
+ * @return The new application descriptor.
+ */
+ public ApplicationInfo createApplication() {
+ ApplicationInfo result = new ApplicationInfo();
+
+ if (!getDocumentations().isEmpty()) {
+ String titleResource = getDocumentations().get(0).getTitle();
+ if (titleResource != null && !"".equals(titleResource)) {
+ DocumentationInfo doc = null;
+
+ if (result.getDocumentations().isEmpty()) {
+ doc = new DocumentationInfo();
+ result.getDocumentations().add(doc);
+ } else {
+ doc = result.getDocumentations().get(0);
+ }
+
+ doc.setTitle(titleResource);
+ }
+ }
+
+ ResourcesInfo resources = new ResourcesInfo();
+ result.setResources(resources);
+ resources.getResources().add(this);
+ return result;
+ }
+
+ /**
+ * Returns the list of child resources.
+ *
+ * @return The list of child resources.
+ */
+ public List<ResourceInfo> getChildResources() {
+ // Lazy initialization with double-check.
+ List<ResourceInfo> r = this.childResources;
+ if (r == null) {
+ synchronized (this) {
+ r = this.childResources;
+ if (r == null) {
+ this.childResources = r = new ArrayList<ResourceInfo>();
+ }
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Returns the identifier for that element.
+ *
+ * @return The identifier for that element.
+ */
+ public String getIdentifier() {
+ return this.identifier;
+ }
+
+ /**
+ * Returns the list of supported methods.
+ *
+ * @return The list of supported methods.
+ */
+ public List<MethodInfo> getMethods() {
+ // Lazy initialization with double-check.
+ List<MethodInfo> m = this.methods;
+ if (m == null) {
+ synchronized (this) {
+ m = this.methods;
+
+ if (m == null) {
+ this.methods = m = new ArrayList<MethodInfo>();
+ }
+ }
+ }
+ return m;
+ }
+
+ /**
+ * Returns the list of parameters.
+ *
+ * @return The list of parameters.
+ */
+ public List<ParameterInfo> getParameters() {
+ // Lazy initialization with double-check.
+ List<ParameterInfo> p = this.parameters;
+ if (p == null) {
+ synchronized (this) {
+ p = this.parameters;
+ if (p == null) {
+ this.parameters = p = new ArrayList<ParameterInfo>();
+ }
+ }
+ }
+ return p;
+ }
+
+ /**
+ * Returns the URI template for the identifier of the resource.
+ *
+ * @return The URI template for the identifier of the resource.
+ */
+ public String getPath() {
+ return this.path;
+ }
+
+ /**
+ * Returns the media type for the query component of the resource URI.
+ *
+ * @return The media type for the query component of the resource URI.
+ */
+ public MediaType getQueryType() {
+ return this.queryType;
+ }
+
+ /**
+ * Returns the list of references to resource type elements.
+ *
+ * @return The list of references to resource type elements.
+ */
+ public List<Reference> getType() {
+ // Lazy initialization with double-check.
+ List<Reference> t = this.type;
+ if (t == null) {
+ synchronized (this) {
+ t = this.type;
+ if (t == null) {
+ this.type = t = new ArrayList<Reference>();
+ }
+ }
+ }
+ return t;
+ }
+
+ /**
+ * Sets the list of child resources.
+ *
+ * @param resources
+ * The list of child resources.
+ */
+ public void setChildResources(List<ResourceInfo> resources) {
+ this.childResources = resources;
+ }
+
+ /**
+ * Sets the identifier for that element.
+ *
+ * @param identifier
+ * The identifier for that element.
+ */
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * Sets the list of supported methods.
+ *
+ * @param methods
+ * The list of supported methods.
+ */
+ public void setMethods(List<MethodInfo> methods) {
+ this.methods = methods;
+ }
+
+ /**
+ * Sets the list of parameters.
+ *
+ * @param parameters
+ * The list of parameters.
+ */
+ public void setParameters(List<ParameterInfo> parameters) {
+ this.parameters = parameters;
+ }
+
+ /**
+ * Sets the URI template for the identifier of the resource.
+ *
+ * @param path
+ * The URI template for the identifier of the resource.
+ */
+ public void setPath(String path) {
+ this.path = path;
+ }
+
+ /**
+ * Sets the media type for the query component of the resource URI.
+ *
+ * @param queryType
+ * The media type for the query component of the resource URI.
+ */
+ public void setQueryType(MediaType queryType) {
+ this.queryType = queryType;
+ }
+
+ /**
+ * Sets the list of references to resource type elements.
+ *
+ * @param type
+ * The list of references to resource type elements.
+ */
+ public void setType(List<Reference> type) {
+ this.type = type;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourceTypeInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourceTypeInfo.java
new file mode 100644
index 0000000000..38c7113203
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourceTypeInfo.java
@@ -0,0 +1,169 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Describes a reusable type of resources.
+ *
+ * @author Jerome Louvel
+ */
+public class ResourceTypeInfo extends DocumentedInfo {
+
+ /** Identifier for that element. */
+ private String identifier;
+
+ /** List of supported methods. */
+ private List<MethodInfo> methods;
+
+ /** List of parameters. */
+ private List<ParameterInfo> parameters;
+
+ /**
+ * Constructor.
+ */
+ public ResourceTypeInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ResourceTypeInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public ResourceTypeInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ResourceTypeInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Returns the identifier for that element.
+ *
+ * @return The identifier for that element.
+ */
+ public String getIdentifier() {
+ return this.identifier;
+ }
+
+ /**
+ * Returns the list of supported methods.
+ *
+ * @return The list of supported methods.
+ */
+ public List<MethodInfo> getMethods() {
+ // Lazy initialization with double-check.
+ List<MethodInfo> m = this.methods;
+ if (m == null) {
+ synchronized (this) {
+ m = this.methods;
+ if (m == null) {
+ this.methods = m = new ArrayList<MethodInfo>();
+ }
+ }
+ }
+ return m;
+ }
+
+ /**
+ * Returns the list of parameters.
+ *
+ * @return The list of parameters.
+ */
+ public List<ParameterInfo> getParameters() {
+ // Lazy initialization with double-check.
+ List<ParameterInfo> p = this.parameters;
+ if (p == null) {
+ synchronized (this) {
+ p = this.parameters;
+ if (p == null) {
+ this.parameters = p = new ArrayList<ParameterInfo>();
+ }
+ }
+ }
+ return p;
+ }
+
+ /**
+ * Sets the identifier for that element.
+ *
+ * @param identifier
+ * The identifier for that element.
+ */
+ public void setIdentifier(String identifier) {
+ this.identifier = identifier;
+ }
+
+ /**
+ * Sets the list of supported methods.
+ *
+ * @param methods
+ * The list of supported methods.
+ */
+ public void setMethods(List<MethodInfo> methods) {
+ this.methods = methods;
+ }
+
+ /**
+ * Sets the list of parameters.
+ *
+ * @param parameters
+ * The list of parameters.
+ */
+ public void setParameters(List<ParameterInfo> parameters) {
+ this.parameters = parameters;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourcesInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourcesInfo.java
new file mode 100644
index 0000000000..0274dcd5e7
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResourcesInfo.java
@@ -0,0 +1,138 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.restlet.data.Reference;
+
+/**
+ * Describes the root resources of an application.
+ *
+ * @author Jerome Louvel
+ */
+public class ResourcesInfo extends DocumentedInfo {
+ /** Base URI for each child resource identifier. */
+ private Reference baseRef;
+
+ /** List of child resources. */
+ private List<ResourceInfo> resources;
+
+ /**
+ * Constructor.
+ */
+ public ResourcesInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ResourcesInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public ResourcesInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ResourcesInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Returns the base URI for each child resource identifier.
+ *
+ * @return The base URI for each child resource identifier.
+ */
+ public Reference getBaseRef() {
+ return this.baseRef;
+ }
+
+ /**
+ * Returns the list of child resources.
+ *
+ * @return The list of child resources.
+ */
+ public List<ResourceInfo> getResources() {
+ // Lazy initialization with double-check.
+ List<ResourceInfo> r = this.resources;
+ if (r == null) {
+ synchronized (this) {
+ r = this.resources;
+ if (r == null) {
+ this.resources = r = new ArrayList<ResourceInfo>();
+ }
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Sets the base URI for each child resource identifier.
+ *
+ * @param baseRef
+ * The base URI for each child resource identifier.
+ */
+ public void setBaseRef(Reference baseRef) {
+ this.baseRef = baseRef;
+ }
+
+ /**
+ * Sets the list of child resources.
+ *
+ * @param resources
+ * The list of child resources.
+ */
+ public void setResources(List<ResourceInfo> resources) {
+ this.resources = resources;
+ }
+
+}
diff --git a/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResponseInfo.java b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResponseInfo.java
new file mode 100644
index 0000000000..0a653d33af
--- /dev/null
+++ b/modules/org.restlet.ext.apispark/src/org/restlet/ext/apispark/info/ResponseInfo.java
@@ -0,0 +1,186 @@
+/**
+ * Copyright 2005-2014 Restlet
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: Apache 2.0 or LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL
+ * 1.0 (the "Licenses"). You can select the license that you prefer but you may
+ * not use this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the Apache 2.0 license at
+ * http://www.opensource.org/licenses/apache-2.0
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://restlet.com/products/restlet-framework
+ *
+ * Restlet is a registered trademark of Restlet S.A.S.
+ */
+
+package org.restlet.ext.apispark.info;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.restlet.data.Status;
+
+/**
+ * Describes the properties of a response associated to a parent method.
+ *
+ * @author Jerome Louvel
+ */
+public class ResponseInfo extends DocumentedInfo {
+
+ /** List of parameters. */
+ private List<ParameterInfo> parameters;
+
+ /** List of representations. */
+ private List<RepresentationInfo> representations;
+
+ /**
+ * List of statuses associated with this response representation.
+ */
+ private List<Status> statuses;
+
+ /**
+ * Constructor.
+ */
+ public ResponseInfo() {
+ super();
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ResponseInfo(DocumentationInfo documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Constructor with a list of documentation elements.
+ *
+ * @param documentations
+ * The list of documentation elements.
+ */
+ public ResponseInfo(List<DocumentationInfo> documentations) {
+ super(documentations);
+ }
+
+ /**
+ * Constructor with a single documentation element.
+ *
+ * @param documentation
+ * A single documentation element.
+ */
+ public ResponseInfo(String documentation) {
+ super(documentation);
+ }
+
+ /**
+ * Returns the list of parameters.
+ *
+ * @return The list of parameters.
+ */
+ public List<ParameterInfo> getParameters() {
+ // Lazy initialization with double-check.
+ List<ParameterInfo> p = this.parameters;
+ if (p == null) {
+ synchronized (this) {
+ p = this.parameters;
+ if (p == null) {
+ this.parameters = p = new ArrayList<ParameterInfo>();
+ }
+ }
+ }
+ return p;
+ }
+
+ /**
+ * Returns the list of representations
+ *
+ * @return The list of representations
+ */
+ public List<RepresentationInfo> getRepresentations() {
+ // Lazy initialization with double-check.
+ List<RepresentationInfo> r = this.representations;
+ if (r == null) {
+ synchronized (this) {
+ r = this.representations;
+ if (r == null) {
+ this.representations = r = new ArrayList<RepresentationInfo>();
+ }
+ }
+ }
+ return r;
+ }
+
+ /**
+ * Returns the list of statuses associated with this response
+ * representation.
+ *
+ * @return The list of statuses associated with this response
+ * representation.
+ */
+ public List<Status> getStatuses() {
+ // Lazy initialization with double-check.
+ List<Status> s = this.statuses;
+ if (s == null) {
+ synchronized (this) {
+ s = this.statuses;
+ if (s == null) {
+ this.statuses = s = new ArrayList<Status>();
+ }
+ }
+ }
+ return s;
+ }
+
+ /**
+ * Sets the list of parameters.
+ *
+ * @param parameters
+ * The list of parameters.
+ */
+ public void setParameters(List<ParameterInfo> parameters) {
+ this.parameters = parameters;
+ }
+
+ /**
+ * Sets the list of representations
+ *
+ * @param representations
+ * The list of representations
+ */
+ public void setRepresentations(List<RepresentationInfo> representations) {
+ this.representations = representations;
+ }
+
+ /**
+ * Sets the list of statuses associated with this response representation.
+ *
+ * @param statuses
+ * The list of statuses associated with this response
+ * representation.
+ */
+ public void setStatuses(List<Status> statuses) {
+ this.statuses = statuses;
+ }
+
+}
diff --git a/modules/org.restlet/.settings/org.eclipse.jdt.core.prefs b/modules/org.restlet/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000000..f42de363af
--- /dev/null
+++ b/modules/org.restlet/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.7
|
3bb3597920c9542c86869a4211e3273f135e1c56
|
camel
|
MR-187: Added more unit tests.--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@824320 13f79535-47bb-0310-9956-ffa450edef68-
|
p
|
https://github.com/apache/camel
|
diff --git a/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java b/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
index a10179edfde81..ecb7199fb9802 100644
--- a/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/converter/jaxp/DomConverter.java
@@ -17,7 +17,6 @@
package org.apache.camel.converter.jaxp;
import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -60,9 +59,6 @@ private static void append(StringBuffer buffer, Node node) {
} else if (node instanceof Element) {
Element element = (Element) node;
append(buffer, element.getChildNodes());
- } else if (node instanceof Document) {
- Document doc = (Document) node;
- append(buffer, doc.getChildNodes());
}
}
}
diff --git a/camel-core/src/test/java/org/apache/camel/converter/jaxp/DomConverterTest.java b/camel-core/src/test/java/org/apache/camel/converter/jaxp/DomConverterTest.java
new file mode 100644
index 0000000000000..3404592b7a702
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/converter/jaxp/DomConverterTest.java
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.converter.jaxp;
+
+import org.w3c.dom.Document;
+
+import org.apache.camel.ContextTestSupport;
+
+/**
+ * @version $Revision$
+ */
+public class DomConverterTest extends ContextTestSupport {
+
+ public void testDomConverter() throws Exception {
+ Document document = context.getTypeConverter().convertTo(Document.class, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><hello>world!</hello>");
+
+ String s = DomConverter.toString(document.getChildNodes());
+ assertEquals("world!", s);
+ }
+
+}
diff --git a/camel-core/src/test/java/org/apache/camel/converter/jaxp/XmlConverterTest.java b/camel-core/src/test/java/org/apache/camel/converter/jaxp/XmlConverterTest.java
new file mode 100644
index 0000000000000..0b6c5d7b05452
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/converter/jaxp/XmlConverterTest.java
@@ -0,0 +1,354 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.converter.jaxp;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.Reader;
+import java.nio.ByteBuffer;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.Exchange;
+import org.apache.camel.impl.DefaultExchange;
+
+/**
+ * @version $Revision$
+ */
+public class XmlConverterTest extends ContextTestSupport {
+
+ public void testToResultNoSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ conv.toResult(null, null);
+ }
+
+ public void testToBytesSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ BytesSource bs = conv.toSource("<foo>bar</foo>".getBytes());
+ assertNotNull(bs);
+ assertEquals("<foo>bar</foo>", new String(bs.getData()));
+ }
+
+ public void testToStringFromSourceNoSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ Source source = null;
+ String out = conv.toString(source);
+ assertEquals(null, out);
+ }
+
+ public void testToStringWithBytesSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ Source source = conv.toSource("<foo>bar</foo>".getBytes());
+ String out = conv.toString(source);
+ assertEquals("<foo>bar</foo>", out);
+ }
+
+ public void testToByteArrayWithExchange() throws Exception {
+ Exchange exchange = new DefaultExchange(context);
+ XmlConverter conv = new XmlConverter();
+
+ Source source = conv.toSource("<foo>bar</foo>".getBytes());
+ byte[] out = conv.toByteArray(source, exchange);
+ assertEquals("<foo>bar</foo>", new String(out));
+ }
+
+ public void testToByteArrayWithNoExchange() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ Source source = conv.toSource("<foo>bar</foo>".getBytes());
+ byte[] out = conv.toByteArray(source, null);
+ assertEquals("<foo>bar</foo>", new String(out));
+ }
+
+ public void testToDomSourceByDomSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ DOMSource source = conv.toDOMSource("<foo>bar</foo>");
+ DOMSource out = conv.toDOMSource(source);
+ assertSame(source, out);
+ }
+
+ public void testToDomSourceByStaxSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ SAXSource source = conv.toSAXSource("<foo>bar</foo>");
+ DOMSource out = conv.toDOMSource(source);
+ assertNotSame(source, out);
+
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToDomSourceByCustomSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ Source dummy = new Source() {
+ public String getSystemId() {
+ return null;
+ }
+
+ public void setSystemId(String s) {
+ }
+ };
+
+ DOMSource out = conv.toDOMSource(dummy);
+ assertNull(out);
+ }
+
+ public void testToSaxSourceByInputStream() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ InputStream is = context.getTypeConverter().convertTo(InputStream.class, "<foo>bar</foo>");
+ SAXSource out = conv.toSAXSource(is);
+
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToSaxSourceByDomSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ DOMSource source = conv.toDOMSource("<foo>bar</foo>");
+ SAXSource out = conv.toSAXSource(source);
+ assertNotSame(source, out);
+
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToSaxSourceByStaxSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ SAXSource source = conv.toSAXSource("<foo>bar</foo>");
+ SAXSource out = conv.toSAXSource(source);
+ assertSame(source, out);
+ }
+
+ public void testToSaxSourceByCustomSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ Source dummy = new Source() {
+ public String getSystemId() {
+ return null;
+ }
+
+ public void setSystemId(String s) {
+ }
+ };
+
+ SAXSource out = conv.toSAXSource(dummy);
+ assertNull(out);
+ }
+
+ public void testToStreamSourceByFile() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ File file = new File("org/apache/camel/converter/stream/test.xml").getAbsoluteFile();
+ StreamSource source = conv.toStreamSource(file);
+ StreamSource out = conv.toStreamSource(source);
+ assertSame(source, out);
+ }
+
+ public void testToStreamSourceByStreamSource() throws Exception {
+ Exchange exchange = new DefaultExchange(context);
+ XmlConverter conv = new XmlConverter();
+
+ StreamSource source = conv.toStreamSource("<foo>bar</foo>".getBytes(), exchange);
+ StreamSource out = conv.toStreamSource(source);
+ assertSame(source, out);
+ }
+
+ public void testToStreamSourceByDomSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ DOMSource source = conv.toDOMSource("<foo>bar</foo>");
+ StreamSource out = conv.toStreamSource(source);
+ assertNotSame(source, out);
+
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToStreamSourceByStaxSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ SAXSource source = conv.toSAXSource("<foo>bar</foo>");
+ StreamSource out = conv.toStreamSource(source);
+ assertNotSame(source, out);
+
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToStreamSourceByCustomSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ Source dummy = new Source() {
+ public String getSystemId() {
+ return null;
+ }
+
+ public void setSystemId(String s) {
+ }
+ };
+
+ StreamSource out = conv.toStreamSource(dummy);
+ assertNull(out);
+ }
+
+ public void testToStreamSourceByInputStream() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ InputStream is = context.getTypeConverter().convertTo(InputStream.class, "<foo>bar</foo>");
+ StreamSource out = conv.toStreamSource(is);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToStreamSourceByReader() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ Reader reader = context.getTypeConverter().convertTo(Reader.class, "<foo>bar</foo>");
+ StreamSource out = conv.toStreamSource(reader);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToStreamSourceByByteArray() throws Exception {
+ Exchange exchange = new DefaultExchange(context);
+ XmlConverter conv = new XmlConverter();
+
+ byte[] bytes = context.getTypeConverter().convertTo(byte[].class, "<foo>bar</foo>");
+ StreamSource out = conv.toStreamSource(bytes, exchange);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToStreamSourceByByteBuffer() throws Exception {
+ Exchange exchange = new DefaultExchange(context);
+ XmlConverter conv = new XmlConverter();
+
+ ByteBuffer bytes = context.getTypeConverter().convertTo(ByteBuffer.class, "<foo>bar</foo>");
+ StreamSource out = conv.toStreamSource(bytes, exchange);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", conv.toString(out));
+ }
+
+ public void testToVariousUsingNull() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ InputStream is = null;
+ assertNull(conv.toStreamSource(is));
+
+ Reader reader = null;
+ assertNull(conv.toStreamSource(reader));
+
+ File file = null;
+ assertNull(conv.toStreamSource(file));
+
+ byte[] bytes = null;
+ assertNull(conv.toStreamSource(bytes, null));
+
+ try {
+ Node node = null;
+ conv.toDOMElement(node);
+ fail("Should have thrown exception");
+ } catch (TransformerException e) {
+ // expected
+ }
+ }
+
+ public void testToReaderFromSource() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ SAXSource source = conv.toSAXSource("<foo>bar</foo>");
+
+ Reader out = conv.toReaderFromSource(source);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", context.getTypeConverter().convertTo(String.class, out));
+ }
+
+ public void testToDomSourceFromInputStream() throws Exception {
+ XmlConverter conv = new XmlConverter();
+
+ InputStream is = context.getTypeConverter().convertTo(InputStream.class, "<foo>bar</foo>");
+ DOMSource out = conv.toDOMSource(is);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", context.getTypeConverter().convertTo(String.class, out));
+ }
+
+ public void testToDomElement() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ SAXSource source = conv.toSAXSource("<foo>bar</foo>");
+
+ Element out = conv.toDOMElement(source);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", context.getTypeConverter().convertTo(String.class, out));
+ }
+
+ public void testToDomElementFromDocumentNode() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ Document doc = context.getTypeConverter().convertTo(Document.class, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>bar</foo>");
+
+ Element out = conv.toDOMElement(doc);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", context.getTypeConverter().convertTo(String.class, out));
+ }
+
+ public void testToDomElementFromElementNode() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ Document doc = context.getTypeConverter().convertTo(Document.class, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>bar</foo>");
+
+ Element out = conv.toDOMElement(doc.getDocumentElement());
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", context.getTypeConverter().convertTo(String.class, out));
+ }
+
+ public void testToDocumentFromBytes() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ byte[] bytes = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>bar</foo>".getBytes();
+
+ Document out = conv.toDOMDocument(bytes);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", context.getTypeConverter().convertTo(String.class, out));
+ }
+
+ public void testToDocumentFromInputStream() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ InputStream is = context.getTypeConverter().convertTo(InputStream.class, "<?xml version=\"1.0\" encoding=\"UTF-8\"?><foo>bar</foo>");
+
+ Document out = conv.toDOMDocument(is);
+ assertNotNull(out);
+ assertEquals("<foo>bar</foo>", context.getTypeConverter().convertTo(String.class, out));
+ }
+
+ public void testToDocumentFromFile() throws Exception {
+ XmlConverter conv = new XmlConverter();
+ File file = new File("./src/test/resources/org/apache/camel/converter/stream/test.xml").getAbsoluteFile();
+
+ Document out = conv.toDOMDocument(file);
+ assertNotNull(out);
+ String s = context.getTypeConverter().convertTo(String.class, out);
+ assertTrue(s.contains("<firstName>James</firstName>"));
+ }
+
+}
|
08d6538b3f9f611065682d08190747a7a93181fd
|
drools
|
[DROOLS-1026] improve equals/hashCode performances- for all rete nodes--
|
p
|
https://github.com/kiegroup/drools
|
diff --git a/drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java b/drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java
index 5a299d99af6..efd46459257 100644
--- a/drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java
+++ b/drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java
@@ -889,7 +889,7 @@ public void testAccumulateWithAndOrCombinations() throws Exception {
wm.insert( new Person( "Bob", "stilton" ) );
}
- @Test(timeout = 10000)
+ @Test//(timeout = 10000)
public void testAccumulateWithSameSubnetwork() throws Exception {
String rule = "package org.drools.compiler.test;\n" +
"import org.drools.compiler.Cheese;\n" +
diff --git a/drools-compiler/src/test/java/org/drools/compiler/integrationtests/SharingTest.java b/drools-compiler/src/test/java/org/drools/compiler/integrationtests/SharingTest.java
index 763a2bac26f..112c84215f3 100644
--- a/drools-compiler/src/test/java/org/drools/compiler/integrationtests/SharingTest.java
+++ b/drools-compiler/src/test/java/org/drools/compiler/integrationtests/SharingTest.java
@@ -184,8 +184,6 @@ public void testJoinNodeSharing() throws Exception {
MethodCountingObjectTypeNode betaOTN = (MethodCountingObjectTypeNode) joinNode.getRightInput();
Map<String, Integer> countingMap = betaOTN.getMethodCountMap();
- assertNotNull(countingMap);
- assertEquals(1,countingMap.get("thisNodeEquals").intValue());
- assertNull (countingMap.get("equals")); //Make sure we are not using recursive "equals" method
+ assertNull(countingMap);
}
}
diff --git a/drools-compiler/src/test/java/org/drools/compiler/reteoo/MockLeftTupleSink.java b/drools-compiler/src/test/java/org/drools/compiler/reteoo/MockLeftTupleSink.java
index f2dcc4af914..6d5c68d0626 100644
--- a/drools-compiler/src/test/java/org/drools/compiler/reteoo/MockLeftTupleSink.java
+++ b/drools-compiler/src/test/java/org/drools/compiler/reteoo/MockLeftTupleSink.java
@@ -219,4 +219,8 @@ public LeftTuple createPeer(LeftTuple original) {
return null;
}
+ @Override
+ protected boolean internalEquals( Object object ) {
+ return false;
+ }
}
diff --git a/drools-core/src/main/java/org/drools/core/base/dataproviders/MVELDataProvider.java b/drools-core/src/main/java/org/drools/core/base/dataproviders/MVELDataProvider.java
index 485a0c67cc9..61692a42d14 100644
--- a/drools-core/src/main/java/org/drools/core/base/dataproviders/MVELDataProvider.java
+++ b/drools-core/src/main/java/org/drools/core/base/dataproviders/MVELDataProvider.java
@@ -70,13 +70,17 @@ public boolean equals( Object obj ) {
if (this == obj) {
return true;
}
+
if (obj == null || !(obj instanceof MVELDataProvider)) {
return false;
}
- MVELDataProvider other = (MVELDataProvider) obj;
+ return unit.equals( ((MVELDataProvider) obj).unit );
+ }
- return unit.equals( other.unit );
+ @Override
+ public int hashCode() {
+ return unit.hashCode();
}
public void readExternal( ObjectInput in ) throws IOException,
diff --git a/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java b/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java
index 77e3893897f..10c27bd0fe7 100644
--- a/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java
+++ b/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java
@@ -181,6 +181,13 @@ public boolean equals( Object obj ) {
Arrays.equals(localDeclarations, other.localDeclarations);
}
+ @Override
+ public int hashCode() {
+ return 23 * expression.hashCode() +
+ 29 * Arrays.hashCode( previousDeclarations ) +
+ 31 * Arrays.hashCode( localDeclarations );
+ }
+
public void writeExternal( ObjectOutput out ) throws IOException {
out.writeUTF( name );
diff --git a/drools-core/src/main/java/org/drools/core/common/BaseNode.java b/drools-core/src/main/java/org/drools/core/common/BaseNode.java
index ebdaf46a7c2..9144eeeb67d 100644
--- a/drools-core/src/main/java/org/drools/core/common/BaseNode.java
+++ b/drools-core/src/main/java/org/drools/core/common/BaseNode.java
@@ -41,6 +41,8 @@ public abstract class BaseNode
protected Bag<Rule> associations;
private boolean streamMode;
+ protected int hashcode;
+
public BaseNode() {
}
@@ -69,6 +71,7 @@ public void readExternal(ObjectInput in) throws IOException,
partitionsEnabled = in.readBoolean();
associations = (Bag<Rule>) in.readObject();
streamMode = in.readBoolean();
+ hashcode = in.readInt();
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -77,6 +80,7 @@ public void writeExternal(ObjectOutput out) throws IOException {
out.writeBoolean( partitionsEnabled );
out.writeObject( associations );
out.writeBoolean( streamMode );
+ out.writeInt(hashcode);
}
/* (non-Javadoc)
@@ -133,13 +137,6 @@ protected abstract boolean doRemove(RuleRemovalContext context,
*/
public abstract boolean isInUse();
- /**
- * The hashCode return is simply the unique id of the node. It is expected that base classes will also implement equals(Object object).
- */
- public int hashCode() {
- return this.id;
- }
-
public String toString() {
return "[" + this.getClass().getSimpleName() + "(" + this.id + ")]";
}
@@ -193,8 +190,14 @@ public boolean isAssociatedWith( Rule rule ) {
return this.associations.contains( rule );
}
- //Default implementation
public boolean thisNodeEquals(final Object object) {
- return this.equals( object );
+ return this == object || internalEquals( object );
+ }
+
+ protected abstract boolean internalEquals( Object object );
+
+ @Override
+ public final int hashCode() {
+ return hashcode;
}
}
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AccumulateNode.java b/drools-core/src/main/java/org/drools/core/reteoo/AccumulateNode.java
index 855c0984d5b..3a665ef64a0 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/AccumulateNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/AccumulateNode.java
@@ -81,6 +81,12 @@ public AccumulateNode(final int id,
this.accumulate = accumulate;
this.unwrapRightObject = unwrapRightObject;
this.tupleMemoryEnabled = context.isTupleMemoryEnabled();
+
+ hashcode = this.leftInput.hashCode() ^
+ this.rightInput.hashCode() ^
+ this.accumulate.hashCode() ^
+ this.resultBinder.hashCode() ^
+ Arrays.hashCode( this.resultConstraints );
}
public void readExternal( ObjectInput in ) throws IOException,
@@ -158,37 +164,29 @@ public void attach( BuildContext context ) {
super.attach( context );
}
- /* (non-Javadoc)
- * @see org.kie.reteoo.BaseNode#hashCode()
- */
- public int hashCode() {
- return this.leftInput.hashCode() ^ this.rightInput.hashCode() ^ this.accumulate.hashCode() ^ this.resultBinder.hashCode() ^ Arrays.hashCode( this.resultConstraints );
+ protected int calculateHashCode() {
+ return 0;
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ @Override
public boolean equals( final Object object ) {
- if ( this == object ) {
- return true;
- }
-
- if ( object == null || !(object instanceof AccumulateNode) ) {
- return false;
- }
-
- final AccumulateNode other = (AccumulateNode) object;
+ return this == object ||
+ ( internalEquals( object ) &&
+ this.leftInput.thisNodeEquals( ((AccumulateNode) object).leftInput ) &&
+ this.rightInput.thisNodeEquals( ((AccumulateNode) object).rightInput ) );
+ }
- if ( this.getClass() != other.getClass() || (!this.leftInput.equals( other.leftInput )) || (!this.rightInput.equals( other.rightInput )) || (!this.constraints.equals( other.constraints )) ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof AccumulateNode ) || this.hashCode() != object.hashCode() ) {
return false;
}
- return this.accumulate.equals( other.accumulate ) && resultBinder.equals( other.resultBinder ) && Arrays.equals( this.resultConstraints,
- other.resultConstraints );
- }
-
- public boolean thisNodeEquals(final Object object) {
- return equals( object );
+ AccumulateNode other = (AccumulateNode) object;
+ return this.constraints.equals( other.constraints ) &&
+ this.accumulate.equals( other.accumulate ) &&
+ resultBinder.equals( other.resultBinder ) &&
+ Arrays.equals( this.resultConstraints, other.resultConstraints );
}
/**
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java b/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java
index 3f859c0fd8e..f723c2b0771 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/AlphaNode.java
@@ -58,8 +58,6 @@ public class AlphaNode extends ObjectSource
private ObjectSinkNode previousRightTupleSinkNode;
private ObjectSinkNode nextRightTupleSinkNode;
- private int hashcode;
-
public AlphaNode() {
}
@@ -101,7 +99,6 @@ public void readExternal(ObjectInput in) throws IOException,
constraint = (AlphaNodeFieldConstraint) in.readObject();
declaredMask = (BitMask) in.readObject();
inferredMask = (BitMask) in.readObject();
- hashcode = in.readInt();
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -109,7 +106,6 @@ public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(constraint);
out.writeObject(declaredMask);
out.writeObject(inferredMask);
- out.writeInt(hashcode);
}
/**
@@ -181,26 +177,26 @@ public String toString() {
return "[AlphaNode(" + this.id + ") constraint=" + this.constraint + "]";
}
- public int hashCode() {
- return hashcode;
- }
-
private int calculateHashCode() {
return (this.source != null ? this.source.hashCode() : 0) * 37 + (this.constraint != null ? this.constraint.hashCode() : 0) * 31;
}
- public boolean equals(final Object object) {
- return thisNodeEquals(object) && (this.source != null ? this.source.equals(((AlphaNode) object).source) : ((AlphaNode) object).source == null);
+ @Override
+ public boolean equals(Object object) {
+ return this == object ||
+ (internalEquals((AlphaNode)object) &&
+ (this.source != null ?
+ this.source.thisNodeEquals(((AlphaNode) object).source) :
+ ((AlphaNode) object).source == null) );
}
- public boolean thisNodeEquals(final Object object) {
- if (this == object) {
- return true;
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof AlphaNode) || this.hashCode() != object.hashCode() ) {
+ return false;
}
- return object instanceof AlphaNode &&
- this.hashCode() == object.hashCode() &&
- (constraint instanceof MvelConstraint ?
+ return (constraint instanceof MvelConstraint ?
((MvelConstraint) constraint).equals(((AlphaNode)object).constraint, getKnowledgeBase()) :
constraint.equals(((AlphaNode)object).constraint));
}
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/BetaNode.java b/drools-core/src/main/java/org/drools/core/reteoo/BetaNode.java
index ba474e1f245..569b58e3520 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/BetaNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/BetaNode.java
@@ -100,8 +100,6 @@ public abstract class BetaNode extends LeftTupleSource
private boolean rightInputIsPassive;
- private int hashcode;
-
// ------------------------------------------------------------
// Constructors
// ------------------------------------------------------------
@@ -139,6 +137,8 @@ public BetaNode() {
initMasks(context, leftInput);
setStreamMode( context.isStreamMode() && getObjectTypeNode(context).getObjectType().isEvent() );
+
+ hashcode = calculateHashCode();
}
private ObjectTypeNode getObjectTypeNode(BuildContext context) {
@@ -308,7 +308,7 @@ public void modifyObject(InternalFactHandle factHandle, ModifyPreviousTuples mod
// we skipped this node, due to alpha hashing, so retract now
rightTuple.setPropagationContext( context );
- BetaMemory bm = getBetaMemory( (BetaNode) rightTuple.getTupleSink(), wm );
+ BetaMemory bm = getBetaMemory( rightTuple.getTupleSink(), wm );
(( BetaNode ) rightTuple.getTupleSink()).doDeleteRightTuple( rightTuple, wm, bm );
rightTuple = modifyPreviousTuples.peekRightTuple();
}
@@ -543,10 +543,7 @@ public LeftTupleSource getLeftTupleSource() {
return this.leftInput;
}
- /* (non-Javadoc)
- * @see org.kie.reteoo.BaseNode#hashCode()
- */
- public int hashCode() {
+ protected int calculateHashCode() {
int hash = ( 23 * leftInput.hashCode() ) + ( 29 * rightInput.hashCode() ) + ( 31 * constraints.hashCode() );
if (leftListenedProperties != null) {
hash += 37 * leftListenedProperties.hashCode();
@@ -557,31 +554,26 @@ public int hashCode() {
return hash + (rightInputIsPassive ? 43 : 0);
}
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(final Object object) {
- return thisNodeEquals(object);
+ @Override
+ public boolean equals(Object object) {
+ return this == object ||
+ ( internalEquals(object) &&
+ this.leftInput.thisNodeEquals( ((BetaNode) object).leftInput ) &&
+ this.rightInput.thisNodeEquals( ((BetaNode) object).rightInput ) );
}
- public boolean thisNodeEquals(final Object object) {
- if ( this == object ) {
- return true;
- }
-
- if ( object == null || !(object instanceof BetaNode) ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof BetaNode) || this.hashCode() != object.hashCode() ) {
return false;
}
- final BetaNode other = (BetaNode) object;
-
+ BetaNode other = (BetaNode) object;
return this.getClass() == other.getClass() &&
- this.leftInput.thisNodeEquals( other.leftInput ) &&
- this.rightInput.thisNodeEquals( other.rightInput ) &&
- this.constraints.equals( other.constraints ) &&
- this.rightInputIsPassive == other.rightInputIsPassive &&
- areNullSafeEquals(this.leftListenedProperties, other.leftListenedProperties) &&
- areNullSafeEquals(this.rightListenedProperties, other.rightListenedProperties);
+ this.constraints.equals( other.constraints ) &&
+ this.rightInputIsPassive == other.rightInputIsPassive &&
+ areNullSafeEquals(this.leftListenedProperties, other.leftListenedProperties) &&
+ areNullSafeEquals(this.rightListenedProperties, other.rightListenedProperties);
}
/**
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchNode.java
index 8ffeffb2a6d..3b7d3cce13d 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/ConditionalBranchNode.java
@@ -57,6 +57,8 @@ public ConditionalBranchNode( int id,
this.branchEvaluator = branchEvaluator;
initMasks(context, tupleSource);
+
+ hashcode = calculateHashCode();
}
@Override
@@ -101,22 +103,23 @@ public String toString() {
return "[ConditionalBranchNode: cond=" + this.branchEvaluator + "]";
}
- public int hashCode() {
+ private int calculateHashCode() {
return this.tupleSource.hashCode() ^ this.branchEvaluator.hashCode();
}
- public boolean equals(final Object object) {
- if ( this == object ) {
- return true;
- }
+ @Override
+ public boolean equals(Object object) {
+ return this == object ||
+ ( internalEquals( object ) && this.tupleSource.thisNodeEquals( ((ConditionalBranchNode)object).tupleSource ) );
+ }
- if ( object == null || object.getClass() != ConditionalBranchNode.class ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof ConditionalBranchNode) || this.hashCode() != object.hashCode() ) {
return false;
}
- final ConditionalBranchNode other = (ConditionalBranchNode) object;
-
- return this.tupleSource.equals( other.tupleSource ) && this.branchEvaluator.equals( other.branchEvaluator );
+ return this.branchEvaluator.equals( ((ConditionalBranchNode)object).branchEvaluator );
}
public ConditionalBranchMemory createMemory(final RuleBaseConfiguration config, InternalWorkingMemory wm) {
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java b/drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java
index 82fea528e77..9a6347ad456 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/EntryPointNode.java
@@ -108,6 +108,8 @@ public EntryPointNode(final int id,
999 ); // irrelevant for this node, since it overrides sink management
this.entryPoint = entryPoint;
this.objectTypeNodes = new ConcurrentHashMap<ObjectType, ObjectTypeNode>();
+
+ hashcode = calculateHashCode();
}
// ------------------------------------------------------------
@@ -421,21 +423,22 @@ public Map<ObjectType, ObjectTypeNode> getObjectTypeNodes() {
return this.objectTypeNodes;
}
- public int hashCode() {
+ private int calculateHashCode() {
return this.entryPoint.hashCode();
}
+ @Override
public boolean equals(final Object object) {
- if ( object == this ) {
- return true;
- }
+ return this == object || internalEquals( object );
+ }
- if ( object == null || !(object instanceof EntryPointNode) ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof EntryPointNode) || this.hashCode() != object.hashCode() ) {
return false;
}
- final EntryPointNode other = (EntryPointNode) object;
- return this.entryPoint.equals( other.entryPoint );
+ return this.entryPoint.equals( ((EntryPointNode)object).entryPoint );
}
public void updateSink(final ObjectSink sink,
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/EvalConditionNode.java b/drools-core/src/main/java/org/drools/core/reteoo/EvalConditionNode.java
index 606f176a2fc..9db6baba2c1 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/EvalConditionNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/EvalConditionNode.java
@@ -70,6 +70,8 @@ public EvalConditionNode(final int id,
this.tupleMemoryEnabled = context.isTupleMemoryEnabled();
initMasks(context, tupleSource);
+
+ hashcode = calculateHashCode();
}
public void readExternal(ObjectInput in) throws IOException,
@@ -127,22 +129,23 @@ public String toString() {
return "[EvalConditionNode: cond=" + this.condition + "]";
}
- public int hashCode() {
+ private int calculateHashCode() {
return this.leftInput.hashCode() ^ this.condition.hashCode();
}
+ @Override
public boolean equals(final Object object) {
- if ( this == object ) {
- return true;
- }
+ return this == object ||
+ ( internalEquals( object ) && this.leftInput.thisNodeEquals( ((EvalConditionNode)object).leftInput ) );
+ }
- if ( object == null || object.getClass() != EvalConditionNode.class ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof EvalConditionNode) || this.hashCode() != object.hashCode() ) {
return false;
}
- final EvalConditionNode other = (EvalConditionNode) object;
-
- return this.leftInput.equals( other.leftInput ) && this.condition.equals( other.condition );
+ return this.condition.equals( ((EvalConditionNode)object).condition );
}
public EvalMemory createMemory(final RuleBaseConfiguration config, InternalWorkingMemory wm) {
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java b/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java
index 9e96a2f4236..16bd9a8f4d2 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/FromNode.java
@@ -87,6 +87,8 @@ public FromNode(final int id,
resultClass = this.from.getResultClass();
initMasks(context, tupleSource);
+
+ hashcode = calculateHashCode();
}
public void readExternal(ObjectInput in) throws IOException,
@@ -109,19 +111,34 @@ public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject( from );
}
- @Override
- public boolean equals( Object obj ) {
- if (this == obj) {
- return true;
+ private int calculateHashCode() {
+ int hash = ( 23 * leftInput.hashCode() ) + ( 29 * dataProvider.hashCode() );
+ if (from.getResultPattern() != null) {
+ hash += 31 * from.getResultPattern().hashCode();
}
- if (obj == null || !(obj instanceof FromNode)) {
+ if (alphaConstraints != null) {
+ hash += 37 * Arrays.hashCode( alphaConstraints );
+ }
+ if (betaConstraints != null) {
+ hash += 41 * betaConstraints.hashCode();
+ }
+ return hash;
+ }
+
+ @Override
+ public boolean equals( Object object ) {
+ return this == object || (internalEquals( object ) && leftInput.thisNodeEquals( ((FromNode) object).leftInput ) );
+ }
+
+ @Override
+ protected boolean internalEquals( Object obj ) {
+ if (obj == null || !(obj instanceof FromNode ) || this.hashCode() != obj.hashCode() ) {
return false;
}
FromNode other = (FromNode) obj;
- return leftInput.equals( other.leftInput ) &&
- dataProvider.equals( other.dataProvider ) &&
+ return dataProvider.equals( other.dataProvider ) &&
areNullSafeEquals(from.getResultPattern(), other.from.getResultPattern() ) &&
Arrays.equals( alphaConstraints, other.alphaConstraints ) &&
betaConstraints.equals( other.betaConstraints );
@@ -220,8 +237,7 @@ public T createMemory(final RuleBaseConfiguration config, InternalWorkingMemory
this.betaConstraints.createContext(),
NodeTypeEnums.FromNode );
return (T) new FromMemory( beta,
- this.dataProvider,
- this.alphaConstraints );
+ this.dataProvider );
}
@@ -293,8 +309,7 @@ public static class FromMemory extends AbstractBaseLinkedListNode<Memory>
public Object providerContext;
public FromMemory(BetaMemory betaMemory,
- DataProvider dataProvider,
- AlphaNodeFieldConstraint[] constraints) {
+ DataProvider dataProvider) {
this.betaMemory = betaMemory;
this.dataProvider = dataProvider;
this.providerContext = dataProvider.createContext();
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java b/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java
index e987463b5dc..b004f42326c 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/LeftInputAdapterNode.java
@@ -70,8 +70,6 @@ public class LeftInputAdapterNode extends LeftTupleSource
private BitMask sinkMask;
- private int hashcode;
-
public LeftInputAdapterNode() {
}
@@ -126,7 +124,6 @@ public void readExternal(ObjectInput in) throws IOException,
objectSource = (ObjectSource) in.readObject();
leftTupleMemoryEnabled = in.readBoolean();
sinkMask = (BitMask) in.readObject();
- hashcode = in.readInt();
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -134,7 +131,6 @@ public void writeExternal(ObjectOutput out) throws IOException {
out.writeObject(objectSource);
out.writeBoolean(leftTupleMemoryEnabled);
out.writeObject(sinkMask);
- out.writeInt(hashcode);
}
public ObjectSource getObjectSource() {
@@ -475,27 +471,23 @@ public void setPreviousObjectSinkNode(final ObjectSinkNode previous) {
this.previousRightTupleSinkNode = previous;
}
- public int hashCode() {
- return hashcode;
- }
-
private int calculateHashCode() {
return 31 * this.objectSource.hashCode() + 37 * sinkMask.hashCode();
}
+ @Override
public boolean equals(final Object object) {
- return thisNodeEquals(object) &&
- this.objectSource.equals(((LeftInputAdapterNode)object).objectSource);
+ return this == object ||
+ ( internalEquals(object) &&
+ this.objectSource.equals(((LeftInputAdapterNode)object).objectSource) );
}
- public boolean thisNodeEquals(final Object object) {
- if ( object == this ) {
- return true;
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof LeftInputAdapterNode) || this.hashCode() != object.hashCode() ) {
+ return false;
}
-
- return object instanceof LeftInputAdapterNode &&
- this.hashCode() == object.hashCode() &&
- this.sinkMask.equals( ((LeftInputAdapterNode) object).sinkMask );
+ return this.sinkMask.equals( ((LeftInputAdapterNode) object).sinkMask );
}
protected ObjectTypeNode getObjectTypeNode() {
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingAlphaNode.java b/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingAlphaNode.java
index 61861305c1b..3446277154c 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingAlphaNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingAlphaNode.java
@@ -28,7 +28,7 @@ public boolean thisNodeEquals(final Object object) {
private void incrementCount(String key) {
if ( this.methodCount== null ) {
- this.methodCount = new HashMap<>();
+ this.methodCount = new HashMap<String, Integer>();
}
int count = methodCount.containsKey(key) ? methodCount.get(key) : 0;
methodCount.put(key, count + 1);
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingLeftInputAdapterNode.java b/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingLeftInputAdapterNode.java
index 81221555432..ccbae0a34db 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingLeftInputAdapterNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingLeftInputAdapterNode.java
@@ -26,7 +26,7 @@ public boolean thisNodeEquals(final Object object) {
private void incrementCount(String key) {
if ( this.methodCount== null ) {
- this.methodCount = new HashMap<>();
+ this.methodCount = new HashMap<String, Integer>();
}
int count = methodCount.containsKey(key) ? methodCount.get(key) : 0;
methodCount.put(key, count + 1);
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingObjectTypeNode.java b/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingObjectTypeNode.java
index 6cd8a8d6f88..0a8dacecb64 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingObjectTypeNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/MethodCountingObjectTypeNode.java
@@ -28,7 +28,7 @@ public boolean thisNodeEquals(final Object object) {
private void incrementCount(String key) {
if ( this.methodCount== null ) {
- this.methodCount = new HashMap<>();
+ this.methodCount = new HashMap<String, Integer>();
}
int count = methodCount.containsKey(key) ? methodCount.get(key) : 0;
methodCount.put(key, count + 1);
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java
index d275ab5e9a6..aa492b593d2 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/ObjectTypeNode.java
@@ -111,8 +111,6 @@ public int getOtnIdCounter() {
return idGenerator.otnIdCounter;
}
- private int hashcode;
-
public ObjectTypeNode() {
}
@@ -220,7 +218,6 @@ public void readExternal(ObjectInput in) throws IOException,
queryNode = in.readBoolean();
dirty = true;
idGenerator = new IdGenerator(id);
- hashcode = in.readInt();
}
public void writeExternal(ObjectOutput out) throws IOException {
@@ -229,7 +226,6 @@ public void writeExternal(ObjectOutput out) throws IOException {
out.writeBoolean(objectMemoryEnabled);
out.writeLong(expirationOffset);
out.writeBoolean(queryNode);
- out.writeInt(hashcode);
}
public short getType() {
@@ -488,29 +484,21 @@ public String toString() {
return "[ObjectTypeNode(" + this.id + ")::" + ((EntryPointNode) this.source).getEntryPoint() + " objectType=" + this.objectType + " expiration=" + this.getExpirationOffset() + "ms ]";
}
- /**
- * Uses he hashCode() of the underlying ObjectType implementation.
- */
- public int hashCode() {
- return hashcode;
- }
-
private int calculateHashCode() {
return (this.objectType != null ? this.objectType.hashCode() : 0) * 37 + (this.source != null ? this.source.hashCode() : 0) * 31;
}
public boolean equals(final Object object) {
- return thisNodeEquals(object) && this.source.equals(((ObjectTypeNode) object).source);
+ return this == object ||
+ (internalEquals(object) && this.source.thisNodeEquals(((ObjectTypeNode) object).source));
}
- public boolean thisNodeEquals(final Object object) {
- if (this == object) {
- return true;
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof ObjectTypeNode) || this.hashCode() != object.hashCode() ) {
+ return false;
}
-
- return object instanceof ObjectTypeNode &&
- this.hashCode() == object.hashCode() &&
- this.objectType.equals(((ObjectTypeNode) object).objectType);
+ return this.objectType.equals( ((ObjectTypeNode)object).objectType );
}
/**
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/PropagationQueuingNode.java b/drools-core/src/main/java/org/drools/core/reteoo/PropagationQueuingNode.java
index fd4d55769de..9aca81d0954 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/PropagationQueuingNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/PropagationQueuingNode.java
@@ -76,6 +76,8 @@ public PropagationQueuingNode(final int id,
context.getKnowledgeBase().getConfiguration().getAlphaNodeHashingThreshold() );
this.action = new PropagateAction( this );
initDeclaredMask(context);
+
+ hashcode = calculateHashCode();
}
@Override
@@ -259,31 +261,24 @@ public PropagationQueueingNodeMemory createMemory(RuleBaseConfiguration config,
return new PropagationQueueingNodeMemory();
}
- public int hashCode() {
+ public int calculateHashCode() {
return this.source.hashCode();
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ @Override
public boolean equals(final Object object) {
- if ( this == object ) {
- return true;
- }
+ return this == object ||
+ ( internalEquals( object ) && this.source.thisNodeEquals( ((PropagationQueuingNode)object).source ) );
+ }
- if ( object == null || !(object instanceof PropagationQueuingNode) ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof PropagationQueuingNode) || this.hashCode() != object.hashCode() ) {
return false;
}
-
- final PropagationQueuingNode other = (PropagationQueuingNode) object;
-
- return this.source.equals( other.source );
+ return true;
}
-
-
/**
* Memory implementation for the node
*/
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/QueryElementNode.java b/drools-core/src/main/java/org/drools/core/reteoo/QueryElementNode.java
index 19b4c9ce137..bc4f9ae28ad 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/QueryElementNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/QueryElementNode.java
@@ -92,6 +92,8 @@ public QueryElementNode(final int id,
this.dataDriven = context != null && context.getRule().isDataDriven();
initMasks( context, tupleSource );
initArgsTemplate( context );
+
+ hashcode = calculateHashCode();
}
private void initArgsTemplate(BuildContext context) {
@@ -603,8 +605,7 @@ public LeftTuple createLeftTuple(LeftTuple leftTuple,
leftTupleMemoryEnabled );
}
- @Override
- public int hashCode() {
+ private int calculateHashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + (openQuery ? 1231 : 1237);
@@ -614,19 +615,23 @@ public int hashCode() {
}
@Override
- public boolean equals(Object obj) {
- if ( this == obj ) return true;
- if ( obj == null ) return false;
- if ( getClass() != obj.getClass() ) return false;
- QueryElementNode other = (QueryElementNode) obj;
+ public boolean equals(Object object) {
+ return this == object ||
+ ( internalEquals( object ) && this.leftInput.thisNodeEquals( ((QueryElementNode)object).leftInput ) );
+ }
+
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof QueryElementNode) || this.hashCode() != object.hashCode() ) {
+ return false;
+ }
+
+ QueryElementNode other = (QueryElementNode) object;
if ( openQuery != other.openQuery ) return false;
if ( !openQuery && dataDriven != other.dataDriven ) return false;
if ( queryElement == null ) {
if ( other.queryElement != null ) return false;
} else if ( !queryElement.equals( other.queryElement ) ) return false;
- if ( leftInput == null ) {
- if ( other.leftInput != null ) return false;
- } else if ( !leftInput.equals( other.leftInput ) ) return false;
return true;
}
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/QueryRiaFixerNode.java b/drools-core/src/main/java/org/drools/core/reteoo/QueryRiaFixerNode.java
index ce7ff9bcd04..8ad19b264b5 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/QueryRiaFixerNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/QueryRiaFixerNode.java
@@ -70,6 +70,8 @@ public QueryRiaFixerNode(final int id,
super(id, context);
setLeftTupleSource(tupleSource);
this.tupleMemoryEnabled = context.isTupleMemoryEnabled();
+
+ hashcode = calculateHashCode();
}
public void readExternal(ObjectInput in) throws IOException,
@@ -148,15 +150,22 @@ public String toString() {
return "[RiaQueryFixerNode: ]";
}
- public int hashCode() {
+ public int calculateHashCode() {
return this.leftInput.hashCode();
}
+ @Override
public boolean equals(final Object object) {
// we never node share, so only return true if we are instance equal
return this == object;
}
+ @Override
+ protected boolean internalEquals(final Object object) {
+ // we never node share, so only return true if we are instance equal
+ return this == object;
+ }
+
public void updateSink(final LeftTupleSink sink,
final PropagationContext context,
final InternalWorkingMemory workingMemory) {
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/QueryTerminalNode.java b/drools-core/src/main/java/org/drools/core/reteoo/QueryTerminalNode.java
index bce044c86de..73bf10cb8ce 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/QueryTerminalNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/QueryTerminalNode.java
@@ -91,6 +91,8 @@ public QueryTerminalNode(final int id,
initDeclaredMask(context);
initInferredMask();
initDeclarations();
+
+ hashcode = calculateHashCode();
}
// ------------------------------------------------------------
@@ -120,13 +122,27 @@ public RuleImpl getRule() {
return this.query;
}
+ private int calculateHashCode() {
+ return this.query.hashCode();
+ }
+ @Override
+ public boolean equals(final Object object) {
+ return this == object || internalEquals( (Rete) object );
+ }
+
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof QueryTerminalNode) || this.hashCode() != object.hashCode() ) {
+ return false;
+ }
+ return query.equals(((QueryTerminalNode) object).query);
+ }
public String toString() {
return "[QueryTerminalNode(" + this.getId() + "): query=" + this.query.getName() + "]";
}
-
/**
* @return the subrule
*/
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/ReactiveFromNode.java b/drools-core/src/main/java/org/drools/core/reteoo/ReactiveFromNode.java
index 3fb1c4cbea3..00f6e08be9f 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/ReactiveFromNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/ReactiveFromNode.java
@@ -47,8 +47,7 @@ public ReactiveFromMemory createMemory(final RuleBaseConfiguration config, Inter
this.betaConstraints.createContext(),
NodeTypeEnums.FromNode );
return new ReactiveFromMemory( beta,
- this.dataProvider,
- this.alphaConstraints );
+ this.dataProvider );
}
public short getType() {
@@ -62,9 +61,8 @@ public static class ReactiveFromMemory extends FromNode.FromMemory {
private final TupleSets<LeftTuple> stagedLeftTuples;
public ReactiveFromMemory(BetaMemory betaMemory,
- DataProvider dataProvider,
- AlphaNodeFieldConstraint[] constraints) {
- super(betaMemory, dataProvider, constraints);
+ DataProvider dataProvider) {
+ super(betaMemory, dataProvider);
stagedLeftTuples = new TupleSetsImpl<LeftTuple>();
}
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/Rete.java b/drools-core/src/main/java/org/drools/core/reteoo/Rete.java
index f7d33ef6405..4babb8d4187 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/Rete.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/Rete.java
@@ -81,6 +81,8 @@ public Rete(InternalKnowledgeBase kBase) {
super( 0, RuleBasePartitionId.MAIN_PARTITION, kBase != null && kBase.getConfiguration().isMultithreadEvaluation() );
this.entryPoints = Collections.synchronizedMap( new HashMap<EntryPointId, EntryPointNode>() );
this.kBase = kBase;
+
+ hashcode = calculateHashCode();
}
public short getType() {
@@ -199,21 +201,20 @@ public InternalKnowledgeBase getKnowledgeBase() {
return this.kBase;
}
- public int hashCode() {
+ private int calculateHashCode() {
return this.entryPoints.hashCode();
}
public boolean equals(final Object object) {
- if ( object == this ) {
- return true;
- }
+ return this == object || internalEquals( object );
+ }
- if ( object == null || !(object instanceof Rete) ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof Rete) || this.hashCode() != object.hashCode() ) {
return false;
}
-
- final Rete other = (Rete) object;
- return this.entryPoints.equals( other.entryPoints );
+ return this.entryPoints.equals( ((Rete)object).entryPoints );
}
public void updateSink(final ObjectSink sink,
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RightInputAdapterNode.java b/drools-core/src/main/java/org/drools/core/reteoo/RightInputAdapterNode.java
index 0712342e9e5..2ba182c0aa8 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/RightInputAdapterNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/RightInputAdapterNode.java
@@ -86,6 +86,8 @@ public RightInputAdapterNode(final int id,
this.tupleMemoryEnabled = context.isTupleMemoryEnabled();
this.startTupleSource = startTupleSource;
context.getPathEndNodes().add(this);
+
+ hashcode = calculateHashCode();
}
public void readExternal(ObjectInput in) throws IOException,
@@ -255,27 +257,23 @@ public short getType() {
return NodeTypeEnums.RightInputAdaterNode;
}
- public int hashCode() {
+ private int calculateHashCode() {
return this.tupleSource.hashCode() * 17 + ((this.tupleMemoryEnabled) ? 1234 : 4321);
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(final Object object) {
- if ( this == object ) {
- return true;
- }
+ @Override
+ public boolean equals(Object object) {
+ return this == object ||
+ ( internalEquals( object ) && this.tupleSource.thisNodeEquals( ((RightInputAdapterNode)object).tupleSource ) );
+ }
- if ( object == null || !(object instanceof RightInputAdapterNode) ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof RightInputAdapterNode) || this.hashCode() != object.hashCode() ) {
return false;
}
- final RightInputAdapterNode other = (RightInputAdapterNode) object;
-
- return this.tupleMemoryEnabled == other.tupleMemoryEnabled && this.tupleSource.equals( other.tupleSource );
+ return this.tupleMemoryEnabled == ((RightInputAdapterNode)object).tupleMemoryEnabled;
}
@Override
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNode.java b/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNode.java
index a869396ded9..a8c4839304c 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/RuleTerminalNode.java
@@ -115,6 +115,8 @@ public RuleTerminalNode(final int id,
initDeclaredMask(context);
initInferredMask();
+
+ hashcode = calculateHashCode();
}
public void setDeclarations(Map<String, Declaration> decls) {
@@ -330,19 +332,20 @@ public void setPreviousLeftTupleSinkNode(final LeftTupleSinkNode previous) {
this.previousTupleSinkNode = previous;
}
- public int hashCode() {
- return this.rule.hashCode();
+ private int calculateHashCode() {
+ return 31 * this.rule.hashCode() + (consequenceName == null ? 0 : 37 * consequenceName.hashCode());
}
+ @Override
public boolean equals(final Object object) {
- if ( object == this ) {
- return true;
- }
+ return this == object || internalEquals( object );
+ }
- if ( !(object instanceof RuleTerminalNode) ) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof RuleTerminalNode) || this.hashCode() != object.hashCode() ) {
return false;
}
-
final RuleTerminalNode other = (RuleTerminalNode) object;
return rule.equals(other.rule) && (consequenceName == null ? other.consequenceName == null : consequenceName.equals(other.consequenceName));
}
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java b/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java
index 8fd1a063c79..d71c8bded91 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/TimerNode.java
@@ -68,6 +68,8 @@ public TimerNode(final int id,
this.tupleMemoryEnabled = context.isTupleMemoryEnabled();
initMasks(context, tupleSource);
+
+ hashcode = calculateHashCode();
}
public void readExternal(ObjectInput in) throws IOException,
@@ -125,7 +127,7 @@ public String toString() {
return "[TimerNode(" + this.id + "): cond=" + this.timer + " calendars=" + ((calendarNames == null) ? "null" : Arrays.asList(calendarNames)) + "]";
}
- public int hashCode() {
+ private int calculateHashCode() {
int hash = this.leftInput.hashCode() ^ this.timer.hashCode();
if (calendarNames != null) {
for ( String calendarName : calendarNames ) {
@@ -136,16 +138,17 @@ public int hashCode() {
}
public boolean equals(final Object object) {
- if (this == object) {
- return true;
- }
+ return this == object ||
+ ( internalEquals( object ) && this.leftInput.thisNodeEquals(((TimerNode)object).leftInput) );
+ }
- if (object == null || object.getClass() != TimerNode.class) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof TimerNode) || this.hashCode() != object.hashCode() ) {
return false;
}
- final TimerNode other = (TimerNode) object;
-
+ TimerNode other = (TimerNode) object;
if (calendarNames != null) {
if (other.getCalendarNames() == null || other.getCalendarNames().length != calendarNames.length) {
return false;
@@ -158,8 +161,8 @@ public boolean equals(final Object object) {
}
}
- return Arrays.deepEquals(declarations, other.declarations) &&
- this.timer.equals(other.timer) && this.leftInput.equals(other.leftInput);
+ return Arrays.deepEquals( declarations, other.declarations ) &&
+ this.timer.equals(other.timer);
}
public TimerNodeMemory createMemory(final RuleBaseConfiguration config, InternalWorkingMemory wm) {
diff --git a/drools-core/src/main/java/org/drools/core/reteoo/WindowNode.java b/drools-core/src/main/java/org/drools/core/reteoo/WindowNode.java
index 966f5a7ca3b..5e24b02eddc 100644
--- a/drools-core/src/main/java/org/drools/core/reteoo/WindowNode.java
+++ b/drools-core/src/main/java/org/drools/core/reteoo/WindowNode.java
@@ -97,6 +97,8 @@ public WindowNode(final int id,
}
}
epNode = (EntryPointNode) getObjectTypeNode().getParentObjectSource();
+
+ hashcode = calculateHashCode();
}
@SuppressWarnings("unchecked")
@@ -283,27 +285,23 @@ public String toString() {
return "[WindowNode(" + this.id + ") constraints=" + this.constraints + "]";
}
- public int hashCode() {
+ private int calculateHashCode() {
return this.source.hashCode() * 17 + ((this.constraints != null) ? this.constraints.hashCode() : 0);
}
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Object#equals(java.lang.Object)
- */
+ @Override
public boolean equals(final Object object) {
- if (this == object) {
- return true;
- }
+ return this == object ||
+ ( internalEquals( object ) && this.source.thisNodeEquals(((WindowNode) object).source) );
+ }
- if (object == null || !(object instanceof WindowNode)) {
+ @Override
+ protected boolean internalEquals( Object object ) {
+ if ( object == null || !(object instanceof WindowNode) || this.hashCode() != object.hashCode() ) {
return false;
}
-
- final WindowNode other = (WindowNode) object;
-
- return this.source.equals(other.source) && this.constraints.equals(other.constraints) && behavior.equals(other.behavior);
+ WindowNode other = (WindowNode) object;
+ return this.constraints.equals(other.constraints) && behavior.equals(other.behavior);
}
/**
diff --git a/drools-core/src/main/java/org/drools/core/rule/From.java b/drools-core/src/main/java/org/drools/core/rule/From.java
index 6da1d705294..1453b82ad89 100644
--- a/drools-core/src/main/java/org/drools/core/rule/From.java
+++ b/drools-core/src/main/java/org/drools/core/rule/From.java
@@ -81,7 +81,12 @@ public boolean equals( Object obj ) {
return dataProvider.equals( ((From) obj).dataProvider );
}
- public void wire(Object object) {
+ @Override
+ public int hashCode() {
+ return dataProvider.hashCode();
+ }
+
+ public void wire( Object object ) {
this.dataProvider = KiePolicyHelper.isPolicyEnabled() ? new SafeDataProvider(( DataProvider ) object) : ( DataProvider ) object;
}
@@ -176,6 +181,16 @@ public void replaceDeclaration(Declaration declaration, Declaration resolved) {
public SafeDataProvider clone() {
return new SafeDataProvider( delegate.clone() );
}
+
+ @Override
+ public boolean equals( Object obj ) {
+ return delegate.equals( obj );
+ }
+
+ @Override
+ public int hashCode() {
+ return delegate.hashCode();
+ }
}
@Override
diff --git a/drools-core/src/main/java/org/drools/core/rule/constraint/XpathConstraint.java b/drools-core/src/main/java/org/drools/core/rule/constraint/XpathConstraint.java
index 452cef98ad6..3a877242998 100644
--- a/drools-core/src/main/java/org/drools/core/rule/constraint/XpathConstraint.java
+++ b/drools-core/src/main/java/org/drools/core/rule/constraint/XpathConstraint.java
@@ -225,6 +225,11 @@ public boolean equals( Object obj ) {
return chunk.equals( other.chunk );
}
+
+ @Override
+ public int hashCode() {
+ return chunk.hashCode();
+ }
}
public static class XpathChunk implements AcceptsClassObjectType {
@@ -422,6 +427,24 @@ public boolean equals( Object obj ) {
array == other.array &&
areNullSafeEquals(declaration, other.declaration);
}
+
+ @Override
+ public int hashCode() {
+ int hash = 23 * field.hashCode() + 29 * index;
+ if (declaration != null) {
+ hash += 31 * declaration.hashCode();
+ }
+ if (iterate) {
+ hash += 37;
+ }
+ if (lazy) {
+ hash += 41;
+ }
+ if (array) {
+ hash += 43;
+ }
+ return hash;
+ }
}
public static class XpathDataProvider implements DataProvider {
@@ -485,5 +508,14 @@ public boolean equals( Object obj ) {
return xpathEvaluator.equals( other.xpathEvaluator ) &&
areNullSafeEquals(declaration, other.declaration);
}
+
+ @Override
+ public int hashCode() {
+ int hash = 31 * xpathEvaluator.hashCode();
+ if (declaration != null) {
+ hash += 37 * declaration.hashCode();
+ }
+ return hash;
+ }
}
}
diff --git a/drools-core/src/main/java/org/drools/core/spi/DataProvider.java b/drools-core/src/main/java/org/drools/core/spi/DataProvider.java
index b976b4c2199..8cb11a2c1a5 100644
--- a/drools-core/src/main/java/org/drools/core/spi/DataProvider.java
+++ b/drools-core/src/main/java/org/drools/core/spi/DataProvider.java
@@ -27,18 +27,18 @@ public interface DataProvider
Serializable,
Cloneable {
- public Declaration[] getRequiredDeclarations();
+ Declaration[] getRequiredDeclarations();
- public Object createContext();
+ Object createContext();
- public Iterator getResults(Tuple tuple,
- InternalWorkingMemory wm,
- PropagationContext ctx,
- Object providerContext);
+ Iterator getResults(Tuple tuple,
+ InternalWorkingMemory wm,
+ PropagationContext ctx,
+ Object providerContext);
- public DataProvider clone();
+ DataProvider clone();
- public void replaceDeclaration(Declaration declaration,
- Declaration resolved);
+ void replaceDeclaration(Declaration declaration,
+ Declaration resolved);
}
diff --git a/drools-core/src/main/java/org/drools/core/spi/EvalExpression.java b/drools-core/src/main/java/org/drools/core/spi/EvalExpression.java
index bbc78706887..9ce6cc8091a 100644
--- a/drools-core/src/main/java/org/drools/core/spi/EvalExpression.java
+++ b/drools-core/src/main/java/org/drools/core/spi/EvalExpression.java
@@ -24,15 +24,15 @@ public interface EvalExpression
Invoker,
Cloneable {
- public Object createContext();
+ Object createContext();
- public boolean evaluate(Tuple tuple,
- Declaration[] requiredDeclarations,
- WorkingMemory workingMemory,
- Object context ) throws Exception;
+ boolean evaluate(Tuple tuple,
+ Declaration[] requiredDeclarations,
+ WorkingMemory workingMemory,
+ Object context ) throws Exception;
- public void replaceDeclaration(Declaration declaration,
- Declaration resolved);
-
- public EvalExpression clone();
+ void replaceDeclaration(Declaration declaration,
+ Declaration resolved);
+
+ EvalExpression clone();
}
diff --git a/drools-core/src/test/java/org/drools/core/reteoo/BaseNodeTest.java b/drools-core/src/test/java/org/drools/core/reteoo/BaseNodeTest.java
index 884d1357a1b..d638e1e1af4 100644
--- a/drools-core/src/test/java/org/drools/core/reteoo/BaseNodeTest.java
+++ b/drools-core/src/test/java/org/drools/core/reteoo/BaseNodeTest.java
@@ -78,6 +78,9 @@ public short getType() {
return 0;
}
+ @Override
+ protected boolean internalEquals( Object object ) {
+ return false;
+ }
}
-
}
diff --git a/drools-core/src/test/java/org/drools/core/reteoo/MockLeftTupleSink.java b/drools-core/src/test/java/org/drools/core/reteoo/MockLeftTupleSink.java
index 6c6fd19e4b8..6f4cccb4a54 100644
--- a/drools-core/src/test/java/org/drools/core/reteoo/MockLeftTupleSink.java
+++ b/drools-core/src/test/java/org/drools/core/reteoo/MockLeftTupleSink.java
@@ -207,4 +207,8 @@ public LeftTuple createPeer(LeftTuple original) {
return null;
}
+ @Override
+ protected boolean internalEquals( Object object ) {
+ return false;
+ }
}
diff --git a/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSource.java b/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSource.java
index 4ce7aaad652..191708d0a12 100644
--- a/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSource.java
+++ b/drools-core/src/test/java/org/drools/core/reteoo/MockObjectSource.java
@@ -105,6 +105,10 @@ public short getType() {
@Override
public BitMask calculateDeclaredMask(List<String> settableProperties) {
throw new UnsupportedOperationException();
- }
+ }
+ @Override
+ protected boolean internalEquals( Object object ) {
+ return false;
+ }
}
diff --git a/drools-core/src/test/java/org/drools/core/reteoo/MockTupleSource.java b/drools-core/src/test/java/org/drools/core/reteoo/MockTupleSource.java
index a084a529a81..c117b1d3a14 100644
--- a/drools-core/src/test/java/org/drools/core/reteoo/MockTupleSource.java
+++ b/drools-core/src/test/java/org/drools/core/reteoo/MockTupleSource.java
@@ -82,4 +82,8 @@ public LeftTuple createPeer(LeftTuple original) {
return null;
}
+ @Override
+ protected boolean internalEquals( Object object ) {
+ return false;
+ }
}
|
67e2f786527f8ccbecf9d83f0ba7c5856e2efbcd
|
Vala
|
glib-2.0: set default value of StringBuilder.truncate to 0
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index fb2aa4cce3..ffd6c4fbca 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -3444,7 +3444,7 @@ namespace GLib {
public unowned StringBuilder prepend_len (string val, ssize_t len);
public unowned StringBuilder insert (ssize_t pos, string val);
public unowned StringBuilder erase (ssize_t pos = 0, ssize_t len = -1);
- public unowned StringBuilder truncate (size_t len);
+ public unowned StringBuilder truncate (size_t len = 0);
[PrintfFormat]
public void printf (string format, ...);
|
11500497c9cf49e36fa4fee2591940ed71a1d9e2
|
Vala
|
gdk-2.0: buf argument of gdk_draw_*_image doesn't have an array length
Fixes bug 617534.
|
c
|
https://github.com/GNOME/vala/
|
diff --git a/vapi/gdk-2.0.vapi b/vapi/gdk-2.0.vapi
index 966206981b..d5f4f16730 100644
--- a/vapi/gdk-2.0.vapi
+++ b/vapi/gdk-2.0.vapi
@@ -1633,11 +1633,11 @@ namespace Gdk {
[CCode (cheader_filename = "gdk/gdk.h")]
public static void draw_glyphs_transformed (Gdk.Drawable drawable, Gdk.GC gc, Pango.Matrix matrix, Pango.Font font, int x, int y, Pango.GlyphString glyphs);
[CCode (cheader_filename = "gdk/gdk.h")]
- public static void draw_gray_image (Gdk.Drawable drawable, Gdk.GC gc, int x, int y, int width, int height, Gdk.RgbDither dith, uchar[] buf, int rowstride);
+ public static void draw_gray_image (Gdk.Drawable drawable, Gdk.GC gc, int x, int y, int width, int height, Gdk.RgbDither dith, [CCode (array_length = false)] uchar[] buf, int rowstride);
[CCode (cheader_filename = "gdk/gdk.h")]
public static void draw_image (Gdk.Drawable drawable, Gdk.GC gc, Gdk.Image image, int xsrc, int ysrc, int xdest, int ydest, int width, int height);
[CCode (cheader_filename = "gdk/gdk.h")]
- public static void draw_indexed_image (Gdk.Drawable drawable, Gdk.GC gc, int x, int y, int width, int height, Gdk.RgbDither dith, uchar[] buf, int rowstride, Gdk.RgbCmap cmap);
+ public static void draw_indexed_image (Gdk.Drawable drawable, Gdk.GC gc, int x, int y, int width, int height, Gdk.RgbDither dith, [CCode (array_length = false)] uchar[] buf, int rowstride, Gdk.RgbCmap cmap);
[CCode (cheader_filename = "gdk/gdk.h")]
public static void draw_layout (Gdk.Drawable drawable, Gdk.GC gc, int x, int y, Pango.Layout layout);
[CCode (cheader_filename = "gdk/gdk.h")]
diff --git a/vapi/packages/gdk-2.0/gdk-2.0.metadata b/vapi/packages/gdk-2.0/gdk-2.0.metadata
index 9be7c563e2..4bdfc8a508 100644
--- a/vapi/packages/gdk-2.0/gdk-2.0.metadata
+++ b/vapi/packages/gdk-2.0/gdk-2.0.metadata
@@ -33,7 +33,7 @@ gdk_display_manager_list_displays type_arguments="unowned Display" transfer_owne
gdk_drawable_draw_* hidden="1"
gdk_drawable_get_size.width is_out="1"
gdk_drawable_get_size.height is_out="1"
-gdk_draw_rgb*_image*.buf no_array_length="1"
+gdk_draw_*_image*.buf no_array_length="1"
gdk_draw_rgb*_image*.rgb_buf no_array_length="1"
gdk_gc_get_values.values is_out="1"
GdkEvent is_value_type="0"
|
ea630c53ad06b868112d6b23fb7feeb632538731
|
Valadoc
|
libvaladoc: Add metadata for gtkdoclet
|
c
|
https://github.com/GNOME/vala/
|
diff --git a/src/driver/0.10.x/treebuilder.vala b/src/driver/0.10.x/treebuilder.vala
index 567f1dc498..029a5f171d 100644
--- a/src/driver/0.10.x/treebuilder.vala
+++ b/src/driver/0.10.x/treebuilder.vala
@@ -238,16 +238,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
}
}
- private SourceComment? create_comment (Vala.Comment? comment) {
- if (comment != null) {
- Vala.SourceReference pos = comment.source_reference;
- SourceFile file = files.get (pos.file);
- return new SourceComment (comment.content, file, pos.first_line, pos.first_column, pos.last_line, pos.last_column);
- }
-
- return null;
- }
-
private string get_method_name (Vala.Method element) {
if (element is Vala.CreationMethod) {
if (element.name == ".new") {
@@ -260,6 +250,93 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return element.name;
}
+ private string? get_quark_macro_name (Vala.ErrorDomain element) {
+ return element.get_upper_case_cname ();
+ }
+
+ private string? get_private_cname (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ string? cname = element.get_cname ();
+ return (cname != null)? cname + "Private" : null;
+ }
+
+ private string? get_class_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ return "%s_GET_CLASS".printf (element.get_upper_case_cname ());
+ }
+
+ private string? get_class_type_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ return "%s_CLASS".printf (element.get_upper_case_cname ());
+ }
+
+ private string? get_is_type_macro_name (Vala.TypeSymbol element) {
+ var cl = element as Vala.Class;
+ if (cl != null && cl.type_check_function != null) {
+ return cl.type_check_function;
+ } else if ((cl != null && cl.is_compact) || element is Vala.Struct || element is Vala.Enum || element is Vala.Delegate) {
+ return null;
+ } else {
+ return element.get_upper_case_cname ("IS_");
+ }
+ }
+
+ private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
+ string? name = get_is_type_macro_name (element);
+ return (name != null)? name + "_CLASS" : null;
+ }
+
+ private string? get_type_function_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+ return "%s_get_type".printf (element.get_lower_case_cname ());
+ }
+
+ private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && !((Vala.Class) element).is_compact) || element is Vala.Interface) {
+ return element.get_upper_case_cname ();
+ } else {
+ return null;
+ }
+ }
+
+ private string? get_type_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+ return element.get_type_id ();
+ }
+
+ private string? get_interface_macro_name (Vala.Interface element) {
+ return "%s_GET_INTERFACE".printf (element.get_upper_case_cname ());
+ }
+
+ private string get_quark_function_name (Vala.ErrorDomain element) {
+ return element.get_lower_case_cprefix () + "quark";
+ }
+
+ private SourceComment? create_comment (Vala.Comment? comment) {
+ if (comment != null) {
+ Vala.SourceReference pos = comment.source_reference;
+ SourceFile file = files.get (pos.file);
+ return new SourceComment (comment.content, file, pos.first_line, pos.first_column, pos.last_line, pos.last_column);
+ }
+
+ return null;
+ }
+
private PackageMetaData? get_package_meta_data (Package pkg) {
foreach (PackageMetaData data in packages) {
if (data.package == pkg) {
@@ -783,7 +860,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), Vala.GDBusModule.get_dbus_name (element), element.get_type_id (), element.get_param_spec_function (), element.get_ref_function (), element.get_unref_function (), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element.get_type_id (), element.get_param_spec_function (), element.get_ref_function (), element.get_unref_function (), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -815,7 +892,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), Vala.GDBusModule.get_dbus_name (element), element);
+ Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_interface_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -843,7 +920,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_type == null && (element.is_boolean_type () || element.is_floating_type () || element.is_integer_type ());
- Struct node = new Struct (parent, file, element.name, get_access_modifier (element), comment, element.get_cname(), element.get_type_id (), element.get_dup_function (), element.get_free_function (), is_basic_type, element);
+ Struct node = new Struct (parent, file, element.name, get_access_modifier (element), comment, element.get_cname(), get_type_macro_name (element), get_type_function_name (element), element.get_type_id (), element.get_dup_function (), element.get_free_function (), is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -978,7 +1055,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new Api.Enum (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), element);
+ Symbol node = new Api.Enum (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), get_type_macro_name (element), get_type_function_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1027,7 +1104,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier(element), comment, element.get_cname(), Vala.GDBusModule.get_dbus_name (element), element);
+ Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), get_quark_macro_name (element), get_quark_function_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/driver/0.12.x/treebuilder.vala b/src/driver/0.12.x/treebuilder.vala
index 9f2807487a..442329919a 100644
--- a/src/driver/0.12.x/treebuilder.vala
+++ b/src/driver/0.12.x/treebuilder.vala
@@ -240,6 +240,83 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
}
}
+ private string? get_quark_macro_name (Vala.ErrorDomain element) {
+ return element.get_upper_case_cname ();
+ }
+
+ private string? get_private_cname (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ string? cname = element.get_cname ();
+ return (cname != null)? cname + "Private" : null;
+ }
+
+ private string? get_class_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ return "%s_GET_CLASS".printf (element.get_upper_case_cname ());
+ }
+
+ private string? get_class_type_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ return "%s_CLASS".printf (element.get_upper_case_cname ());
+ }
+
+ private string? get_is_type_macro_name (Vala.TypeSymbol element) {
+ var cl = element as Vala.Class;
+ if (cl != null && cl.type_check_function != null) {
+ return cl.type_check_function;
+ } else if ((cl != null && cl.is_compact) || element is Vala.Struct || element is Vala.Enum || element is Vala.Delegate) {
+ return null;
+ } else {
+ return element.get_upper_case_cname ("IS_");
+ }
+ }
+
+ private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
+ string? name = get_is_type_macro_name (element);
+ return (name != null)? name + "_CLASS" : null;
+ }
+
+ private string? get_type_function_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+ return "%s_get_type".printf (element.get_lower_case_cname ());
+ }
+
+ private string? get_type_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+ return element.get_type_id ();
+ }
+
+ private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && !((Vala.Class) element).is_compact) || element is Vala.Interface) {
+ return element.get_upper_case_cname ();
+ } else {
+ return null;
+ }
+ }
+
+ private string? get_interface_macro_name (Vala.Interface element) {
+ return "%s_GET_INTERFACE".printf (element.get_upper_case_cname ());
+ }
+
+ private string get_quark_function_name (Vala.ErrorDomain element) {
+ return element.get_lower_case_cprefix () + "quark";
+ }
+
private SourceComment? create_comment (Vala.Comment? comment) {
if (comment != null) {
Vala.SourceReference pos = comment.source_reference;
@@ -834,7 +911,8 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), Vala.GDBusModule.get_dbus_name (element), element.get_type_id (), element.get_param_spec_function (), element.get_ref_function (), element.get_unref_function (), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element.get_type_id (), element.get_param_spec_function (), element.get_ref_function (), element.get_unref_function (), element.get_take_value_function (), element.get_get_value_function (), element.get_set_value_function (), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+
symbol_map.set (element, node);
parent.add_child (node);
@@ -866,7 +944,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), Vala.GDBusModule.get_dbus_name (element), element);
+ Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_interface_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -894,7 +972,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_type == null && (element.is_boolean_type () || element.is_floating_type () || element.is_integer_type ());
- Struct node = new Struct (parent, file, element.name, get_access_modifier(element), comment, element.get_cname(), element.get_type_id (), element.get_dup_function (), element.get_free_function (), is_basic_type, element);
+ Struct node = new Struct (parent, file, element.name, get_access_modifier(element), comment, element.get_cname(), get_type_macro_name (element), get_type_function_name (element), element.get_type_id (), element.get_dup_function (), element.get_free_function (), is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1034,7 +1112,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), element);
+ Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, element.get_cname (), get_type_macro_name (element), get_type_function_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1083,7 +1161,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier(element), comment, element.get_cname(), Vala.GDBusModule.get_dbus_name (element), element);
+ Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier (element), comment, element.get_cname (), get_quark_macro_name (element), get_quark_function_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/driver/0.14.x/treebuilder.vala b/src/driver/0.14.x/treebuilder.vala
index e0f64e6082..022679b8e8 100644
--- a/src/driver/0.14.x/treebuilder.vala
+++ b/src/driver/0.14.x/treebuilder.vala
@@ -358,7 +358,6 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
} else if (symbol is Vala.Field) {
return ((Vala.Field) symbol).get_cname ();
} else {
-message ("--%s--", symbol.name);
assert_not_reached ();
}
#else
@@ -366,6 +365,121 @@ message ("--%s--", symbol.name);
#endif
}
+ private string? get_quark_macro_name (Vala.ErrorDomain element) {
+#if VALA_0_13_0 || VALA_0_13_1
+ return element.get_upper_case_cname ();
+#else
+ return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
+#endif
+ }
+
+ private string? get_private_cname (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ string? cname = get_cname (element);
+ return (cname != null)? cname + "Private" : null;
+ }
+
+ private string? get_class_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+#if VALA_0_13_0 || VALA_0_13_1
+ return "%s_GET_CLASS".printf (element.get_upper_case_cname ());
+#else
+ return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+#endif
+ }
+
+ private string? get_class_type_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+#if VALA_0_13_0 || VALA_0_13_1
+ return "%s_CLASS".printf (element.get_upper_case_cname ());
+#else
+ return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+#endif
+ }
+
+ private string? get_is_type_macro_name (Vala.TypeSymbol element) {
+#if VALA_0_13_0 || VALA_0_13_1
+ var cl = element as Vala.Class;
+ if (cl != null && cl.type_check_function != null) {
+ return cl.type_check_function;
+ } else if ((cl != null && cl.is_compact) || element is Vala.Struct || element is Vala.Enum || element is Vala.Delegate) {
+ return null;
+ } else {
+ return element.get_upper_case_cname ("IS_");
+ }
+#else
+ string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
+ return (name != null && name != "")? name : null;
+#endif
+ }
+
+ private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
+ string? name = get_is_type_macro_name (element);
+ return (name != null)? name + "_CLASS" : null;
+ }
+
+ private string? get_type_function_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+#if VALA_0_13_0 || VALA_0_13_1
+ return "%s_get_type".printf (element.get_lower_case_cname ());
+#else
+ return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
+#endif
+ }
+
+ private string? get_type_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+
+#if VALA_0_13_0 || VALA_0_13_1
+ return element.get_type_id ();
+#else
+ return Vala.CCodeBaseModule.get_ccode_type_id (element);
+#endif
+ }
+
+ private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && !((Vala.Class) element).is_compact) || element is Vala.Interface) {
+#if VALA_0_13_0 || VALA_0_13_1
+ return element.get_upper_case_cname ();
+#else
+ return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
+#endif
+ } else {
+ return null;
+ }
+ }
+
+ private string? get_interface_macro_name (Vala.Interface element) {
+#if VALA_0_13_0 || VALA_0_13_1
+ return "%s_GET_INTERFACE".printf (element.get_upper_case_cname ());
+#else
+ return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+#endif
+ }
+
+ private string get_quark_function_name (Vala.ErrorDomain element) {
+#if VALA_0_13_0 || VALA_0_13_1
+ return element.get_lower_case_cprefix () + "quark";
+#else
+ return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
+#endif
+ }
+
private SourceComment? create_comment (Vala.Comment? comment) {
if (comment != null) {
Vala.SourceReference pos = comment.source_reference;
@@ -901,7 +1015,8 @@ message ("--%s--", symbol.name);
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+
symbol_map.set (element, node);
parent.add_child (node);
@@ -933,7 +1048,7 @@ message ("--%s--", symbol.name);
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name (element), element);
+ Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_interface_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -961,7 +1076,7 @@ message ("--%s--", symbol.name);
bool is_basic_type = element.base_type == null && (element.is_boolean_type () || element.is_floating_type () || element.is_integer_type ());
- Struct node = new Struct (parent, file, element.name, get_access_modifier(element), comment, get_cname(element), get_ccode_type_id (element), get_dup_function (element), get_free_function (element), is_basic_type, element);
+ Struct node = new Struct (parent, file, element.name, get_access_modifier(element), comment, get_cname(element), get_type_macro_name (element), get_type_function_name (element), get_ccode_type_id (element), get_dup_function (element), get_free_function (element), is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1096,7 +1211,7 @@ message ("--%s--", symbol.name);
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element);
+ Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), get_type_macro_name (element), get_type_function_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1145,7 +1260,7 @@ message ("--%s--", symbol.name);
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier(element), comment, get_cname(element), Vala.GDBusModule.get_dbus_name (element), element);
+ Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_quark_macro_name (element), get_quark_function_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/driver/0.16.x/treebuilder.vala b/src/driver/0.16.x/treebuilder.vala
index b738596102..99ac936898 100644
--- a/src/driver/0.16.x/treebuilder.vala
+++ b/src/driver/0.16.x/treebuilder.vala
@@ -297,6 +297,77 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return Vala.CCodeBaseModule.get_ccode_name (symbol);
}
+ private string? get_quark_macro_name (Vala.ErrorDomain element) {
+ return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
+ }
+
+ private string? get_private_cname (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ string? cname = get_cname (element);
+ return (cname != null)? cname + "Private" : null;
+ }
+
+ private string? get_class_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+ }
+
+ private string? get_class_type_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+ }
+
+ private string? get_is_type_macro_name (Vala.TypeSymbol element) {
+ string name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
+ return (name != null && name != "")? name : null;
+ }
+
+ private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
+ string? name = get_is_type_macro_name (element);
+ return (name != null)? name + "_CLASS" : null;
+ }
+
+ private string? get_type_function_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+ return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
+ }
+
+ private string? get_type_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+ return Vala.CCodeBaseModule.get_ccode_type_id (element);
+ }
+
+ private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && !((Vala.Class) element).is_compact) || element is Vala.Interface) {
+ return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
+ } else {
+ return null;
+ }
+ }
+
+ private string? get_interface_macro_name (Vala.Interface element) {
+ return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+ }
+
+ private string get_quark_function_name (Vala.ErrorDomain element) {
+ return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
+ }
+
private SourceComment? create_comment (Vala.Comment? comment) {
#if VALA_0_15_0
if (comment != null) {
@@ -860,7 +931,8 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+
symbol_map.set (element, node);
parent.add_child (node);
@@ -892,7 +964,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name (element), element);
+ Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_interface_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -920,7 +992,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_type == null && (element.is_boolean_type () || element.is_floating_type () || element.is_integer_type ());
- Struct node = new Struct (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_ccode_type_id (element), get_dup_function (element), get_free_function (element), is_basic_type, element);
+ Struct node = new Struct (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_type_macro_name (element), get_type_function_name (element), get_ccode_type_id (element), get_dup_function (element), get_free_function (element), is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1055,7 +1127,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element);
+ Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), get_type_macro_name (element), get_type_function_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1104,7 +1176,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier(element), comment, get_cname(element), Vala.GDBusModule.get_dbus_name (element), element);
+ Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_quark_macro_name (element), get_quark_function_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/driver/0.18.x/treebuilder.vala b/src/driver/0.18.x/treebuilder.vala
index aa1d7cba05..05e76362f8 100644
--- a/src/driver/0.18.x/treebuilder.vala
+++ b/src/driver/0.18.x/treebuilder.vala
@@ -356,6 +356,77 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
return element.name;
}
+ private string? get_quark_macro_name (Vala.ErrorDomain element) {
+ return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
+ }
+
+ private string? get_private_cname (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ string? cname = get_cname (element);
+ return (cname != null)? cname + "Private" : null;
+ }
+
+ private string? get_class_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ return "%s_GET_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+ }
+
+ private string? get_class_type_macro_name (Vala.Class element) {
+ if (element.is_compact) {
+ return null;
+ }
+
+ return "%s_CLASS".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+ }
+
+ private string? get_is_type_macro_name (Vala.TypeSymbol element) {
+ string? name = Vala.CCodeBaseModule.get_ccode_type_check_function (element);
+ return (name != null && name != "")? name : null;
+ }
+
+ private string? get_is_class_type_macro_name (Vala.TypeSymbol element) {
+ string? name = get_is_type_macro_name (element);
+ return (name != null)? name + "_CLASS" : null;
+ }
+
+ private string? get_type_function_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+ return "%s_get_type".printf (Vala.CCodeBaseModule.get_ccode_lower_case_name (element, null));
+ }
+
+ private string? get_type_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && ((Vala.Class) element).is_compact) || element is Vala.ErrorDomain || element is Vala.Delegate) {
+ return null;
+ }
+
+ return Vala.CCodeBaseModule.get_ccode_type_id (element);
+ }
+
+ private string? get_type_cast_macro_name (Vala.TypeSymbol element) {
+ if ((element is Vala.Class && !((Vala.Class) element).is_compact) || element is Vala.Interface) {
+ return Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null);
+ } else {
+ return null;
+ }
+ }
+
+ private string? get_interface_macro_name (Vala.Interface element) {
+ return "%s_GET_INTERFACE".printf (Vala.CCodeBaseModule.get_ccode_upper_case_name (element, null));
+ }
+
+ private string get_quark_function_name (Vala.ErrorDomain element) {
+ return Vala.CCodeBaseModule.get_ccode_lower_case_prefix (element) + "quark";
+ }
+
private PackageMetaData? get_package_meta_data (Package pkg) {
foreach (PackageMetaData data in packages) {
if (data.package == pkg) {
@@ -876,7 +947,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_class == null && element.name == "string";
- Class node = new Class (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
+ Class node = new Class (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_private_cname (element), get_class_macro_name (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_class_type_macro_name (element), get_is_class_type_macro_name (element), Vala.GDBusModule.get_dbus_name (element), get_ccode_type_id (element), get_param_spec_function (element), get_ref_function (element), get_unref_function (element), get_take_value_function (element), get_get_value_function (element), get_set_value_function (element), element.is_fundamental (), element.is_abstract, is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -908,7 +979,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), Vala.GDBusModule.get_dbus_name (element), element);
+ Interface node = new Interface (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), get_type_macro_name (element), get_is_type_macro_name (element), get_type_cast_macro_name (element), get_type_function_name (element), get_interface_macro_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -936,7 +1007,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
bool is_basic_type = element.base_type == null && (element.is_boolean_type () || element.is_floating_type () || element.is_integer_type ());
- Struct node = new Struct (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_ccode_type_id (element), get_dup_function (element), get_free_function (element), is_basic_type, element);
+ Struct node = new Struct (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_type_macro_name (element), get_type_function_name (element), get_ccode_type_id (element), get_dup_function (element), get_free_function (element), is_basic_type, element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1071,7 +1142,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), element);
+ Symbol node = new Enum (parent, file, element.name, get_access_modifier(element), comment, get_cname (element), get_type_macro_name (element), get_type_function_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
@@ -1120,7 +1191,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
SourceFile? file = get_source_file (element);
SourceComment? comment = create_comment (element.comment);
- Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier(element), comment, get_cname(element), Vala.GDBusModule.get_dbus_name (element), element);
+ Symbol node = new ErrorDomain (parent, file, element.name, get_access_modifier (element), comment, get_cname (element), get_quark_macro_name (element), get_quark_function_name (element), Vala.GDBusModule.get_dbus_name (element), element);
symbol_map.set (element, node);
parent.add_child (node);
diff --git a/src/libvaladoc/api/class.vala b/src/libvaladoc/api/class.vala
index 071b9e4382..273f249b79 100644
--- a/src/libvaladoc/api/class.vala
+++ b/src/libvaladoc/api/class.vala
@@ -38,14 +38,21 @@ public class Valadoc.Api.Class : TypeSymbol {
private string? param_spec_function_name;
private string? ref_function_name;
private string? type_id;
+ private string? is_class_type_macro_name;
+ private string? class_type_macro_name;
+ private string? class_macro_name;
+ private string? private_cname;
private string? cname;
-
- public Class (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? dbus_name, string? type_id, string? param_spec_function_name, string? ref_function_name, string? unref_function_name, string? take_value_function_cname, string? get_value_function_cname, string? set_value_function_cname, bool is_fundamental, bool is_abstract, bool is_basic_type, void* data) {
- base (parent, file, name, accessibility, comment, is_basic_type, data);
+ public Class (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? private_cname, string? class_macro_name, string? type_macro_name, string? is_type_macro_name, string? type_cast_macro_name, string? type_function_name, string? class_type_macro_name, string? is_class_type_macro_name, string? dbus_name, string? type_id, string? param_spec_function_name, string? ref_function_name, string? unref_function_name, string? take_value_function_cname, string? get_value_function_cname, string? set_value_function_cname, bool is_fundamental, bool is_abstract, bool is_basic_type, void* data) {
+ base (parent, file, name, accessibility, comment, type_macro_name, is_type_macro_name, type_cast_macro_name, type_function_name, is_basic_type, data);
this.interfaces = new ArrayList<TypeReference> ();
+ this.is_class_type_macro_name = is_class_type_macro_name;
+ this.class_type_macro_name = class_type_macro_name;
+ this.class_macro_name = class_macro_name;
+ this.private_cname = private_cname;
this.dbus_name = dbus_name;
this.type_id = type_id;
this.cname = cname;
@@ -78,6 +85,13 @@ public class Valadoc.Api.Class : TypeSymbol {
return cname;
}
+ /**
+ * Returns the name of this class' private data structure as it is used in C.
+ */
+ public string? get_private_cname () {
+ return private_cname;
+ }
+
/**
* Returns the C symbol representing the runtime type id for this data type.
*/
@@ -142,6 +156,27 @@ public class Valadoc.Api.Class : TypeSymbol {
return dbus_name;
}
+ /**
+ * Gets the name of the GType macro which returns the class struct.
+ */
+ public string get_class_macro_name () {
+ return class_macro_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which returns the type of the class.
+ */
+ public string get_class_type_macro_name () {
+ return class_type_macro_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which returns whether a class instance is of a given type.
+ */
+ public string get_is_class_type_macro_name () {
+ return is_class_type_macro_name;
+ }
+
/**
* Returns a list of all newly implemented interfaces.
*
diff --git a/src/libvaladoc/api/delegate.vala b/src/libvaladoc/api/delegate.vala
index d6b3a6c6af..a5f6c67520 100644
--- a/src/libvaladoc/api/delegate.vala
+++ b/src/libvaladoc/api/delegate.vala
@@ -40,7 +40,7 @@ public class Valadoc.Api.Delegate : TypeSymbol, Callable {
public Delegate (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, bool is_static, void* data) {
- base (parent, file, name, accessibility, comment, false, data);
+ base (parent, file, name, accessibility, comment, null, null, null, null, false, data);
this.is_static = is_static;
this.cname = cname;
diff --git a/src/libvaladoc/api/enum.vala b/src/libvaladoc/api/enum.vala
index 423f0a76d8..12652f8bd5 100644
--- a/src/libvaladoc/api/enum.vala
+++ b/src/libvaladoc/api/enum.vala
@@ -30,8 +30,8 @@ using Valadoc.Content;
public class Valadoc.Api.Enum : TypeSymbol {
private string cname;
- public Enum (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, void* data) {
- base (parent, file, name, accessibility, comment, false, data);
+ public Enum (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? type_macro_name, string? type_function_name, void* data) {
+ base (parent, file, name, accessibility, comment, type_macro_name, null, null, type_function_name, false, data);
this.cname = cname;
}
diff --git a/src/libvaladoc/api/errordomain.vala b/src/libvaladoc/api/errordomain.vala
index 9ec8075124..4851010c3d 100644
--- a/src/libvaladoc/api/errordomain.vala
+++ b/src/libvaladoc/api/errordomain.vala
@@ -28,12 +28,16 @@ using Valadoc.Content;
* Represents an error domain declaration.
*/
public class Valadoc.Api.ErrorDomain : TypeSymbol {
+ private string? quark_function_name;
+ private string? quark_macro_name;
private string? dbus_name;
private string? cname;
- public ErrorDomain (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? dbus_name, void* data) {
- base (parent, file, name, accessibility, comment, false, data);
+ public ErrorDomain (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? quark_macro_name, string? quark_function_name, string? dbus_name, void* data) {
+ base (parent, file, name, accessibility, comment, null, null, null, null, false, data);
+ this.quark_function_name = quark_function_name;
+ this.quark_macro_name = quark_macro_name;
this.dbus_name = dbus_name;
this.cname = cname;
}
@@ -52,6 +56,20 @@ public class Valadoc.Api.ErrorDomain : TypeSymbol {
return dbus_name;
}
+ /**
+ * Gets the name of the quark() function which represents the error domain
+ */
+ public string get_quark_function_name () {
+ return quark_function_name;
+ }
+
+ /**
+ * Gets the name of the quark macro which represents the error domain
+ */
+ public string get_quark_macro_name () {
+ return quark_macro_name;
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/src/libvaladoc/api/interface.vala b/src/libvaladoc/api/interface.vala
index cf133029ba..2446d1b0f3 100644
--- a/src/libvaladoc/api/interface.vala
+++ b/src/libvaladoc/api/interface.vala
@@ -29,12 +29,15 @@ using Valadoc.Content;
* Represents a interface declaration in the source code.
*/
public class Valadoc.Api.Interface : TypeSymbol {
+ private string? interface_macro_name;
private string? dbus_name;
private string? cname;
- public Interface (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? dbus_name, void* data) {
- base (parent, file, name, accessibility, comment, false, data);
+ public Interface (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? type_macro_name, string? is_type_macro_name, string? type_cast_macro_name, string? type_function_name, string interface_macro_name, string? dbus_name, void* data) {
+ base (parent, file, name, accessibility, comment, type_macro_name, is_type_macro_name, type_cast_macro_name, type_function_name, false, data);
+
+ this.interface_macro_name = interface_macro_name;
this.dbus_name = dbus_name;
this.cname = cname;
}
@@ -94,6 +97,13 @@ public class Valadoc.Api.Interface : TypeSymbol {
return dbus_name;
}
+ /**
+ * Gets the name of the GType macro which returns the interface struct.
+ */
+ public string get_interface_macro_name () {
+ return interface_macro_name;
+ }
+
/**
* A preconditioned class or null
*/
diff --git a/src/libvaladoc/api/struct.vala b/src/libvaladoc/api/struct.vala
index 302494857c..475f6d8081 100644
--- a/src/libvaladoc/api/struct.vala
+++ b/src/libvaladoc/api/struct.vala
@@ -33,8 +33,8 @@ public class Valadoc.Api.Struct : TypeSymbol {
private string? type_id;
private string? cname;
- public Struct (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? type_id, string? dup_function_cname, string? free_function_cname, bool is_basic_type, void* data) {
- base (parent, file, name, accessibility, comment, is_basic_type, data);
+ public Struct (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? cname, string? type_macro_name, string? type_function_name, string? type_id, string? dup_function_cname, string? free_function_cname, bool is_basic_type, void* data) {
+ base (parent, file, name, accessibility, comment, type_macro_name, null, null, type_function_name, is_basic_type, data);
this.dup_function_cname = dup_function_cname;
this.free_function_cname = free_function_cname;
diff --git a/src/libvaladoc/api/typesymbol.vala b/src/libvaladoc/api/typesymbol.vala
index 83b977601c..e50ff1596b 100644
--- a/src/libvaladoc/api/typesymbol.vala
+++ b/src/libvaladoc/api/typesymbol.vala
@@ -29,10 +29,19 @@ using Gee;
*/
public abstract class Valadoc.Api.TypeSymbol : Symbol {
private SourceComment? source_comment;
+ private string? type_macro_name;
+ private string? is_type_macro_name;
+ private string? type_cast_macro_name;
+ private string? type_function_name;
- public TypeSymbol (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, bool is_basic_type, void* data) {
+ public TypeSymbol (Node parent, SourceFile file, string name, SymbolAccessibility accessibility, SourceComment? comment, string? type_macro_name, string? is_type_macro_name, string? type_cast_macro_name, string? type_function_name, bool is_basic_type, void* data) {
base (parent, file, name, accessibility, data);
+ this.type_cast_macro_name = type_cast_macro_name;
+ this.is_type_macro_name = is_type_macro_name;
+ this.type_function_name = type_function_name;
+ this.type_macro_name = type_macro_name;
+
this.is_basic_type = is_basic_type;
this.source_comment = comment;
}
@@ -45,6 +54,34 @@ public abstract class Valadoc.Api.TypeSymbol : Symbol {
get;
}
+ /**
+ * Gets the name of the GType macro which represents the type symbol
+ */
+ public string get_type_macro_name () {
+ return type_macro_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which casts a type instance to the given type.
+ */
+ public string get_type_cast_macro_name () {
+ return type_cast_macro_name;
+ }
+
+ /**
+ * Gets the name of the GType macro which determines whether a type instance is of a given type.
+ */
+ public string get_is_type_macro_name () {
+ return is_type_macro_name;
+ }
+
+ /**
+ * Gets the name of the get_type() function which represents the type symbol
+ */
+ public string get_type_function_name () {
+ return type_function_name;
+ }
+
/**
* {@inheritDoc}
*/
diff --git a/tests/generic-api-test.vala b/tests/drivers/generic-api-test.vala
similarity index 95%
rename from tests/generic-api-test.vala
rename to tests/drivers/generic-api-test.vala
index 7d04d6497d..02623c51c4 100644
--- a/tests/generic-api-test.vala
+++ b/tests/drivers/generic-api-test.vala
@@ -36,7 +36,7 @@ public static void test_enum_global (Api.Enum? en, Api.Package pkg, Api.Namespac
assert (en.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (en.get_full_name () == "TestEnumGlobal");
- assert (en.get_filename () == "api-test.vapi");
+ assert (en.get_filename () == "api-test.data.vapi");
assert (en.name == "TestEnumGlobal");
assert (en.nspace == global_ns);
assert (en.package == pkg);
@@ -64,7 +64,7 @@ public static void test_enum_global (Api.Enum? en, Api.Package pkg, Api.Namespac
assert (enval.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (enval.get_full_name () == "TestEnumGlobal.ENVAL1");
- assert (enval.get_filename () == "api-test.vapi");
+ assert (enval.get_filename () == "api-test.data.vapi");
assert (enval.nspace == global_ns);
assert (enval.package == pkg);
@@ -81,7 +81,7 @@ public static void test_enum_global (Api.Enum? en, Api.Package pkg, Api.Namespac
assert (enval.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (enval.get_full_name () == "TestEnumGlobal.ENVAL2");
- assert (enval.get_filename () == "api-test.vapi");
+ assert (enval.get_filename () == "api-test.data.vapi");
assert (enval.nspace == global_ns);
assert (enval.package == pkg);
@@ -122,7 +122,7 @@ public static void test_enum_global (Api.Enum? en, Api.Package pkg, Api.Namespac
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestEnumGlobal.method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -153,7 +153,7 @@ public static void test_enum_global (Api.Enum? en, Api.Package pkg, Api.Namespac
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestEnumGlobal.static_method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "static_method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -197,7 +197,7 @@ public static void test_erroromain_global (Api.ErrorDomain? err, Api.Package pkg
assert (err.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (err.get_full_name () == "TestErrDomGlobal");
- assert (err.get_filename () == "api-test.vapi");
+ assert (err.get_filename () == "api-test.data.vapi");
assert (err.name == "TestErrDomGlobal");
assert (err.nspace == global_ns);
assert (err.package == pkg);
@@ -223,7 +223,7 @@ public static void test_erroromain_global (Api.ErrorDomain? err, Api.Package pkg
assert (errc.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (errc.get_full_name () == "TestErrDomGlobal.ERROR1");
- assert (errc.get_filename () == "api-test.vapi");
+ assert (errc.get_filename () == "api-test.data.vapi");
assert (errc.nspace == global_ns);
assert (errc.package == pkg);
@@ -238,7 +238,7 @@ public static void test_erroromain_global (Api.ErrorDomain? err, Api.Package pkg
assert (errc.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (errc.get_full_name () == "TestErrDomGlobal.ERROR2");
- assert (errc.get_filename () == "api-test.vapi");
+ assert (errc.get_filename () == "api-test.data.vapi");
assert (errc.nspace == global_ns);
assert (errc.package == pkg);
@@ -279,7 +279,7 @@ public static void test_erroromain_global (Api.ErrorDomain? err, Api.Package pkg
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestErrDomGlobal.method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -310,7 +310,7 @@ public static void test_erroromain_global (Api.ErrorDomain? err, Api.Package pkg
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestErrDomGlobal.static_method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "static_method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -365,7 +365,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
// (.Node)
//assert (property.getter.get_full_name () == "TestClassGlobal.property3");
assert (cl.get_full_name () == "TestClassGlobal");
- assert (cl.get_filename () == "api-test.vapi");
+ assert (cl.get_filename () == "api-test.data.vapi");
assert (cl.name == "TestClassGlobal");
assert (cl.nspace == global_ns);
assert (cl.package == pkg);
@@ -395,7 +395,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestClassGlobal.method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -426,7 +426,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestClassGlobal.static_method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "static_method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -461,7 +461,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestClassGlobal.TestClassGlobal");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -487,7 +487,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestClassGlobal.TestClassGlobal.named");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -529,7 +529,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (property.get_full_name () == "TestClassGlobal.property1");
- assert (property.get_filename () == "api-test.vapi");
+ assert (property.get_filename () == "api-test.data.vapi");
assert (property.nspace == global_ns);
assert (property.package == pkg);
@@ -544,7 +544,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestClassGlobal.property2");
- assert (property.getter.get_filename () == "api-test.vapi");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
assert (property.getter.nspace == global_ns);
assert (property.getter.package == pkg);
@@ -559,7 +559,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (property.setter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestClassGlobal.property2");
- assert (property.setter.get_filename () == "api-test.vapi");
+ assert (property.setter.get_filename () == "api-test.data.vapi");
assert (property.setter.nspace == global_ns);
assert (property.setter.package == pkg);
@@ -581,7 +581,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (property.get_full_name () == "TestClassGlobal.property2");
- assert (property.get_filename () == "api-test.vapi");
+ assert (property.get_filename () == "api-test.data.vapi");
assert (property.nspace == global_ns);
assert (property.package == pkg);
@@ -595,7 +595,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestClassGlobal.property2");
- assert (property.getter.get_filename () == "api-test.vapi");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
assert (property.getter.nspace == global_ns);
assert (property.getter.package == pkg);
@@ -618,7 +618,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (property.get_full_name () == "TestClassGlobal.property3");
- assert (property.get_filename () == "api-test.vapi");
+ assert (property.get_filename () == "api-test.data.vapi");
assert (property.nspace == global_ns);
assert (property.package == pkg);
@@ -632,7 +632,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestClassGlobal.property3");
- assert (property.getter.get_filename () == "api-test.vapi");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
assert (property.getter.nspace == global_ns);
assert (property.getter.package == pkg);
@@ -647,7 +647,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (property.setter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestClassGlobal.property3");
- assert (property.setter.get_filename () == "api-test.vapi");
+ assert (property.setter.get_filename () == "api-test.data.vapi");
assert (property.setter.nspace == global_ns);
assert (property.setter.package == pkg);
@@ -679,7 +679,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (del.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestClassGlobal.property3");
- assert (del.get_filename () == "api-test.vapi");
+ assert (del.get_filename () == "api-test.data.vapi");
assert (del.nspace == global_ns);
assert (del.package == pkg);
@@ -701,7 +701,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (sig.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (sig.get_full_name () == "TestClassGlobal.property3");
- assert (sig.get_filename () == "api-test.vapi");
+ assert (sig.get_filename () == "api-test.data.vapi");
assert (sig.nspace == global_ns);
assert (sig.package == pkg);
@@ -719,7 +719,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (constant.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (constant.get_full_name () == "TestClassGlobal.constant");
- assert (constant.get_filename () == "api-test.vapi");
+ assert (constant.get_filename () == "api-test.data.vapi");
assert (constant.name == "constant");
assert (constant.nspace == global_ns);
assert (constant.package == pkg);
@@ -744,7 +744,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (field.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (field.get_full_name () == "TestClassGlobal.field1");
- assert (field.get_filename () == "api-test.vapi");
+ assert (field.get_filename () == "api-test.data.vapi");
assert (field.nspace == global_ns);
assert (field.package == pkg);
@@ -761,7 +761,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (field.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (field.get_full_name () == "TestClassGlobal.field2");
- assert (field.get_filename () == "api-test.vapi");
+ assert (field.get_filename () == "api-test.data.vapi");
assert (field.nspace == global_ns);
assert (field.package == pkg);
@@ -789,7 +789,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (subcl.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (subcl.get_full_name () == "TestClassGlobal.InnerClass");
- assert (subcl.get_filename () == "api-test.vapi");
+ assert (subcl.get_filename () == "api-test.data.vapi");
assert (subcl.nspace == global_ns);
assert (subcl.package == pkg);
@@ -811,7 +811,7 @@ public static void test_class_global (Api.Class? cl, Api.Package pkg, Api.Namesp
assert (substru.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (substru.get_full_name () == "TestClassGlobal.InnerStruct");
- assert (substru.get_filename () == "api-test.vapi");
+ assert (substru.get_filename () == "api-test.data.vapi");
assert (substru.name == "InnerStruct");
assert (substru.nspace == global_ns);
assert (substru.package == pkg);
@@ -849,7 +849,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (iface.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (iface.get_full_name () == "TestInterfaceGlobal");
- assert (iface.get_filename () == "api-test.vapi");
+ assert (iface.get_filename () == "api-test.data.vapi");
assert (iface.name == "TestInterfaceGlobal");
assert (iface.nspace == global_ns);
assert (iface.package == pkg);
@@ -879,7 +879,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestInterfaceGlobal.method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -910,7 +910,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestInterfaceGlobal.static_method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "static_method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -941,7 +941,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (property.get_full_name () == "TestInterfaceGlobal.property1");
- assert (property.get_filename () == "api-test.vapi");
+ assert (property.get_filename () == "api-test.data.vapi");
assert (property.nspace == global_ns);
assert (property.package == pkg);
@@ -956,7 +956,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestInterfaceGlobal.property2");
- assert (property.getter.get_filename () == "api-test.vapi");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
assert (property.getter.nspace == global_ns);
assert (property.getter.package == pkg);
@@ -971,7 +971,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (property.setter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestInterfaceGlobal.property2");
- assert (property.setter.get_filename () == "api-test.vapi");
+ assert (property.setter.get_filename () == "api-test.data.vapi");
assert (property.setter.nspace == global_ns);
assert (property.setter.package == pkg);
@@ -993,7 +993,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (property.get_full_name () == "TestInterfaceGlobal.property2");
- assert (property.get_filename () == "api-test.vapi");
+ assert (property.get_filename () == "api-test.data.vapi");
assert (property.nspace == global_ns);
assert (property.package == pkg);
@@ -1007,7 +1007,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestInterfaceGlobal.property2");
- assert (property.getter.get_filename () == "api-test.vapi");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
assert (property.getter.nspace == global_ns);
assert (property.getter.package == pkg);
@@ -1030,7 +1030,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (property.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (property.get_full_name () == "TestInterfaceGlobal.property3");
- assert (property.get_filename () == "api-test.vapi");
+ assert (property.get_filename () == "api-test.data.vapi");
assert (property.nspace == global_ns);
assert (property.package == pkg);
@@ -1044,7 +1044,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (property.getter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestInterfaceGlobal.property3");
- assert (property.getter.get_filename () == "api-test.vapi");
+ assert (property.getter.get_filename () == "api-test.data.vapi");
assert (property.getter.nspace == global_ns);
assert (property.getter.package == pkg);
@@ -1059,7 +1059,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (property.setter.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (property.getter.get_full_name () == "TestInterfaceGlobal.property3");
- assert (property.setter.get_filename () == "api-test.vapi");
+ assert (property.setter.get_filename () == "api-test.data.vapi");
assert (property.setter.nspace == global_ns);
assert (property.setter.package == pkg);
@@ -1092,7 +1092,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (del.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (del.get_full_name () == "TestClassGlobal.property3");
- assert (del.get_filename () == "api-test.vapi");
+ assert (del.get_filename () == "api-test.data.vapi");
assert (del.nspace == global_ns);
assert (del.package == pkg);
@@ -1114,7 +1114,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (sig.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
//assert (sig.get_full_name () == "TestClassGlobal.property3");
- assert (sig.get_filename () == "api-test.vapi");
+ assert (sig.get_filename () == "api-test.data.vapi");
assert (sig.nspace == global_ns);
assert (sig.package == pkg);
@@ -1132,7 +1132,7 @@ public static void test_interface_global (Api.Interface? iface, Api.Package pkg,
assert (constant.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (constant.get_full_name () == "TestInterfaceGlobal.constant");
- assert (constant.get_filename () == "api-test.vapi");
+ assert (constant.get_filename () == "api-test.data.vapi");
assert (constant.name == "constant");
assert (constant.nspace == global_ns);
assert (constant.package == pkg);
@@ -1173,7 +1173,7 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
// (.Node)
//assert (property.getter.get_full_name () == "TestClassGlobal.property3");
assert (stru.get_full_name () == "TestStructGlobal");
- assert (stru.get_filename () == "api-test.vapi");
+ assert (stru.get_filename () == "api-test.data.vapi");
assert (stru.name == "TestStructGlobal");
assert (stru.nspace == global_ns);
assert (stru.package == pkg);
@@ -1203,7 +1203,7 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestStructGlobal.method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -1234,7 +1234,7 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestStructGlobal.static_method");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "static_method");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -1269,7 +1269,7 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestStructGlobal.TestStructGlobal");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -1295,7 +1295,7 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "TestStructGlobal.TestStructGlobal.named");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -1324,7 +1324,7 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
assert (constant.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (constant.get_full_name () == "TestStructGlobal.constant");
- assert (constant.get_filename () == "api-test.vapi");
+ assert (constant.get_filename () == "api-test.data.vapi");
assert (constant.name == "constant");
assert (constant.nspace == global_ns);
assert (constant.package == pkg);
@@ -1350,7 +1350,7 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
assert (field.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (field.get_full_name () == "TestStructGlobal.field1");
- assert (field.get_filename () == "api-test.vapi");
+ assert (field.get_filename () == "api-test.data.vapi");
assert (field.nspace == global_ns);
assert (field.package == pkg);
@@ -1367,7 +1367,7 @@ public static void test_struct_global (Api.Struct? stru, Api.Package pkg, Api.Na
assert (field.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (field.get_full_name () == "TestStructGlobal.field2");
- assert (field.get_filename () == "api-test.vapi");
+ assert (field.get_filename () == "api-test.data.vapi");
assert (field.nspace == global_ns);
assert (field.package == pkg);
@@ -1480,7 +1480,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_2.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -1516,7 +1516,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_3.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -1552,7 +1552,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_4.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -1588,7 +1588,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_5.o");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "o");
@@ -1624,7 +1624,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_6.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -1660,7 +1660,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == null);
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == null);
@@ -1687,7 +1687,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_8.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -1723,7 +1723,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_9.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -1755,7 +1755,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_9.b");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "b");
@@ -1787,7 +1787,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_9.c");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "c");
@@ -1819,7 +1819,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_9.d");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "d");
@@ -1851,7 +1851,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_9.e");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "e");
@@ -1883,7 +1883,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_9.f");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "f");
@@ -1915,7 +1915,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == null);
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == null);
@@ -1942,7 +1942,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_10.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -1980,7 +1980,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_11.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -2019,7 +2019,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_12.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -2058,7 +2058,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_13.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -2097,7 +2097,7 @@ public static void param_test (Api.Namespace ns, Api.Package pkg) {
assert (param.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (param.get_full_name () == "ParamTest.test_function_param_14.a");
- assert (param.get_filename () == "api-test.vapi");
+ assert (param.get_filename () == "api-test.data.vapi");
assert (param.nspace == ns);
assert (param.package == pkg);
assert (param.name == "a");
@@ -2397,7 +2397,7 @@ public static void test_global_ns (Api.Namespace global_ns, Api.Package pkg) {
assert (method.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (method.get_full_name () == "test_function_global");
- assert (method.get_filename () == "api-test.vapi");
+ assert (method.get_filename () == "api-test.data.vapi");
assert (method.name == "test_function_global");
assert (method.nspace == global_ns);
assert (method.package == pkg);
@@ -2419,7 +2419,7 @@ public static void test_global_ns (Api.Namespace global_ns, Api.Package pkg) {
assert (del.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (del.get_full_name () == "test_delegate_global");
- assert (del.get_filename () == "api-test.vapi");
+ assert (del.get_filename () == "api-test.data.vapi");
assert (del.name == "test_delegate_global");
assert (del.nspace == global_ns);
assert (del.package == pkg);
@@ -2440,7 +2440,7 @@ public static void test_global_ns (Api.Namespace global_ns, Api.Package pkg) {
assert (field.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (field.get_full_name () == "test_field_global");
- assert (field.get_filename () == "api-test.vapi");
+ assert (field.get_filename () == "api-test.data.vapi");
assert (field.name == "test_field_global");
assert (field.nspace == global_ns);
assert (field.package == pkg);
@@ -2459,7 +2459,7 @@ public static void test_global_ns (Api.Namespace global_ns, Api.Package pkg) {
assert (constant.accessibility == Api.SymbolAccessibility.PUBLIC);
// (.Node)
assert (constant.get_full_name () == "test_const_global");
- assert (constant.get_filename () == "api-test.vapi");
+ assert (constant.get_filename () == "api-test.data.vapi");
assert (constant.name == "test_const_global");
assert (constant.nspace == global_ns);
assert (constant.package == pkg);
@@ -2575,7 +2575,7 @@ public static void test_driver (string driver_path) {
var reporter = new ErrorReporter ();
settings.source_files = {
- "../../tests/drivers/api-test.vapi"
+ "../../tests/drivers/api-test.data.vapi"
};
settings._protected = false;
diff --git a/tests/helpers.vala b/tests/libvaladoc/parser/generic-scanner.vala
similarity index 100%
rename from tests/helpers.vala
rename to tests/libvaladoc/parser/generic-scanner.vala
diff --git a/tests/testrunner.sh b/tests/testrunner.sh
index cf83ec1c37..a116c61241 100755
--- a/tests/testrunner.sh
+++ b/tests/testrunner.sh
@@ -30,7 +30,7 @@ export G_DEBUG=fatal_warnings
export PKG_CONFIG_PATH=../../src/libvaladoc
VALAC=valac
-VALAFLAGS="--vapidir ../../src/libvaladoc --pkg valadoc-1.0 --pkg gee-1.0 --disable-warnings --main main --save-temps -X -g -X -O0 -X -pipe -X -lm -X -Werror=return-type -X -Werror=init-self -X -Werror=implicit -X -Werror=sequence-point -X -Werror=return-type -X -Werror=uninitialized -X -Werror=pointer-arith -X -Werror=int-to-pointer-cast -X -Werror=pointer-to-int-cast -X -L../../src/libvaladoc/.libs -X -I../../src/libvaladoc ../helpers.vala ../generic-api-test.vala"
+VALAFLAGS="--vapidir ../../src/libvaladoc --pkg valadoc-1.0 --pkg gee-1.0 --disable-warnings --main main --save-temps -X -g -X -O0 -X -pipe -X -lm -X -Werror=return-type -X -Werror=init-self -X -Werror=implicit -X -Werror=sequence-point -X -Werror=return-type -X -Werror=uninitialized -X -Werror=pointer-arith -X -Werror=int-to-pointer-cast -X -Werror=pointer-to-int-cast -X -L../../src/libvaladoc/.libs -X -I../../src/libvaladoc ../libvaladoc/parser/generic-scanner.vala ../drivers/generic-api-test.vala"
VAPIGEN=$topbuilddir/vapigen/vapigen
VAPIGENFLAGS=
|
4b87a5ba9069e373969842dd915f3271f36631a5
|
hadoop
|
HADOOP-7657. Add support for LZ4 compression.- Contributed by Binglin Chang.--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1220312 13f79535-47bb-0310-9956-ffa450edef68-
|
a
|
https://github.com/apache/hadoop
|
diff --git a/hadoop-common-project/hadoop-common/CHANGES.txt b/hadoop-common-project/hadoop-common/CHANGES.txt
index 281704a036577..f0e7a9a2956fd 100644
--- a/hadoop-common-project/hadoop-common/CHANGES.txt
+++ b/hadoop-common-project/hadoop-common/CHANGES.txt
@@ -9,6 +9,8 @@ Release 0.23.1 - Unreleased
HADOOP-7777 Implement a base class for DNSToSwitchMapping implementations
that can offer extra topology information. (stevel)
+ HADOOP-7657. Add support for LZ4 compression. (Binglin Chang via todd)
+
IMPROVEMENTS
HADOOP-7801. HADOOP_PREFIX cannot be overriden. (Bruno Mahé via tomwhite)
diff --git a/hadoop-common-project/hadoop-common/LICENSE.txt b/hadoop-common-project/hadoop-common/LICENSE.txt
index 111653695f066..6ccfd0927759f 100644
--- a/hadoop-common-project/hadoop-common/LICENSE.txt
+++ b/hadoop-common-project/hadoop-common/LICENSE.txt
@@ -251,3 +251,34 @@ in src/main/native/src/org/apache/hadoop/util:
* All rights reserved. Use of this source code is governed by a
* BSD-style license that can be found in the LICENSE file.
*/
+
+ For src/main/native/src/org/apache/hadoop/io/compress/lz4/lz4.c:
+
+/*
+ LZ4 - Fast LZ compression algorithm
+ Copyright (C) 2011, Yann Collet.
+ BSD License
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
diff --git a/hadoop-common-project/hadoop-common/pom.xml b/hadoop-common-project/hadoop-common/pom.xml
index 272158231b59c..53fbd01b08e7b 100644
--- a/hadoop-common-project/hadoop-common/pom.xml
+++ b/hadoop-common-project/hadoop-common/pom.xml
@@ -542,6 +542,8 @@
<javahClassName>org.apache.hadoop.security.JniBasedUnixGroupsNetgroupMapping</javahClassName>
<javahClassName>org.apache.hadoop.io.compress.snappy.SnappyCompressor</javahClassName>
<javahClassName>org.apache.hadoop.io.compress.snappy.SnappyDecompressor</javahClassName>
+ <javahClassName>org.apache.hadoop.io.compress.lz4.Lz4Compressor</javahClassName>
+ <javahClassName>org.apache.hadoop.io.compress.lz4.Lz4Decompressor</javahClassName>
<javahClassName>org.apache.hadoop.util.NativeCrc32</javahClassName>
</javahClassNames>
<javahOutputDirectory>${project.build.directory}/native/javah</javahOutputDirectory>
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java
index aaac349cd2b78..7c9b25c957bd0 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/CommonConfigurationKeys.java
@@ -93,7 +93,15 @@ public class CommonConfigurationKeys extends CommonConfigurationKeysPublic {
/** Default value for IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY */
public static final int IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_DEFAULT =
256 * 1024;
-
+
+ /** Internal buffer size for Snappy compressor/decompressors */
+ public static final String IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY =
+ "io.compression.codec.lz4.buffersize";
+
+ /** Default value for IO_COMPRESSION_CODEC_SNAPPY_BUFFERSIZE_KEY */
+ public static final int IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT =
+ 256 * 1024;
+
/**
* Service Authorization
*/
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/Lz4Codec.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/Lz4Codec.java
new file mode 100644
index 0000000000000..4613ebff40aea
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/Lz4Codec.java
@@ -0,0 +1,217 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.io.compress;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.hadoop.conf.Configurable;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.compress.lz4.Lz4Compressor;
+import org.apache.hadoop.io.compress.lz4.Lz4Decompressor;
+import org.apache.hadoop.fs.CommonConfigurationKeys;
+import org.apache.hadoop.util.NativeCodeLoader;
+
+/**
+ * This class creates lz4 compressors/decompressors.
+ */
+public class Lz4Codec implements Configurable, CompressionCodec {
+
+ static {
+ NativeCodeLoader.isNativeCodeLoaded();
+ }
+
+ Configuration conf;
+
+ /**
+ * Set the configuration to be used by this object.
+ *
+ * @param conf the configuration object.
+ */
+ @Override
+ public void setConf(Configuration conf) {
+ this.conf = conf;
+ }
+
+ /**
+ * Return the configuration used by this object.
+ *
+ * @return the configuration object used by this objec.
+ */
+ @Override
+ public Configuration getConf() {
+ return conf;
+ }
+
+ /**
+ * Are the native lz4 libraries loaded & initialized?
+ *
+ * @return true if loaded & initialized, otherwise false
+ */
+ public static boolean isNativeCodeLoaded() {
+ return NativeCodeLoader.isNativeCodeLoaded();
+ }
+
+ /**
+ * Create a {@link CompressionOutputStream} that will write to the given
+ * {@link OutputStream}.
+ *
+ * @param out the location for the final output stream
+ * @return a stream the user can write uncompressed data to have it compressed
+ * @throws IOException
+ */
+ @Override
+ public CompressionOutputStream createOutputStream(OutputStream out)
+ throws IOException {
+ return createOutputStream(out, createCompressor());
+ }
+
+ /**
+ * Create a {@link CompressionOutputStream} that will write to the given
+ * {@link OutputStream} with the given {@link Compressor}.
+ *
+ * @param out the location for the final output stream
+ * @param compressor compressor to use
+ * @return a stream the user can write uncompressed data to have it compressed
+ * @throws IOException
+ */
+ @Override
+ public CompressionOutputStream createOutputStream(OutputStream out,
+ Compressor compressor)
+ throws IOException {
+ if (!isNativeCodeLoaded()) {
+ throw new RuntimeException("native lz4 library not available");
+ }
+ int bufferSize = conf.getInt(
+ CommonConfigurationKeys.IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY,
+ CommonConfigurationKeys.IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT);
+
+ int compressionOverhead = Math.max((int)(bufferSize * 0.01), 10);
+
+ return new BlockCompressorStream(out, compressor, bufferSize,
+ compressionOverhead);
+ }
+
+ /**
+ * Get the type of {@link Compressor} needed by this {@link CompressionCodec}.
+ *
+ * @return the type of compressor needed by this codec.
+ */
+ @Override
+ public Class<? extends Compressor> getCompressorType() {
+ if (!isNativeCodeLoaded()) {
+ throw new RuntimeException("native lz4 library not available");
+ }
+
+ return Lz4Compressor.class;
+ }
+
+ /**
+ * Create a new {@link Compressor} for use by this {@link CompressionCodec}.
+ *
+ * @return a new compressor for use by this codec
+ */
+ @Override
+ public Compressor createCompressor() {
+ if (!isNativeCodeLoaded()) {
+ throw new RuntimeException("native lz4 library not available");
+ }
+ int bufferSize = conf.getInt(
+ CommonConfigurationKeys.IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY,
+ CommonConfigurationKeys.IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT);
+ return new Lz4Compressor(bufferSize);
+ }
+
+ /**
+ * Create a {@link CompressionInputStream} that will read from the given
+ * input stream.
+ *
+ * @param in the stream to read compressed bytes from
+ * @return a stream to read uncompressed bytes from
+ * @throws IOException
+ */
+ @Override
+ public CompressionInputStream createInputStream(InputStream in)
+ throws IOException {
+ return createInputStream(in, createDecompressor());
+ }
+
+ /**
+ * Create a {@link CompressionInputStream} that will read from the given
+ * {@link InputStream} with the given {@link Decompressor}.
+ *
+ * @param in the stream to read compressed bytes from
+ * @param decompressor decompressor to use
+ * @return a stream to read uncompressed bytes from
+ * @throws IOException
+ */
+ @Override
+ public CompressionInputStream createInputStream(InputStream in,
+ Decompressor decompressor)
+ throws IOException {
+ if (!isNativeCodeLoaded()) {
+ throw new RuntimeException("native lz4 library not available");
+ }
+
+ return new BlockDecompressorStream(in, decompressor, conf.getInt(
+ CommonConfigurationKeys.IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY,
+ CommonConfigurationKeys.IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT));
+ }
+
+ /**
+ * Get the type of {@link Decompressor} needed by this {@link CompressionCodec}.
+ *
+ * @return the type of decompressor needed by this codec.
+ */
+ @Override
+ public Class<? extends Decompressor> getDecompressorType() {
+ if (!isNativeCodeLoaded()) {
+ throw new RuntimeException("native lz4 library not available");
+ }
+
+ return Lz4Decompressor.class;
+ }
+
+ /**
+ * Create a new {@link Decompressor} for use by this {@link CompressionCodec}.
+ *
+ * @return a new decompressor for use by this codec
+ */
+ @Override
+ public Decompressor createDecompressor() {
+ if (!isNativeCodeLoaded()) {
+ throw new RuntimeException("native lz4 library not available");
+ }
+ int bufferSize = conf.getInt(
+ CommonConfigurationKeys.IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_KEY,
+ CommonConfigurationKeys.IO_COMPRESSION_CODEC_LZ4_BUFFERSIZE_DEFAULT);
+ return new Lz4Decompressor(bufferSize);
+ }
+
+ /**
+ * Get the default filename extension for this kind of compression.
+ *
+ * @return <code>.lz4</code>.
+ */
+ @Override
+ public String getDefaultExtension() {
+ return ".lz4";
+ }
+}
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/Lz4Compressor.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/Lz4Compressor.java
new file mode 100644
index 0000000000000..63a3afb7d42c4
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/Lz4Compressor.java
@@ -0,0 +1,299 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.io.compress.lz4;
+
+import java.io.IOException;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.io.compress.Compressor;
+import org.apache.hadoop.util.NativeCodeLoader;
+
+/**
+ * A {@link Compressor} based on the lz4 compression algorithm.
+ * http://code.google.com/p/lz4/
+ */
+public class Lz4Compressor implements Compressor {
+ private static final Log LOG =
+ LogFactory.getLog(Lz4Compressor.class.getName());
+ private static final int DEFAULT_DIRECT_BUFFER_SIZE = 64 * 1024;
+
+ // HACK - Use this as a global lock in the JNI layer
+ @SuppressWarnings({"unchecked", "unused"})
+ private static Class clazz = Lz4Compressor.class;
+
+ private int directBufferSize;
+ private Buffer compressedDirectBuf = null;
+ private int uncompressedDirectBufLen;
+ private Buffer uncompressedDirectBuf = null;
+ private byte[] userBuf = null;
+ private int userBufOff = 0, userBufLen = 0;
+ private boolean finish, finished;
+
+ private long bytesRead = 0L;
+ private long bytesWritten = 0L;
+
+
+ static {
+ if (NativeCodeLoader.isNativeCodeLoaded()) {
+ // Initialize the native library
+ try {
+ initIDs();
+ } catch (Throwable t) {
+ // Ignore failure to load/initialize lz4
+ LOG.warn(t.toString());
+ }
+ } else {
+ LOG.error("Cannot load " + Lz4Compressor.class.getName() +
+ " without native hadoop library!");
+ }
+ }
+
+ /**
+ * Creates a new compressor.
+ *
+ * @param directBufferSize size of the direct buffer to be used.
+ */
+ public Lz4Compressor(int directBufferSize) {
+ this.directBufferSize = directBufferSize;
+
+ uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize);
+ compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize);
+ compressedDirectBuf.position(directBufferSize);
+ }
+
+ /**
+ * Creates a new compressor with the default buffer size.
+ */
+ public Lz4Compressor() {
+ this(DEFAULT_DIRECT_BUFFER_SIZE);
+ }
+
+ /**
+ * Sets input data for compression.
+ * This should be called whenever #needsInput() returns
+ * <code>true</code> indicating that more input data is required.
+ *
+ * @param b Input data
+ * @param off Start offset
+ * @param len Length
+ */
+ @Override
+ public synchronized void setInput(byte[] b, int off, int len) {
+ if (b == null) {
+ throw new NullPointerException();
+ }
+ if (off < 0 || len < 0 || off > b.length - len) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+ finished = false;
+
+ if (len > uncompressedDirectBuf.remaining()) {
+ // save data; now !needsInput
+ this.userBuf = b;
+ this.userBufOff = off;
+ this.userBufLen = len;
+ } else {
+ ((ByteBuffer) uncompressedDirectBuf).put(b, off, len);
+ uncompressedDirectBufLen = uncompressedDirectBuf.position();
+ }
+
+ bytesRead += len;
+ }
+
+ /**
+ * If a write would exceed the capacity of the direct buffers, it is set
+ * aside to be loaded by this function while the compressed data are
+ * consumed.
+ */
+ synchronized void setInputFromSavedData() {
+ if (0 >= userBufLen) {
+ return;
+ }
+ finished = false;
+
+ uncompressedDirectBufLen = Math.min(userBufLen, directBufferSize);
+ ((ByteBuffer) uncompressedDirectBuf).put(userBuf, userBufOff,
+ uncompressedDirectBufLen);
+
+ // Note how much data is being fed to lz4
+ userBufOff += uncompressedDirectBufLen;
+ userBufLen -= uncompressedDirectBufLen;
+ }
+
+ /**
+ * Does nothing.
+ */
+ @Override
+ public synchronized void setDictionary(byte[] b, int off, int len) {
+ // do nothing
+ }
+
+ /**
+ * Returns true if the input data buffer is empty and
+ * #setInput() should be called to provide more input.
+ *
+ * @return <code>true</code> if the input data buffer is empty and
+ * #setInput() should be called in order to provide more input.
+ */
+ @Override
+ public synchronized boolean needsInput() {
+ return !(compressedDirectBuf.remaining() > 0
+ || uncompressedDirectBuf.remaining() == 0 || userBufLen > 0);
+ }
+
+ /**
+ * When called, indicates that compression should end
+ * with the current contents of the input buffer.
+ */
+ @Override
+ public synchronized void finish() {
+ finish = true;
+ }
+
+ /**
+ * Returns true if the end of the compressed
+ * data output stream has been reached.
+ *
+ * @return <code>true</code> if the end of the compressed
+ * data output stream has been reached.
+ */
+ @Override
+ public synchronized boolean finished() {
+ // Check if all uncompressed data has been consumed
+ return (finish && finished && compressedDirectBuf.remaining() == 0);
+ }
+
+ /**
+ * Fills specified buffer with compressed data. Returns actual number
+ * of bytes of compressed data. A return value of 0 indicates that
+ * needsInput() should be called in order to determine if more input
+ * data is required.
+ *
+ * @param b Buffer for the compressed data
+ * @param off Start offset of the data
+ * @param len Size of the buffer
+ * @return The actual number of bytes of compressed data.
+ */
+ @Override
+ public synchronized int compress(byte[] b, int off, int len)
+ throws IOException {
+ if (b == null) {
+ throw new NullPointerException();
+ }
+ if (off < 0 || len < 0 || off > b.length - len) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+
+ // Check if there is compressed data
+ int n = compressedDirectBuf.remaining();
+ if (n > 0) {
+ n = Math.min(n, len);
+ ((ByteBuffer) compressedDirectBuf).get(b, off, n);
+ bytesWritten += n;
+ return n;
+ }
+
+ // Re-initialize the lz4's output direct-buffer
+ compressedDirectBuf.clear();
+ compressedDirectBuf.limit(0);
+ if (0 == uncompressedDirectBuf.position()) {
+ // No compressed data, so we should have !needsInput or !finished
+ setInputFromSavedData();
+ if (0 == uncompressedDirectBuf.position()) {
+ // Called without data; write nothing
+ finished = true;
+ return 0;
+ }
+ }
+
+ // Compress data
+ n = compressBytesDirect();
+ compressedDirectBuf.limit(n);
+ uncompressedDirectBuf.clear(); // lz4 consumes all buffer input
+
+ // Set 'finished' if snapy has consumed all user-data
+ if (0 == userBufLen) {
+ finished = true;
+ }
+
+ // Get atmost 'len' bytes
+ n = Math.min(n, len);
+ bytesWritten += n;
+ ((ByteBuffer) compressedDirectBuf).get(b, off, n);
+
+ return n;
+ }
+
+ /**
+ * Resets compressor so that a new set of input data can be processed.
+ */
+ @Override
+ public synchronized void reset() {
+ finish = false;
+ finished = false;
+ uncompressedDirectBuf.clear();
+ uncompressedDirectBufLen = 0;
+ compressedDirectBuf.clear();
+ compressedDirectBuf.limit(0);
+ userBufOff = userBufLen = 0;
+ bytesRead = bytesWritten = 0L;
+ }
+
+ /**
+ * Prepare the compressor to be used in a new stream with settings defined in
+ * the given Configuration
+ *
+ * @param conf Configuration from which new setting are fetched
+ */
+ @Override
+ public synchronized void reinit(Configuration conf) {
+ reset();
+ }
+
+ /**
+ * Return number of bytes given to this compressor since last reset.
+ */
+ @Override
+ public synchronized long getBytesRead() {
+ return bytesRead;
+ }
+
+ /**
+ * Return number of bytes consumed by callers of compress since last reset.
+ */
+ @Override
+ public synchronized long getBytesWritten() {
+ return bytesWritten;
+ }
+
+ /**
+ * Closes the compressor and discards any unprocessed input.
+ */
+ @Override
+ public synchronized void end() {
+ }
+
+ private native static void initIDs();
+
+ private native int compressBytesDirect();
+}
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/Lz4Decompressor.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/Lz4Decompressor.java
new file mode 100644
index 0000000000000..0cf65e5144266
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/Lz4Decompressor.java
@@ -0,0 +1,281 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.io.compress.lz4;
+
+import java.io.IOException;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.io.compress.Decompressor;
+import org.apache.hadoop.util.NativeCodeLoader;
+
+/**
+ * A {@link Decompressor} based on the lz4 compression algorithm.
+ * http://code.google.com/p/lz4/
+ */
+public class Lz4Decompressor implements Decompressor {
+ private static final Log LOG =
+ LogFactory.getLog(Lz4Compressor.class.getName());
+ private static final int DEFAULT_DIRECT_BUFFER_SIZE = 64 * 1024;
+
+ // HACK - Use this as a global lock in the JNI layer
+ @SuppressWarnings({"unchecked", "unused"})
+ private static Class clazz = Lz4Decompressor.class;
+
+ private int directBufferSize;
+ private Buffer compressedDirectBuf = null;
+ private int compressedDirectBufLen;
+ private Buffer uncompressedDirectBuf = null;
+ private byte[] userBuf = null;
+ private int userBufOff = 0, userBufLen = 0;
+ private boolean finished;
+
+ static {
+ if (NativeCodeLoader.isNativeCodeLoaded()) {
+ // Initialize the native library
+ try {
+ initIDs();
+ } catch (Throwable t) {
+ // Ignore failure to load/initialize lz4
+ LOG.warn(t.toString());
+ }
+ } else {
+ LOG.error("Cannot load " + Lz4Compressor.class.getName() +
+ " without native hadoop library!");
+ }
+ }
+
+ /**
+ * Creates a new compressor.
+ *
+ * @param directBufferSize size of the direct buffer to be used.
+ */
+ public Lz4Decompressor(int directBufferSize) {
+ this.directBufferSize = directBufferSize;
+
+ compressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize);
+ uncompressedDirectBuf = ByteBuffer.allocateDirect(directBufferSize);
+ uncompressedDirectBuf.position(directBufferSize);
+
+ }
+
+ /**
+ * Creates a new decompressor with the default buffer size.
+ */
+ public Lz4Decompressor() {
+ this(DEFAULT_DIRECT_BUFFER_SIZE);
+ }
+
+ /**
+ * Sets input data for decompression.
+ * This should be called if and only if {@link #needsInput()} returns
+ * <code>true</code> indicating that more input data is required.
+ * (Both native and non-native versions of various Decompressors require
+ * that the data passed in via <code>b[]</code> remain unmodified until
+ * the caller is explicitly notified--via {@link #needsInput()}--that the
+ * buffer may be safely modified. With this requirement, an extra
+ * buffer-copy can be avoided.)
+ *
+ * @param b Input data
+ * @param off Start offset
+ * @param len Length
+ */
+ @Override
+ public synchronized void setInput(byte[] b, int off, int len) {
+ if (b == null) {
+ throw new NullPointerException();
+ }
+ if (off < 0 || len < 0 || off > b.length - len) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+
+ this.userBuf = b;
+ this.userBufOff = off;
+ this.userBufLen = len;
+
+ setInputFromSavedData();
+
+ // Reinitialize lz4's output direct-buffer
+ uncompressedDirectBuf.limit(directBufferSize);
+ uncompressedDirectBuf.position(directBufferSize);
+ }
+
+ /**
+ * If a write would exceed the capacity of the direct buffers, it is set
+ * aside to be loaded by this function while the compressed data are
+ * consumed.
+ */
+ synchronized void setInputFromSavedData() {
+ compressedDirectBufLen = Math.min(userBufLen, directBufferSize);
+
+ // Reinitialize lz4's input direct buffer
+ compressedDirectBuf.rewind();
+ ((ByteBuffer) compressedDirectBuf).put(userBuf, userBufOff,
+ compressedDirectBufLen);
+
+ // Note how much data is being fed to lz4
+ userBufOff += compressedDirectBufLen;
+ userBufLen -= compressedDirectBufLen;
+ }
+
+ /**
+ * Does nothing.
+ */
+ @Override
+ public synchronized void setDictionary(byte[] b, int off, int len) {
+ // do nothing
+ }
+
+ /**
+ * Returns true if the input data buffer is empty and
+ * {@link #setInput(byte[], int, int)} should be called to
+ * provide more input.
+ *
+ * @return <code>true</code> if the input data buffer is empty and
+ * {@link #setInput(byte[], int, int)} should be called in
+ * order to provide more input.
+ */
+ @Override
+ public synchronized boolean needsInput() {
+ // Consume remaining compressed data?
+ if (uncompressedDirectBuf.remaining() > 0) {
+ return false;
+ }
+
+ // Check if lz4 has consumed all input
+ if (compressedDirectBufLen <= 0) {
+ // Check if we have consumed all user-input
+ if (userBufLen <= 0) {
+ return true;
+ } else {
+ setInputFromSavedData();
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Returns <code>false</code>.
+ *
+ * @return <code>false</code>.
+ */
+ @Override
+ public synchronized boolean needsDictionary() {
+ return false;
+ }
+
+ /**
+ * Returns true if the end of the decompressed
+ * data output stream has been reached.
+ *
+ * @return <code>true</code> if the end of the decompressed
+ * data output stream has been reached.
+ */
+ @Override
+ public synchronized boolean finished() {
+ return (finished && uncompressedDirectBuf.remaining() == 0);
+ }
+
+ /**
+ * Fills specified buffer with uncompressed data. Returns actual number
+ * of bytes of uncompressed data. A return value of 0 indicates that
+ * {@link #needsInput()} should be called in order to determine if more
+ * input data is required.
+ *
+ * @param b Buffer for the compressed data
+ * @param off Start offset of the data
+ * @param len Size of the buffer
+ * @return The actual number of bytes of compressed data.
+ * @throws IOException
+ */
+ @Override
+ public synchronized int decompress(byte[] b, int off, int len)
+ throws IOException {
+ if (b == null) {
+ throw new NullPointerException();
+ }
+ if (off < 0 || len < 0 || off > b.length - len) {
+ throw new ArrayIndexOutOfBoundsException();
+ }
+
+ int n = 0;
+
+ // Check if there is uncompressed data
+ n = uncompressedDirectBuf.remaining();
+ if (n > 0) {
+ n = Math.min(n, len);
+ ((ByteBuffer) uncompressedDirectBuf).get(b, off, n);
+ return n;
+ }
+ if (compressedDirectBufLen > 0) {
+ // Re-initialize the lz4's output direct buffer
+ uncompressedDirectBuf.rewind();
+ uncompressedDirectBuf.limit(directBufferSize);
+
+ // Decompress data
+ n = decompressBytesDirect();
+ uncompressedDirectBuf.limit(n);
+
+ if (userBufLen <= 0) {
+ finished = true;
+ }
+
+ // Get atmost 'len' bytes
+ n = Math.min(n, len);
+ ((ByteBuffer) uncompressedDirectBuf).get(b, off, n);
+ }
+
+ return n;
+ }
+
+ /**
+ * Returns <code>0</code>.
+ *
+ * @return <code>0</code>.
+ */
+ @Override
+ public synchronized int getRemaining() {
+ // Never use this function in BlockDecompressorStream.
+ return 0;
+ }
+
+ public synchronized void reset() {
+ finished = false;
+ compressedDirectBufLen = 0;
+ uncompressedDirectBuf.limit(directBufferSize);
+ uncompressedDirectBuf.position(directBufferSize);
+ userBufOff = userBufLen = 0;
+ }
+
+ /**
+ * Resets decompressor and input and output buffers so that a new set of
+ * input data can be processed.
+ */
+ @Override
+ public synchronized void end() {
+ // do nothing
+ }
+
+ private native static void initIDs();
+
+ private native int decompressBytesDirect();
+}
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/package-info.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/package-info.java
new file mode 100644
index 0000000000000..11827f1748628
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/compress/lz4/package-info.java
@@ -0,0 +1,23 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
[email protected]
[email protected]
+package org.apache.hadoop.io.compress.lz4;
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
+
diff --git a/hadoop-common-project/hadoop-common/src/main/native/Makefile.am b/hadoop-common-project/hadoop-common/src/main/native/Makefile.am
index 3afc0b88a02e8..c4ca564c2be7b 100644
--- a/hadoop-common-project/hadoop-common/src/main/native/Makefile.am
+++ b/hadoop-common-project/hadoop-common/src/main/native/Makefile.am
@@ -46,6 +46,9 @@ libhadoop_la_SOURCES = src/org/apache/hadoop/io/compress/zlib/ZlibCompressor.c \
src/org/apache/hadoop/io/compress/zlib/ZlibDecompressor.c \
src/org/apache/hadoop/io/compress/snappy/SnappyCompressor.c \
src/org/apache/hadoop/io/compress/snappy/SnappyDecompressor.c \
+ src/org/apache/hadoop/io/compress/lz4/lz4.c \
+ src/org/apache/hadoop/io/compress/lz4/Lz4Compressor.c \
+ src/org/apache/hadoop/io/compress/lz4/Lz4Decompressor.c \
src/org/apache/hadoop/security/getGroup.c \
src/org/apache/hadoop/security/JniBasedUnixGroupsMapping.c \
src/org/apache/hadoop/security/JniBasedUnixGroupsNetgroupMapping.c \
diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/Lz4Compressor.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/Lz4Compressor.c
new file mode 100644
index 0000000000000..d52a4f6b2a3ef
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/Lz4Compressor.c
@@ -0,0 +1,101 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if defined HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+#include "org_apache_hadoop.h"
+#include "org_apache_hadoop_io_compress_lz4_Lz4Compressor.h"
+
+//****************************
+// Simple Functions
+//****************************
+
+extern int LZ4_compress (char* source, char* dest, int isize);
+
+/*
+LZ4_compress() :
+ return : the number of bytes in compressed buffer dest
+ note : destination buffer must be already allocated.
+ To avoid any problem, size it to handle worst cases situations (input data not compressible)
+ Worst case size is : "inputsize + 0.4%", with "0.4%" being at least 8 bytes.
+
+*/
+
+static jfieldID Lz4Compressor_clazz;
+static jfieldID Lz4Compressor_uncompressedDirectBuf;
+static jfieldID Lz4Compressor_uncompressedDirectBufLen;
+static jfieldID Lz4Compressor_compressedDirectBuf;
+static jfieldID Lz4Compressor_directBufferSize;
+
+
+JNIEXPORT void JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_initIDs
+(JNIEnv *env, jclass clazz){
+
+ Lz4Compressor_clazz = (*env)->GetStaticFieldID(env, clazz, "clazz",
+ "Ljava/lang/Class;");
+ Lz4Compressor_uncompressedDirectBuf = (*env)->GetFieldID(env, clazz,
+ "uncompressedDirectBuf",
+ "Ljava/nio/Buffer;");
+ Lz4Compressor_uncompressedDirectBufLen = (*env)->GetFieldID(env, clazz,
+ "uncompressedDirectBufLen", "I");
+ Lz4Compressor_compressedDirectBuf = (*env)->GetFieldID(env, clazz,
+ "compressedDirectBuf",
+ "Ljava/nio/Buffer;");
+ Lz4Compressor_directBufferSize = (*env)->GetFieldID(env, clazz,
+ "directBufferSize", "I");
+}
+
+JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Compressor_compressBytesDirect
+(JNIEnv *env, jobject thisj){
+ // Get members of Lz4Compressor
+ jobject clazz = (*env)->GetStaticObjectField(env, thisj, Lz4Compressor_clazz);
+ jobject uncompressed_direct_buf = (*env)->GetObjectField(env, thisj, Lz4Compressor_uncompressedDirectBuf);
+ jint uncompressed_direct_buf_len = (*env)->GetIntField(env, thisj, Lz4Compressor_uncompressedDirectBufLen);
+ jobject compressed_direct_buf = (*env)->GetObjectField(env, thisj, Lz4Compressor_compressedDirectBuf);
+ jint compressed_direct_buf_len = (*env)->GetIntField(env, thisj, Lz4Compressor_directBufferSize);
+
+ // Get the input direct buffer
+ LOCK_CLASS(env, clazz, "Lz4Compressor");
+ const char* uncompressed_bytes = (const char*)(*env)->GetDirectBufferAddress(env, uncompressed_direct_buf);
+ UNLOCK_CLASS(env, clazz, "Lz4Compressor");
+
+ if (uncompressed_bytes == 0) {
+ return (jint)0;
+ }
+
+ // Get the output direct buffer
+ LOCK_CLASS(env, clazz, "Lz4Compressor");
+ char* compressed_bytes = (char *)(*env)->GetDirectBufferAddress(env, compressed_direct_buf);
+ UNLOCK_CLASS(env, clazz, "Lz4Compressor");
+
+ if (compressed_bytes == 0) {
+ return (jint)0;
+ }
+
+ compressed_direct_buf_len = LZ4_compress(uncompressed_bytes, compressed_bytes, uncompressed_direct_buf_len);
+ if (compressed_direct_buf_len < 0){
+ THROW(env, "Ljava/lang/InternalError", "LZ4_compress failed");
+ }
+
+ (*env)->SetIntField(env, thisj, Lz4Compressor_uncompressedDirectBufLen, 0);
+
+ return (jint)compressed_direct_buf_len;
+}
+
diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/Lz4Decompressor.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/Lz4Decompressor.c
new file mode 100644
index 0000000000000..547b027cc14c5
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/Lz4Decompressor.c
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#if defined HAVE_CONFIG_H
+ #include <config.h>
+#endif
+
+#include "org_apache_hadoop.h"
+#include "org_apache_hadoop_io_compress_lz4_Lz4Decompressor.h"
+
+int LZ4_uncompress_unknownOutputSize (char* source, char* dest, int isize, int maxOutputSize);
+
+/*
+LZ4_uncompress_unknownOutputSize() :
+ isize : is the input size, therefore the compressed size
+ maxOutputSize : is the size of the destination buffer (which must be already allocated)
+ return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
+ If the source stream is malformed, the function will stop decoding and return a negative result, indicating the byte position of the faulty instruction
+ This version never writes beyond dest + maxOutputSize, and is therefore protected against malicious data packets
+ note : This version is a bit slower than LZ4_uncompress
+*/
+
+
+static jfieldID Lz4Decompressor_clazz;
+static jfieldID Lz4Decompressor_compressedDirectBuf;
+static jfieldID Lz4Decompressor_compressedDirectBufLen;
+static jfieldID Lz4Decompressor_uncompressedDirectBuf;
+static jfieldID Lz4Decompressor_directBufferSize;
+
+JNIEXPORT void JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Decompressor_initIDs
+(JNIEnv *env, jclass clazz){
+
+ Lz4Decompressor_clazz = (*env)->GetStaticFieldID(env, clazz, "clazz",
+ "Ljava/lang/Class;");
+ Lz4Decompressor_compressedDirectBuf = (*env)->GetFieldID(env,clazz,
+ "compressedDirectBuf",
+ "Ljava/nio/Buffer;");
+ Lz4Decompressor_compressedDirectBufLen = (*env)->GetFieldID(env,clazz,
+ "compressedDirectBufLen", "I");
+ Lz4Decompressor_uncompressedDirectBuf = (*env)->GetFieldID(env,clazz,
+ "uncompressedDirectBuf",
+ "Ljava/nio/Buffer;");
+ Lz4Decompressor_directBufferSize = (*env)->GetFieldID(env, clazz,
+ "directBufferSize", "I");
+}
+
+JNIEXPORT jint JNICALL Java_org_apache_hadoop_io_compress_lz4_Lz4Decompressor_decompressBytesDirect
+(JNIEnv *env, jobject thisj){
+ // Get members of Lz4Decompressor
+ jobject clazz = (*env)->GetStaticObjectField(env,thisj, Lz4Decompressor_clazz);
+ jobject compressed_direct_buf = (*env)->GetObjectField(env,thisj, Lz4Decompressor_compressedDirectBuf);
+ jint compressed_direct_buf_len = (*env)->GetIntField(env,thisj, Lz4Decompressor_compressedDirectBufLen);
+ jobject uncompressed_direct_buf = (*env)->GetObjectField(env,thisj, Lz4Decompressor_uncompressedDirectBuf);
+ size_t uncompressed_direct_buf_len = (*env)->GetIntField(env, thisj, Lz4Decompressor_directBufferSize);
+
+ // Get the input direct buffer
+ LOCK_CLASS(env, clazz, "Lz4Decompressor");
+ const char* compressed_bytes = (const char*)(*env)->GetDirectBufferAddress(env, compressed_direct_buf);
+ UNLOCK_CLASS(env, clazz, "Lz4Decompressor");
+
+ if (compressed_bytes == 0) {
+ return (jint)0;
+ }
+
+ // Get the output direct buffer
+ LOCK_CLASS(env, clazz, "Lz4Decompressor");
+ char* uncompressed_bytes = (char *)(*env)->GetDirectBufferAddress(env, uncompressed_direct_buf);
+ UNLOCK_CLASS(env, clazz, "Lz4Decompressor");
+
+ if (uncompressed_bytes == 0) {
+ return (jint)0;
+ }
+
+ uncompressed_direct_buf_len = LZ4_uncompress_unknownOutputSize(compressed_bytes, uncompressed_bytes, compressed_direct_buf_len, uncompressed_direct_buf_len);
+ if (uncompressed_direct_buf_len < 0) {
+ THROW(env, "Ljava/lang/InternalError", "LZ4_uncompress_unknownOutputSize failed.");
+ }
+
+ (*env)->SetIntField(env, thisj, Lz4Decompressor_compressedDirectBufLen, 0);
+
+ return (jint)uncompressed_direct_buf_len;
+}
diff --git a/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/lz4.c b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/lz4.c
new file mode 100644
index 0000000000000..549bf229eca27
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/native/src/org/apache/hadoop/io/compress/lz4/lz4.c
@@ -0,0 +1,646 @@
+/*
+ LZ4 - Fast LZ compression algorithm
+ Copyright (C) 2011, Yann Collet.
+ BSD License
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are
+ met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following disclaimer
+ in the documentation and/or other materials provided with the
+ distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*/
+
+//**************************************
+// Copy from:
+// URL: http://lz4.googlecode.com/svn/trunk/lz4.c
+// Repository Root: http://lz4.googlecode.com/svn
+// Repository UUID: 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
+// Revision: 43
+// Node Kind: file
+// Last Changed Author: [email protected]
+// Last Changed Rev: 43
+// Last Changed Date: 2011-12-16 15:41:46 -0800 (Fri, 16 Dec 2011)
+// Sha1: 9db7b2c57698c528d79572e6bce2e7dc33fa5998
+//**************************************
+
+//**************************************
+// Compilation Directives
+//**************************************
+#if __STDC_VERSION__ >= 199901L
+ /* "restrict" is a known keyword */
+#else
+#define restrict // Disable restrict
+#endif
+
+
+//**************************************
+// Includes
+//**************************************
+#include <stdlib.h> // for malloc
+#include <string.h> // for memset
+#include "lz4.h"
+
+
+//**************************************
+// Performance parameter
+//**************************************
+// Increasing this value improves compression ratio
+// Lowering this value reduces memory usage
+// Lowering may also improve speed, typically on reaching cache size limits (L1 32KB for Intel, 64KB for AMD)
+// Memory usage formula for 32 bits systems : N->2^(N+2) Bytes (examples : 17 -> 512KB ; 12 -> 16KB)
+#define HASH_LOG 12
+
+
+//**************************************
+// Basic Types
+//**************************************
+#if defined(_MSC_VER) // Visual Studio does not support 'stdint' natively
+#define BYTE unsigned __int8
+#define U16 unsigned __int16
+#define U32 unsigned __int32
+#define S32 __int32
+#else
+#include <stdint.h>
+#define BYTE uint8_t
+#define U16 uint16_t
+#define U32 uint32_t
+#define S32 int32_t
+#endif
+
+
+//**************************************
+// Constants
+//**************************************
+#define MINMATCH 4
+#define SKIPSTRENGTH 6
+#define STACKLIMIT 13
+#define HEAPMODE (HASH_LOG>STACKLIMIT) // Defines if memory is allocated into the stack (local variable), or into the heap (malloc()).
+#define COPYTOKEN 4
+#define COPYLENGTH 8
+#define LASTLITERALS 5
+#define MFLIMIT (COPYLENGTH+MINMATCH)
+#define MINLENGTH (MFLIMIT+1)
+
+#define MAXD_LOG 16
+#define MAX_DISTANCE ((1 << MAXD_LOG) - 1)
+
+#define HASHTABLESIZE (1 << HASH_LOG)
+#define HASH_MASK (HASHTABLESIZE - 1)
+
+#define ML_BITS 4
+#define ML_MASK ((1U<<ML_BITS)-1)
+#define RUN_BITS (8-ML_BITS)
+#define RUN_MASK ((1U<<RUN_BITS)-1)
+
+
+//**************************************
+// Local structures
+//**************************************
+struct refTables
+{
+ const BYTE* hashTable[HASHTABLESIZE];
+};
+
+#ifdef __GNUC__
+# define _PACKED __attribute__ ((packed))
+#else
+# define _PACKED
+#endif
+
+typedef struct _U32_S
+{
+ U32 v;
+} _PACKED U32_S;
+
+typedef struct _U16_S
+{
+ U16 v;
+} _PACKED U16_S;
+
+#define A32(x) (((U32_S *)(x))->v)
+#define A16(x) (((U16_S *)(x))->v)
+
+
+//**************************************
+// Macros
+//**************************************
+#define LZ4_HASH_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-HASH_LOG))
+#define LZ4_HASH_VALUE(p) LZ4_HASH_FUNCTION(A32(p))
+#define LZ4_COPYPACKET(s,d) A32(d) = A32(s); d+=4; s+=4; A32(d) = A32(s); d+=4; s+=4;
+#define LZ4_WILDCOPY(s,d,e) do { LZ4_COPYPACKET(s,d) } while (d<e);
+#define LZ4_BLINDCOPY(s,d,l) { BYTE* e=d+l; LZ4_WILDCOPY(s,d,e); d=e; }
+
+
+
+//****************************
+// Compression CODE
+//****************************
+
+int LZ4_compressCtx(void** ctx,
+ char* source,
+ char* dest,
+ int isize)
+{
+#if HEAPMODE
+ struct refTables *srt = (struct refTables *) (*ctx);
+ const BYTE** HashTable;
+#else
+ const BYTE* HashTable[HASHTABLESIZE] = {0};
+#endif
+
+ const BYTE* ip = (BYTE*) source;
+ const BYTE* anchor = ip;
+ const BYTE* const iend = ip + isize;
+ const BYTE* const mflimit = iend - MFLIMIT;
+#define matchlimit (iend - LASTLITERALS)
+
+ BYTE* op = (BYTE*) dest;
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ const size_t DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 };
+#endif
+ int len, length;
+ const int skipStrength = SKIPSTRENGTH;
+ U32 forwardH;
+
+
+ // Init
+ if (isize<MINLENGTH) goto _last_literals;
+#if HEAPMODE
+ if (*ctx == NULL)
+ {
+ srt = (struct refTables *) malloc ( sizeof(struct refTables) );
+ *ctx = (void*) srt;
+ }
+ HashTable = srt->hashTable;
+ memset((void*)HashTable, 0, sizeof(srt->hashTable));
+#else
+ (void) ctx;
+#endif
+
+
+ // First Byte
+ HashTable[LZ4_HASH_VALUE(ip)] = ip;
+ ip++; forwardH = LZ4_HASH_VALUE(ip);
+
+ // Main Loop
+ for ( ; ; )
+ {
+ int findMatchAttempts = (1U << skipStrength) + 3;
+ const BYTE* forwardIp = ip;
+ const BYTE* ref;
+ BYTE* token;
+
+ // Find a match
+ do {
+ U32 h = forwardH;
+ int step = findMatchAttempts++ >> skipStrength;
+ ip = forwardIp;
+ forwardIp = ip + step;
+
+ if (forwardIp > mflimit) { goto _last_literals; }
+
+ forwardH = LZ4_HASH_VALUE(forwardIp);
+ ref = HashTable[h];
+ HashTable[h] = ip;
+
+ } while ((ref < ip - MAX_DISTANCE) || (A32(ref) != A32(ip)));
+
+ // Catch up
+ while ((ip>anchor) && (ref>(BYTE*)source) && (ip[-1]==ref[-1])) { ip--; ref--; }
+
+ // Encode Literal length
+ length = ip - anchor;
+ token = op++;
+ if (length>=(int)RUN_MASK) { *token=(RUN_MASK<<ML_BITS); len = length-RUN_MASK; for(; len > 254 ; len-=255) *op++ = 255; *op++ = (BYTE)len; }
+ else *token = (length<<ML_BITS);
+
+ // Copy Literals
+ LZ4_BLINDCOPY(anchor, op, length);
+
+
+_next_match:
+ // Encode Offset
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ A16(op) = (ip-ref); op+=2;
+#else
+ { int delta = ip-ref; *op++ = delta; *op++ = delta>>8; }
+#endif
+
+ // Start Counting
+ ip+=MINMATCH; ref+=MINMATCH; // MinMatch verified
+ anchor = ip;
+ while (ip<matchlimit-3)
+ {
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ int diff = A32(ref) ^ A32(ip);
+ if (!diff) { ip+=4; ref+=4; continue; }
+ ip += DeBruijnBytePos[((U32)((diff & -diff) * 0x077CB531U)) >> 27];
+#else
+ if (A32(ref) == A32(ip)) { ip+=4; ref+=4; continue; }
+ if (A16(ref) == A16(ip)) { ip+=2; ref+=2; }
+ if (*ref == *ip) ip++;
+#endif
+ goto _endCount;
+ }
+ if ((ip<(matchlimit-1)) && (A16(ref) == A16(ip))) { ip+=2; ref+=2; }
+ if ((ip<matchlimit) && (*ref == *ip)) ip++;
+_endCount:
+ len = (ip - anchor);
+
+ // Encode MatchLength
+ if (len>=(int)ML_MASK) { *token+=ML_MASK; len-=ML_MASK; for(; len > 509 ; len-=510) { *op++ = 255; *op++ = 255; } if (len > 254) { len-=255; *op++ = 255; } *op++ = (BYTE)len; }
+ else *token += len;
+
+ // Test end of chunk
+ if (ip > mflimit) { anchor = ip; break; }
+
+ // Fill table
+ HashTable[LZ4_HASH_VALUE(ip-2)] = ip-2;
+
+ // Test next position
+ ref = HashTable[LZ4_HASH_VALUE(ip)];
+ HashTable[LZ4_HASH_VALUE(ip)] = ip;
+ if ((ref > ip - (MAX_DISTANCE + 1)) && (A32(ref) == A32(ip))) { token = op++; *token=0; goto _next_match; }
+
+ // Prepare next loop
+ anchor = ip++;
+ forwardH = LZ4_HASH_VALUE(ip);
+ }
+
+_last_literals:
+ // Encode Last Literals
+ {
+ int lastRun = iend - anchor;
+ if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun > 254 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; }
+ else *op++ = (lastRun<<ML_BITS);
+ memcpy(op, anchor, iend - anchor);
+ op += iend-anchor;
+ }
+
+ // End
+ return (int) (((char*)op)-dest);
+}
+
+
+
+// Note : this function is valid only if isize < LZ4_64KLIMIT
+#define LZ4_64KLIMIT ((1U<<16) + (MFLIMIT-1))
+#define HASHLOG64K (HASH_LOG+1)
+#define LZ4_HASH64K_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-HASHLOG64K))
+#define LZ4_HASH64K_VALUE(p) LZ4_HASH64K_FUNCTION(A32(p))
+int LZ4_compress64kCtx(void** ctx,
+ char* source,
+ char* dest,
+ int isize)
+{
+#if HEAPMODE
+ struct refTables *srt = (struct refTables *) (*ctx);
+ U16* HashTable;
+#else
+ U16 HashTable[HASHTABLESIZE<<1] = {0};
+#endif
+
+ const BYTE* ip = (BYTE*) source;
+ const BYTE* anchor = ip;
+ const BYTE* const base = ip;
+ const BYTE* const iend = ip + isize;
+ const BYTE* const mflimit = iend - MFLIMIT;
+#define matchlimit (iend - LASTLITERALS)
+
+ BYTE* op = (BYTE*) dest;
+
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ const size_t DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 };
+#endif
+ int len, length;
+ const int skipStrength = SKIPSTRENGTH;
+ U32 forwardH;
+
+
+ // Init
+ if (isize<MINLENGTH) goto _last_literals;
+#if HEAPMODE
+ if (*ctx == NULL)
+ {
+ srt = (struct refTables *) malloc ( sizeof(struct refTables) );
+ *ctx = (void*) srt;
+ }
+ HashTable = (U16*)(srt->hashTable);
+ memset((void*)HashTable, 0, sizeof(srt->hashTable));
+#else
+ (void) ctx;
+#endif
+
+
+ // First Byte
+ ip++; forwardH = LZ4_HASH64K_VALUE(ip);
+
+ // Main Loop
+ for ( ; ; )
+ {
+ int findMatchAttempts = (1U << skipStrength) + 3;
+ const BYTE* forwardIp = ip;
+ const BYTE* ref;
+ BYTE* token;
+
+ // Find a match
+ do {
+ U32 h = forwardH;
+ int step = findMatchAttempts++ >> skipStrength;
+ ip = forwardIp;
+ forwardIp = ip + step;
+
+ if (forwardIp > mflimit) { goto _last_literals; }
+
+ forwardH = LZ4_HASH64K_VALUE(forwardIp);
+ ref = base + HashTable[h];
+ HashTable[h] = ip - base;
+
+ } while (A32(ref) != A32(ip));
+
+ // Catch up
+ while ((ip>anchor) && (ref>(BYTE*)source) && (ip[-1]==ref[-1])) { ip--; ref--; }
+
+ // Encode Literal length
+ length = ip - anchor;
+ token = op++;
+ if (length>=(int)RUN_MASK) { *token=(RUN_MASK<<ML_BITS); len = length-RUN_MASK; for(; len > 254 ; len-=255) *op++ = 255; *op++ = (BYTE)len; }
+ else *token = (length<<ML_BITS);
+
+ // Copy Literals
+ LZ4_BLINDCOPY(anchor, op, length);
+
+
+_next_match:
+ // Encode Offset
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ A16(op) = (ip-ref); op+=2;
+#else
+ { int delta = ip-ref; *op++ = delta; *op++ = delta>>8; }
+#endif
+
+ // Start Counting
+ ip+=MINMATCH; ref+=MINMATCH; // MinMatch verified
+ anchor = ip;
+ while (ip<matchlimit-3)
+ {
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ int diff = A32(ref) ^ A32(ip);
+ if (!diff) { ip+=4; ref+=4; continue; }
+ ip += DeBruijnBytePos[((U32)((diff & -diff) * 0x077CB531U)) >> 27];
+#else
+ if (A32(ref) == A32(ip)) { ip+=4; ref+=4; continue; }
+ if (A16(ref) == A16(ip)) { ip+=2; ref+=2; }
+ if (*ref == *ip) ip++;
+#endif
+ goto _endCount;
+ }
+ if ((ip<(matchlimit-1)) && (A16(ref) == A16(ip))) { ip+=2; ref+=2; }
+ if ((ip<matchlimit) && (*ref == *ip)) ip++;
+_endCount:
+ len = (ip - anchor);
+
+ // Encode MatchLength
+ if (len>=(int)ML_MASK) { *token+=ML_MASK; len-=ML_MASK; for(; len > 509 ; len-=510) { *op++ = 255; *op++ = 255; } if (len > 254) { len-=255; *op++ = 255; } *op++ = (BYTE)len; }
+ else *token += len;
+
+ // Test end of chunk
+ if (ip > mflimit) { anchor = ip; break; }
+
+ // Test next position
+ ref = base + HashTable[LZ4_HASH64K_VALUE(ip)];
+ HashTable[LZ4_HASH64K_VALUE(ip)] = ip - base;
+ if (A32(ref) == A32(ip)) { token = op++; *token=0; goto _next_match; }
+
+ // Prepare next loop
+ anchor = ip++;
+ forwardH = LZ4_HASH64K_VALUE(ip);
+ }
+
+_last_literals:
+ // Encode Last Literals
+ {
+ int lastRun = iend - anchor;
+ if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun > 254 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; }
+ else *op++ = (lastRun<<ML_BITS);
+ memcpy(op, anchor, iend - anchor);
+ op += iend-anchor;
+ }
+
+ // End
+ return (int) (((char*)op)-dest);
+}
+
+
+
+int LZ4_compress(char* source,
+ char* dest,
+ int isize)
+{
+#if HEAPMODE
+ void* ctx = malloc(sizeof(struct refTables));
+ int result;
+ if (isize < LZ4_64KLIMIT)
+ result = LZ4_compress64kCtx(&ctx, source, dest, isize);
+ else result = LZ4_compressCtx(&ctx, source, dest, isize);
+ free(ctx);
+ return result;
+#else
+ if (isize < (int)LZ4_64KLIMIT) return LZ4_compress64kCtx(NULL, source, dest, isize);
+ return LZ4_compressCtx(NULL, source, dest, isize);
+#endif
+}
+
+
+
+
+//****************************
+// Decompression CODE
+//****************************
+
+// Note : The decoding functions LZ4_uncompress() and LZ4_uncompress_unknownOutputSize()
+// are safe against "buffer overflow" attack type
+// since they will *never* write outside of the provided output buffer :
+// they both check this condition *before* writing anything.
+// A corrupted packet however can make them *read* within the first 64K before the output buffer.
+
+int LZ4_uncompress(char* source,
+ char* dest,
+ int osize)
+{
+ // Local Variables
+ const BYTE* restrict ip = (const BYTE*) source;
+ const BYTE* restrict ref;
+
+ BYTE* restrict op = (BYTE*) dest;
+ BYTE* const oend = op + osize;
+ BYTE* cpy;
+
+ BYTE token;
+
+ U32 dec[4]={0, 3, 2, 3};
+ int len, length;
+
+
+ // Main Loop
+ while (1)
+ {
+ // get runlength
+ token = *ip++;
+ if ((length=(token>>ML_BITS)) == RUN_MASK) { for (;(len=*ip++)==255;length+=255){} length += len; }
+
+ // copy literals
+ cpy = op+length;
+ if (cpy>oend-COPYLENGTH)
+ {
+ if (cpy > oend) goto _output_error;
+ memcpy(op, ip, length);
+ ip += length;
+ break; // Necessarily EOF
+ }
+ LZ4_WILDCOPY(ip, op, cpy); ip -= (op-cpy); op = cpy;
+
+
+ // get offset
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ ref = cpy - A16(ip); ip+=2;
+#else
+ { int delta = *ip++; delta += *ip++ << 8; ref = cpy - delta; }
+#endif
+
+ // get matchlength
+ if ((length=(token&ML_MASK)) == ML_MASK) { for (;*ip==255;length+=255) {ip++;} length += *ip++; }
+
+ // copy repeated sequence
+ if (op-ref<COPYTOKEN)
+ {
+ *op++ = *ref++;
+ *op++ = *ref++;
+ *op++ = *ref++;
+ *op++ = *ref++;
+ ref -= dec[op-ref];
+ A32(op)=A32(ref);
+ } else { A32(op)=A32(ref); op+=4; ref+=4; }
+ cpy = op + length;
+ if (cpy > oend-COPYLENGTH)
+ {
+ if (cpy > oend) goto _output_error;
+ LZ4_WILDCOPY(ref, op, (oend-COPYLENGTH));
+ while(op<cpy) *op++=*ref++;
+ op=cpy;
+ if (op == oend) break; // Check EOF (should never happen, since last 5 bytes are supposed to be literals)
+ continue;
+ }
+ LZ4_WILDCOPY(ref, op, cpy);
+ op=cpy; // correction
+ }
+
+ // end of decoding
+ return (int) (((char*)ip)-source);
+
+ // write overflow error detected
+_output_error:
+ return (int) (-(((char*)ip)-source));
+}
+
+
+int LZ4_uncompress_unknownOutputSize(
+ char* source,
+ char* dest,
+ int isize,
+ int maxOutputSize)
+{
+ // Local Variables
+ const BYTE* restrict ip = (const BYTE*) source;
+ const BYTE* const iend = ip + isize;
+ const BYTE* restrict ref;
+
+ BYTE* restrict op = (BYTE*) dest;
+ BYTE* const oend = op + maxOutputSize;
+ BYTE* cpy;
+
+ BYTE token;
+
+ U32 dec[4]={0, 3, 2, 3};
+ int len, length;
+
+
+ // Main Loop
+ while (ip<iend)
+ {
+ // get runlength
+ token = *ip++;
+ if ((length=(token>>ML_BITS)) == RUN_MASK) { for (;(len=*ip++)==255;length+=255){} length += len; }
+
+ // copy literals
+ cpy = op+length;
+ if (cpy>oend-COPYLENGTH)
+ {
+ if (cpy > oend) goto _output_error;
+ memcpy(op, ip, length);
+ op += length;
+ break; // Necessarily EOF
+ }
+ LZ4_WILDCOPY(ip, op, cpy); ip -= (op-cpy); op = cpy;
+ if (ip>=iend) break; // check EOF
+
+ // get offset
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+ ref = cpy - A16(ip); ip+=2;
+#else
+ { int delta = *ip++; delta += *ip++ << 8; ref = cpy - delta; }
+#endif
+
+ // get matchlength
+ if ((length=(token&ML_MASK)) == ML_MASK) { for (;(len=*ip++)==255;length+=255){} length += len; }
+
+ // copy repeated sequence
+ if (op-ref<COPYTOKEN)
+ {
+ *op++ = *ref++;
+ *op++ = *ref++;
+ *op++ = *ref++;
+ *op++ = *ref++;
+ ref -= dec[op-ref];
+ A32(op)=A32(ref);
+ } else { A32(op)=A32(ref); op+=4; ref+=4; }
+ cpy = op + length;
+ if (cpy>oend-COPYLENGTH)
+ {
+ if (cpy > oend) goto _output_error;
+ LZ4_WILDCOPY(ref, op, (oend-COPYLENGTH));
+ while(op<cpy) *op++=*ref++;
+ op=cpy;
+ if (op == oend) break; // Check EOF (should never happen, since last 5 bytes are supposed to be literals)
+ continue;
+ }
+ LZ4_WILDCOPY(ref, op, cpy);
+ op=cpy; // correction
+ }
+
+ // end of decoding
+ return (int) (((char*)op)-dest);
+
+ // write overflow error detected
+_output_error:
+ return (int) (-(((char*)ip)-source));
+}
+
diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/TestCodec.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/TestCodec.java
index d1783f28aeac5..119fb3c14e49b 100644
--- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/TestCodec.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/io/compress/TestCodec.java
@@ -60,6 +60,7 @@
import org.apache.hadoop.io.compress.zlib.ZlibCompressor.CompressionStrategy;
import org.apache.hadoop.io.compress.zlib.ZlibFactory;
import org.apache.hadoop.util.LineReader;
+import org.apache.hadoop.util.NativeCodeLoader;
import org.apache.hadoop.util.ReflectionUtils;
import org.apache.commons.codec.binary.Base64;
@@ -108,6 +109,18 @@ public void testSnappyCodec() throws IOException {
}
}
}
+
+ @Test
+ public void testLz4Codec() throws IOException {
+ if (NativeCodeLoader.isNativeCodeLoaded()) {
+ if (Lz4Codec.isNativeCodeLoaded()) {
+ codecTest(conf, seed, 0, "org.apache.hadoop.io.compress.Lz4Codec");
+ codecTest(conf, seed, count, "org.apache.hadoop.io.compress.Lz4Codec");
+ } else {
+ Assert.fail("Native hadoop library available but lz4 not");
+ }
+ }
+ }
@Test
public void testDeflateCodec() throws IOException {
|
4ac95d127410491867918f690d06eb8bbd661f6d
|
Vala
|
vapigen: Make quotes around metadata arguments optional
Fixes bug 588171.
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/vapigen/valagidlparser.vala b/vapigen/valagidlparser.vala
index 70a2019120..e8ee3496e9 100644
--- a/vapigen/valagidlparser.vala
+++ b/vapigen/valagidlparser.vala
@@ -1930,7 +1930,7 @@ public class Vala.GIdlParser : CodeVisitor {
}
private string eval (string s) {
- return s.offset (1).ndup (s.size () - 2);
+ return ((s.size () >= 2) && s.has_prefix ("\"") && s.has_suffix ("\"")) ? s.offset (1).ndup (s.size () - 2) : s;
}
private Signal? parse_signal (IdlNodeSignal sig_node) {
|
9aa093303a2580c5cd165e95b0d59062ec9ec835
|
restlet-framework-java
|
- Initial code for new default HTTP connector and- SIP connector.--
|
a
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/modules/org.restlet/src/org/restlet/engine/http/connector/ClientConnection.java b/modules/org.restlet/src/org/restlet/engine/http/connector/ClientConnection.java
index 0cadd7f228..faafd5fbb2 100644
--- a/modules/org.restlet/src/org/restlet/engine/http/connector/ClientConnection.java
+++ b/modules/org.restlet/src/org/restlet/engine/http/connector/ClientConnection.java
@@ -297,6 +297,8 @@ protected void writeMessageHeadLine(Response message,
headStream.write(' ');
headStream.write(getRequestUri(request.getResourceRef()).getBytes());
headStream.write(' ');
+ headStream.write(request.getProtocol().getName().getBytes());
+ headStream.write('/');
headStream.write(request.getProtocol().getVersion().getBytes());
HeaderUtils.writeCRLF(getOutboundStream());
}
|
c7d0f5f40f9f08196d9e1247351ef30cd8d6c212
|
apache$maven-plugins
|
o Pulled-up AnalyzeMojo functionality into AbstractAnalyzeMojo to allow different Plexus annotations to be specified on subclasses
o Changed AnalyzeMojo to @execute phase="test-compile" for standalone functionality
o Added AnalyzeAttachedMojo to @phase verify for participating in the build lifecycle
o Improved Javadoc
git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk@576809 13f79535-47bb-0310-9956-ffa450edef68
|
p
|
https://github.com/apache/maven-plugins
|
diff --git a/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractAnalyzeMojo.java b/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractAnalyzeMojo.java
new file mode 100644
index 0000000000..cc71cf5dd6
--- /dev/null
+++ b/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AbstractAnalyzeMojo.java
@@ -0,0 +1,325 @@
+package org.apache.maven.plugin.dependency;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import java.io.File;
+import java.io.StringWriter;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import org.apache.maven.artifact.Artifact;
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
+import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
+import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
+import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
+import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
+
+/**
+ * Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused
+ * and declared.
+ *
+ * @author <a href="mailto:[email protected]">Mark Hobson</a>
+ * @version $Id$
+ * @since 2.0-alpha-5
+ */
+public abstract class AbstractAnalyzeMojo
+ extends AbstractMojo
+{
+ // fields -----------------------------------------------------------------
+
+ /**
+ * The Maven project to analyze.
+ *
+ * @parameter expression="${project}"
+ * @required
+ * @readonly
+ */
+ private MavenProject project;
+
+ /**
+ * The Maven project dependency analyzer to use.
+ *
+ * @component
+ * @required
+ * @readonly
+ */
+ private ProjectDependencyAnalyzer analyzer;
+
+ /**
+ * Whether to fail the build if a dependency warning is found.
+ *
+ * @parameter expression="${mdep.analyze.failOnWarning}" default-value="false"
+ */
+ private boolean failOnWarning;
+
+ /**
+ * Output used dependencies
+ *
+ * @parameter expression="${mdep.analyze.verbose}" default-value="false"
+ */
+ private boolean verbose;
+
+ /**
+ * Ignore Runtime,Provide,Test,System scopes for unused dependency analysis
+ *
+ * @parameter expression="${mdep.analyze.ignore.noncompile}" default-value="false"
+ */
+ private boolean ignoreNonCompile;
+
+ /**
+ * Output the xml for the missing dependencies
+ *
+ * @parameter expression="${mdep.analyze.outputXML}" default-value="false"
+ * @since 2.0-alpha-5
+ */
+ private boolean outputXML;
+
+ /**
+ * Output scriptable values
+ *
+ * @parameter expression="${mdep.analyze.scriptable}" default-value="false"
+ * @since 2.0-alpha-5
+ */
+ private boolean scriptableOutput;
+
+ /**
+ * Flag to use for scriptable output
+ *
+ * @parameter expression="${mdep.analyze.flag}" default-value="$$$%%%"
+ * @since 2.0-alpha-5
+ */
+ private String scriptableFlag;
+
+ /**
+ * Flag to use for scriptable output
+ *
+ * @parameter expression="${basedir}"
+ * @readonly
+ * @since 2.0-alpha-5
+ */
+ private File baseDir;
+
+ /**
+ * Target folder
+ *
+ * @parameter expression="${project.build.directory}"
+ * @readonly
+ * @since 2.0-alpha-5
+ */
+ private File outputDirectory;
+
+ // Mojo methods -----------------------------------------------------------
+
+ /*
+ * @see org.apache.maven.plugin.Mojo#execute()
+ */
+ public void execute()
+ throws MojoExecutionException, MojoFailureException
+ {
+ if ( "pom".equals( project.getPackaging() ) )
+ {
+ getLog().info( "Skipping pom project" );
+ return;
+ }
+
+ if ( outputDirectory == null || !outputDirectory.exists())
+ {
+ getLog().info( "Skipping project with no build directory" );
+ return;
+ }
+
+ boolean warning = checkDependencies();
+
+ if ( warning && failOnWarning )
+ {
+ throw new MojoExecutionException( "Dependency problems found" );
+ }
+ }
+
+ // private methods --------------------------------------------------------
+
+ private boolean checkDependencies()
+ throws MojoExecutionException
+ {
+ ProjectDependencyAnalysis analysis;
+ try
+ {
+ analysis = analyzer.analyze( project );
+ }
+ catch ( ProjectDependencyAnalyzerException exception )
+ {
+ throw new MojoExecutionException( "Cannot analyze dependencies", exception );
+ }
+
+ Set usedDeclared = analysis.getUsedDeclaredArtifacts();
+ Set usedUndeclared = analysis.getUsedUndeclaredArtifacts();
+ Set unusedDeclared = analysis.getUnusedDeclaredArtifacts();
+
+ if ( ignoreNonCompile )
+ {
+ Set filteredUnusedDeclared = new HashSet( unusedDeclared );
+ Iterator iter = filteredUnusedDeclared.iterator();
+ while ( iter.hasNext() )
+ {
+ Artifact artifact = (Artifact) iter.next();
+ if ( !artifact.getScope().equals( Artifact.SCOPE_COMPILE ) )
+ {
+ iter.remove();
+ }
+ }
+ unusedDeclared = filteredUnusedDeclared;
+ }
+
+ if ( ( !verbose || usedDeclared.isEmpty() ) && usedUndeclared.isEmpty() && unusedDeclared.isEmpty() )
+ {
+ getLog().info( "No dependency problems found" );
+ return false;
+ }
+
+ if ( verbose && !usedDeclared.isEmpty() )
+ {
+ getLog().info( "Used declared dependencies found:" );
+
+ logArtifacts( analysis.getUsedDeclaredArtifacts(), false );
+ }
+
+ if ( !usedUndeclared.isEmpty() )
+ {
+ getLog().warn( "Used undeclared dependencies found:" );
+
+ logArtifacts( usedUndeclared, true );
+ }
+
+ if ( !unusedDeclared.isEmpty() )
+ {
+ getLog().warn( "Unused declared dependencies found:" );
+
+ logArtifacts( unusedDeclared, true );
+ }
+
+ if ( outputXML )
+ {
+ writeDependencyXML( usedUndeclared );
+ }
+
+ if ( scriptableOutput )
+ {
+ writeScriptableOutput( usedUndeclared );
+ }
+
+ return !usedUndeclared.isEmpty() || !unusedDeclared.isEmpty();
+ }
+
+ private void logArtifacts( Set artifacts, boolean warn )
+ {
+ if ( artifacts.isEmpty() )
+ {
+ getLog().info( " None" );
+ }
+ else
+ {
+ for ( Iterator iterator = artifacts.iterator(); iterator.hasNext(); )
+ {
+ Artifact artifact = (Artifact) iterator.next();
+
+ // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
+ artifact.isSnapshot();
+
+ if ( warn )
+ {
+ getLog().warn( " " + artifact );
+ }
+ else
+ {
+ getLog().info( " " + artifact );
+ }
+
+ }
+ }
+ }
+
+ private void writeDependencyXML( Set artifacts )
+ {
+ if ( !artifacts.isEmpty() )
+ {
+ getLog().info( "Add the following to your pom to correct the missing dependencies: " );
+
+ StringWriter out = new StringWriter();
+ PrettyPrintXMLWriter writer = new PrettyPrintXMLWriter( out );
+
+ Iterator iter = artifacts.iterator();
+ while ( iter.hasNext() )
+ {
+ Artifact artifact = (Artifact) iter.next();
+
+ // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
+ artifact.isSnapshot();
+
+ writer.startElement( "dependency" );
+ writer.startElement( "groupId" );
+ writer.writeText( artifact.getGroupId() );
+ writer.endElement();
+ writer.startElement( "artifactId" );
+ writer.writeText( artifact.getArtifactId() );
+ writer.endElement();
+ writer.startElement( "version" );
+ writer.writeText( artifact.getBaseVersion() );
+ writer.endElement();
+
+ if ( !Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) )
+ {
+ writer.startElement( "scope" );
+ writer.writeText( artifact.getScope() );
+ writer.endElement();
+ }
+ writer.endElement();
+ }
+
+ getLog().info( "\n" + out.getBuffer() );
+ }
+ }
+
+ public void writeScriptableOutput( Set artifacts )
+ {
+ if ( !artifacts.isEmpty() )
+ {
+ getLog().info( "Missing dependencies: " );
+ String pomFile = baseDir.getAbsolutePath() + File.separatorChar + "pom.xml";
+ StringBuffer buf = new StringBuffer();
+ Iterator iter = artifacts.iterator();
+ while ( iter.hasNext() )
+ {
+ Artifact artifact = (Artifact) iter.next();
+
+ // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
+ artifact.isSnapshot();
+
+ buf.append( scriptableFlag + ":" + pomFile + ":" + artifact.getDependencyConflictId() + ":"
+ + artifact.getClassifier() + ":" + artifact.getBaseVersion() + ":"
+ + artifact.getScope() + "\n" );
+ }
+ getLog().info( "\n" + buf );
+ }
+ }
+}
diff --git a/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeAttachedMojo.java b/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeAttachedMojo.java
new file mode 100644
index 0000000000..6d05e1f8af
--- /dev/null
+++ b/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeAttachedMojo.java
@@ -0,0 +1,41 @@
+package org.apache.maven.plugin.dependency;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused
+ * and declared. This goal is intended to be used in the build lifecycle, thus it assumes that the
+ * <code>test-compile</code> phase has been executed - use the <code>dependency:analyze</code> goal instead when
+ * running standalone.
+ *
+ * @author <a href="mailto:[email protected]">Mark Hobson</a>
+ * @version $Id$
+ * @since 2.0-alpha-5
+ * @see AnalyzeMojo
+ *
+ * @goal analyze-attached
+ * @requiresDependencyResolution test
+ * @phase verify
+ */
+public class AnalyzeAttachedMojo
+ extends AbstractAnalyzeMojo
+{
+ // subclassed to provide plexus annotations
+}
diff --git a/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java b/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
index 5317fccf2e..a7f434b5f7 100644
--- a/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
+++ b/maven-dependency-plugin/src/main/java/org/apache/maven/plugin/dependency/AnalyzeMojo.java
@@ -19,310 +19,22 @@
* under the License.
*/
-import java.io.File;
-import java.io.StringWriter;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.maven.artifact.Artifact;
-import org.apache.maven.plugin.AbstractMojo;
-import org.apache.maven.plugin.MojoExecutionException;
-import org.apache.maven.plugin.MojoFailureException;
-import org.apache.maven.project.MavenProject;
-import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis;
-import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzer;
-import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalyzerException;
-import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter;
-
/**
- * This goal analyzes your project's dependencies and lists dependencies that should be declared, but are not, and
- * dependencies that are declared but unused. It also executes the analyze-dep-mgt goal.
+ * Analyzes the dependencies of this project and determines which are: used and declared; used and undeclared; unused
+ * and declared. This goal is intended to be used standalone, thus it always executes the <code>test-compile</code>
+ * phase - use the <code>dependency:analyze-attached</code> goal instead when participating in the build lifecycle.
*
* @author <a href="mailto:[email protected]">Mark Hobson</a>
* @version $Id$
+ * @since 2.0-alpha-3
+ * @see AnalyzeAttachedMojo
+ *
* @goal analyze
* @requiresDependencyResolution test
- * @phase verify
- * @since 2.0-alpha-3
+ * @execute phase="test-compile"
*/
public class AnalyzeMojo
- extends AbstractMojo
+ extends AbstractAnalyzeMojo
{
- // fields -----------------------------------------------------------------
-
- /**
- * The Maven project to analyze.
- *
- * @parameter expression="${project}"
- * @required
- * @readonly
- */
- private MavenProject project;
-
- /**
- * The Maven project dependency analyzer to use.
- *
- * @component
- * @required
- * @readonly
- */
- private ProjectDependencyAnalyzer analyzer;
-
- /**
- * Whether to fail the build if a dependency warning is found.
- *
- * @parameter expression="${mdep.analyze.failOnWarning}" default-value="false"
- */
- private boolean failOnWarning;
-
- /**
- * Output used dependencies
- *
- * @parameter expression="${mdep.analyze.verbose}" default-value="false"
- */
- private boolean verbose;
-
- /**
- * Ignore Runtime,Provide,Test,System scopes for unused dependency analysis
- *
- * @parameter expression="${mdep.analyze.ignore.noncompile}" default-value="false"
- */
- private boolean ignoreNonCompile;
-
- /**
- * Output the xml for the missing dependencies
- *
- * @parameter expression="${mdep.analyze.outputXML}" default-value="false"
- * @since 2.0-alpha-5
- */
- private boolean outputXML;
-
- /**
- * Output scriptable values
- *
- * @parameter expression="${mdep.analyze.scriptable}" default-value="false"
- * @since 2.0-alpha-5
- */
- private boolean scriptableOutput;
-
- /**
- * Flag to use for scriptable output
- *
- * @parameter expression="${mdep.analyze.flag}" default-value="$$$%%%"
- * @since 2.0-alpha-5
- */
- private String scriptableFlag;
-
- /**
- * Flag to use for scriptable output
- *
- * @parameter expression="${basedir}"
- * @readonly
- * @since 2.0-alpha-5
- */
- private File baseDir;
-
- /**
- * Target folder
- *
- * @parameter expression="${project.build.directory}"
- * @readonly
- * @since 2.0-alpha-5
- */
- private File outputDirectory;
-
- // Mojo methods -----------------------------------------------------------
-
- /*
- * @see org.apache.maven.plugin.Mojo#execute()
- */
- public void execute()
- throws MojoExecutionException, MojoFailureException
- {
- if ( "pom".equals( project.getPackaging() ) )
- {
- getLog().info( "Skipping pom project" );
- return;
- }
-
- if ( outputDirectory == null || !outputDirectory.exists())
- {
- getLog().info( "Skipping project with no build directory" );
- return;
- }
-
- boolean warning = checkDependencies();
-
- if ( warning && failOnWarning )
- {
- throw new MojoExecutionException( "Dependency problems found" );
- }
- }
-
- // private methods --------------------------------------------------------
-
- private boolean checkDependencies()
- throws MojoExecutionException
- {
- ProjectDependencyAnalysis analysis;
- try
- {
- analysis = analyzer.analyze( project );
- }
- catch ( ProjectDependencyAnalyzerException exception )
- {
- throw new MojoExecutionException( "Cannot analyze dependencies", exception );
- }
-
- Set usedDeclared = analysis.getUsedDeclaredArtifacts();
- Set usedUndeclared = analysis.getUsedUndeclaredArtifacts();
- Set unusedDeclared = analysis.getUnusedDeclaredArtifacts();
-
- if ( ignoreNonCompile )
- {
- Set filteredUnusedDeclared = new HashSet( unusedDeclared );
- Iterator iter = filteredUnusedDeclared.iterator();
- while ( iter.hasNext() )
- {
- Artifact artifact = (Artifact) iter.next();
- if ( !artifact.getScope().equals( Artifact.SCOPE_COMPILE ) )
- {
- iter.remove();
- }
- }
- unusedDeclared = filteredUnusedDeclared;
- }
-
- if ( ( !verbose || usedDeclared.isEmpty() ) && usedUndeclared.isEmpty() && unusedDeclared.isEmpty() )
- {
- getLog().info( "No dependency problems found" );
- return false;
- }
-
- if ( verbose && !usedDeclared.isEmpty() )
- {
- getLog().info( "Used declared dependencies found:" );
-
- logArtifacts( analysis.getUsedDeclaredArtifacts(), false );
- }
-
- if ( !usedUndeclared.isEmpty() )
- {
- getLog().warn( "Used undeclared dependencies found:" );
-
- logArtifacts( usedUndeclared, true );
- }
-
- if ( !unusedDeclared.isEmpty() )
- {
- getLog().warn( "Unused declared dependencies found:" );
-
- logArtifacts( unusedDeclared, true );
- }
-
- if ( outputXML )
- {
- writeDependencyXML( usedUndeclared );
- }
-
- if ( scriptableOutput )
- {
- writeScriptableOutput( usedUndeclared );
- }
-
- return !usedUndeclared.isEmpty() || !unusedDeclared.isEmpty();
- }
-
- private void logArtifacts( Set artifacts, boolean warn )
- {
- if ( artifacts.isEmpty() )
- {
- getLog().info( " None" );
- }
- else
- {
- for ( Iterator iterator = artifacts.iterator(); iterator.hasNext(); )
- {
- Artifact artifact = (Artifact) iterator.next();
-
- // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
- artifact.isSnapshot();
-
- if ( warn )
- {
- getLog().warn( " " + artifact );
- }
- else
- {
- getLog().info( " " + artifact );
- }
-
- }
- }
- }
-
- private void writeDependencyXML( Set artifacts )
- {
- if ( !artifacts.isEmpty() )
- {
- getLog().info( "Add the following to your pom to correct the missing dependencies: " );
-
- StringWriter out = new StringWriter();
- PrettyPrintXMLWriter writer = new PrettyPrintXMLWriter( out );
-
- Iterator iter = artifacts.iterator();
- while ( iter.hasNext() )
- {
- Artifact artifact = (Artifact) iter.next();
-
- // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
- artifact.isSnapshot();
-
- writer.startElement( "dependency" );
- writer.startElement( "groupId" );
- writer.writeText( artifact.getGroupId() );
- writer.endElement();
- writer.startElement( "artifactId" );
- writer.writeText( artifact.getArtifactId() );
- writer.endElement();
- writer.startElement( "version" );
- writer.writeText( artifact.getBaseVersion() );
- writer.endElement();
-
- if ( !Artifact.SCOPE_COMPILE.equals( artifact.getScope() ) )
- {
- writer.startElement( "scope" );
- writer.writeText( artifact.getScope() );
- writer.endElement();
- }
- writer.endElement();
- }
-
- getLog().info( "\n" + out.getBuffer() );
- }
- }
-
- public void writeScriptableOutput( Set artifacts )
- {
- if ( !artifacts.isEmpty() )
- {
- getLog().info( "Missing dependencies: " );
- String pomFile = baseDir.getAbsolutePath() + File.separatorChar + "pom.xml";
- StringBuffer buf = new StringBuffer();
- Iterator iter = artifacts.iterator();
- while ( iter.hasNext() )
- {
- Artifact artifact = (Artifact) iter.next();
-
- // called because artifact will set the version to -SNAPSHOT only if I do this. MNG-2961
- artifact.isSnapshot();
-
- buf.append( scriptableFlag + ":" + pomFile + ":" + artifact.getDependencyConflictId() + ":"
- + artifact.getClassifier() + ":" + artifact.getBaseVersion() + ":"
- + artifact.getScope() + "\n" );
- }
- getLog().info( "\n" + buf );
- }
- }
+ // subclassed to provide plexus annotations
}
|
4045ba965b142af50ddd1eeab245686b416c9672
|
Valadoc
|
libvaladoc: accept @return in constructors
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/src/libvaladoc/taglets/tagletreturn.vala b/src/libvaladoc/taglets/tagletreturn.vala
index 163f0ba53e..655fb7ace9 100644
--- a/src/libvaladoc/taglets/tagletreturn.vala
+++ b/src/libvaladoc/taglets/tagletreturn.vala
@@ -32,7 +32,10 @@ public class Valadoc.Taglets.Return : InlineContent, Taglet, Block {
public override void check (Api.Tree api_root, Api.Node container, string file_path, ErrorReporter reporter, Settings settings) {
Api.TypeReference? type_ref = null;
+ bool creation_method = false;
+
if (container is Api.Method) {
+ creation_method = ((Api.Method) container).is_constructor;
type_ref = ((Api.Method) container).return_type;
} else if (container is Api.Delegate) {
type_ref = ((Api.Delegate) container).return_type;
@@ -42,7 +45,7 @@ public class Valadoc.Taglets.Return : InlineContent, Taglet, Block {
reporter.simple_warning ("%s: %s: @return: warning: @return used outside method/delegate/signal context", file_path, container.get_full_name ());
}
- if (type_ref != null && type_ref.data_type == null) {
+ if (type_ref != null && type_ref.data_type == null && !creation_method) {
reporter.simple_warning ("%s: %s: @return: warning: Return description declared for void function", file_path, container.get_full_name ());
}
|
e6e5df7a7bd5539cc97af06dfd1c104b4febf3fa
|
heroku$heroku.jar
|
* Refactored apache client out of com.heroku.api.command. Apache client is used primarily in BasicAuthConnectionProvider and BasicAuthConnection as a transport mechanism. Connections are the primary abstraction that contain a transport. If need be, the transport can be decoupledif we need the flexibility. For now, we only have one implementation of a connection and don't need the decoupling.
* Reorganized code into more appropriate packages.
* Using com.heroku.api.http http related information (e.g. headers). This is not intended for transport -- use connection, or some other package, for transports.
* Using com.heroku.api.exception for any custom exceptions.
* Using com.heroku.api.util for utilities
* Made CommandConfig immutable
* Added a static method in HttpUtil for encoding name=value parameters in HTTP requests. It's currently used in Command implementations.
* Added HttpHeader, which should be used by Command implementations for providing header information.
|
p
|
https://github.com/heroku/heroku.jar
|
diff --git a/pom.xml b/pom.xml
index e0750d0..e462b49 100644
--- a/pom.xml
+++ b/pom.xml
@@ -40,6 +40,7 @@
<scope>test</scope>
</dependency>
<dependency>
+ <!-- ssh key generator -->
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.45</version>
diff --git a/src/main/java/com/heroku/api/HerokuApiVersion.java b/src/main/java/com/heroku/api/HerokuApiVersion.java
index a879944..77ab9f5 100644
--- a/src/main/java/com/heroku/api/HerokuApiVersion.java
+++ b/src/main/java/com/heroku/api/HerokuApiVersion.java
@@ -9,14 +9,14 @@
* @author Naaman Newbold
*/
public enum HerokuApiVersion {
- v3 (3),
- v2 (2);
+ v2 (2),
+ v3 (3);
+
+ public static final String HEADER = "X-Heroku-API-Version";
public final int version;
- public final Header versionHeader;
HerokuApiVersion(int version) {
this.version = version;
- this.versionHeader = new BasicHeader("X-Heroku-API-Version", String.valueOf(version));
}
}
diff --git a/src/main/java/com/heroku/api/command/HerokuRequestKey.java b/src/main/java/com/heroku/api/HerokuRequestKey.java
similarity index 94%
rename from src/main/java/com/heroku/api/command/HerokuRequestKey.java
rename to src/main/java/com/heroku/api/HerokuRequestKey.java
index 2a40e3a..a55646f 100644
--- a/src/main/java/com/heroku/api/command/HerokuRequestKey.java
+++ b/src/main/java/com/heroku/api/HerokuRequestKey.java
@@ -1,4 +1,4 @@
-package com.heroku.api.command;
+package com.heroku.api;
/**
* TODO: Javadoc
diff --git a/src/main/java/com/heroku/api/command/AppCommand.java b/src/main/java/com/heroku/api/command/AppCommand.java
new file mode 100644
index 0000000..f486adc
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/AppCommand.java
@@ -0,0 +1,62 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.http.HttpStatus;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public class AppCommand implements Command {
+
+ private final CommandConfig config;
+
+ public AppCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.GET;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return String.format(HerokuResource.App.value, config.get(HerokuRequestKey.name));
+ }
+
+ @Override
+ public boolean hasBody() {
+ return false;
+ }
+
+ @Override
+ public String getBody() {
+ throw new UnsupportedOperationException("This command does not have a body. Use hasBody() to check for a body.");
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.XML;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>();
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new XmlMapResponse(bytes, success);
+ }
+}
diff --git a/src/main/java/com/heroku/api/command/AppCreateCommand.java b/src/main/java/com/heroku/api/command/AppCreateCommand.java
new file mode 100644
index 0000000..fa35ff0
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/AppCreateCommand.java
@@ -0,0 +1,77 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.exception.HerokuAPIException;
+import com.heroku.api.http.HttpHeader;
+import com.heroku.api.http.HttpStatus;
+import com.heroku.api.util.HttpUtil;
+
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public class AppCreateCommand implements Command {
+
+ private final CommandConfig config;
+
+ public AppCreateCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return HerokuResource.Apps.value;
+ }
+
+ @Override
+ public boolean hasBody() {
+ return true;
+ }
+
+ @Override
+ public String getBody() {
+ try {
+ return HttpUtil.encodeParameters(config,
+ HerokuRequestKey.stack,
+ HerokuRequestKey.remote,
+ HerokuRequestKey.timeout,
+ HerokuRequestKey.addons
+ );
+ } catch (UnsupportedEncodingException e) {
+ throw new HerokuAPIException("Unable to encode parameters.", e);
+ }
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.JSON;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>() {{
+ put(HttpHeader.ContentType.HEADER, HttpHeader.ContentType.FORM_URLENCODED);
+ }};
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.ACCEPTED.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new JsonMapResponse(bytes, success);
+ }
+}
diff --git a/src/main/java/com/heroku/api/command/AppDestroyCommand.java b/src/main/java/com/heroku/api/command/AppDestroyCommand.java
new file mode 100644
index 0000000..aff18f5
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/AppDestroyCommand.java
@@ -0,0 +1,62 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.http.HttpStatus;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public class AppDestroyCommand implements Command {
+
+ private final CommandConfig config;
+
+ public AppDestroyCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.DELETE;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return String.format(HerokuResource.App.value, config.get(HerokuRequestKey.name));
+ }
+
+ @Override
+ public boolean hasBody() {
+ return false;
+ }
+
+ @Override
+ public String getBody() {
+ throw new UnsupportedOperationException("This command does not have a body. Use hasBody() to check for a body.");
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.JSON;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>();
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new EmptyResponse(success);
+ }
+}
diff --git a/src/main/java/com/heroku/api/command/AppsCommand.java b/src/main/java/com/heroku/api/command/AppsCommand.java
new file mode 100644
index 0000000..acb7155
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/AppsCommand.java
@@ -0,0 +1,61 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuResource;
+import com.heroku.api.http.HttpStatus;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public class AppsCommand implements Command {
+
+ private final CommandConfig config;
+
+ public AppsCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.GET;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return HerokuResource.Apps.value;
+ }
+
+ @Override
+ public boolean hasBody() {
+ return false;
+ }
+
+ @Override
+ public String getBody() {
+ throw new UnsupportedOperationException("This command does not have a body. Use hasBody() to check for a body.");
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.JSON;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>();
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new JsonArrayResponse(bytes, success);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/Command.java b/src/main/java/com/heroku/api/command/Command.java
new file mode 100644
index 0000000..833c60d
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/Command.java
@@ -0,0 +1,39 @@
+package com.heroku.api.command;
+
+import java.util.Map;
+
+/**
+ * TODO: Enter JavaDoc
+ *
+ * @author Naaman Newbold
+ */
+public interface Command {
+ public enum HttpMethod {
+ GET,
+ PUT,
+ POST,
+ DELETE
+ }
+
+ public enum ResponseType {
+ XML,
+ JSON
+ }
+
+ HttpMethod getHttpMethod();
+
+ String getEndpoint();
+
+ boolean hasBody();
+
+ String getBody();
+
+ ResponseType getResponseType();
+
+ Map<String, String> getHeaders();
+
+ int getSuccessCode();
+
+ CommandResponse getResponse(byte[] bytes, boolean success);
+
+}
diff --git a/src/main/java/com/heroku/api/command/CommandConfig.java b/src/main/java/com/heroku/api/command/CommandConfig.java
new file mode 100644
index 0000000..bef0e80
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/CommandConfig.java
@@ -0,0 +1,36 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuStack;
+
+import java.util.EnumMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public class CommandConfig {
+ private final Map<HerokuRequestKey, String> config = new EnumMap<HerokuRequestKey, String>(HerokuRequestKey.class);
+
+ public CommandConfig onStack(HerokuStack stack) {
+ return with(HerokuRequestKey.stack, stack.value);
+ }
+
+ public CommandConfig app(String appName) {
+ return with(HerokuRequestKey.name, appName);
+ }
+
+ public CommandConfig with(HerokuRequestKey key, String value) {
+ CommandConfig newConfig = new CommandConfig();
+ newConfig.config.putAll(config);
+ newConfig.config.put(key, value);
+ return newConfig;
+ }
+
+ public String get(HerokuRequestKey key) {
+ return config.get(key);
+ }
+
+}
diff --git a/src/main/java/com/heroku/api/command/HerokuCommandResponse.java b/src/main/java/com/heroku/api/command/CommandResponse.java
similarity index 70%
rename from src/main/java/com/heroku/api/command/HerokuCommandResponse.java
rename to src/main/java/com/heroku/api/command/CommandResponse.java
index 3577bba..1b5bc46 100644
--- a/src/main/java/com/heroku/api/command/HerokuCommandResponse.java
+++ b/src/main/java/com/heroku/api/command/CommandResponse.java
@@ -5,7 +5,8 @@
*
* @author Naaman Newbold
*/
-public interface HerokuCommandResponse {
+public interface CommandResponse {
boolean isSuccess();
Object get(String key);
+ byte[] getRawData();
}
diff --git a/src/main/java/com/heroku/api/command/ConfigAddCommand.java b/src/main/java/com/heroku/api/command/ConfigAddCommand.java
new file mode 100644
index 0000000..938f4c3
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/ConfigAddCommand.java
@@ -0,0 +1,67 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.http.HttpStatus;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author James Ward
+ */
+public class ConfigAddCommand implements Command {
+
+ // put("/apps/#{app_name}/config_vars", json_encode(new_vars)).to_s
+
+ private final CommandConfig config;
+
+ public ConfigAddCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.PUT;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return String.format(
+ HerokuResource.ConfigVars.value,
+ config.get(HerokuRequestKey.name)
+ );
+ }
+
+ @Override
+ public boolean hasBody() {
+ return true;
+ }
+
+ @Override
+ public String getBody() {
+ return config.get(HerokuRequestKey.configvars);
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.XML;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>();
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new EmptyResponse(success);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/EmptyResponse.java b/src/main/java/com/heroku/api/command/EmptyResponse.java
new file mode 100644
index 0000000..70e11f1
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/EmptyResponse.java
@@ -0,0 +1,29 @@
+package com.heroku.api.command;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public class EmptyResponse implements CommandResponse {
+ private final boolean success;
+
+ public EmptyResponse(boolean success) {
+ this.success = success;
+ }
+
+ @Override
+ public boolean isSuccess() {
+ return success;
+ }
+
+ @Override
+ public String get(String key) {
+ return null;
+ }
+
+ @Override
+ public byte[] getRawData() {
+ return new byte[0]; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
diff --git a/src/main/java/com/heroku/api/command/HerokuAppCommand.java b/src/main/java/com/heroku/api/command/HerokuAppCommand.java
deleted file mode 100644
index 1717310..0000000
--- a/src/main/java/com/heroku/api/command/HerokuAppCommand.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.util.EntityUtils;
-
-import java.io.IOException;
-
-/**
- * TODO: Javadoc
- *
- * @author Naaman Newbold
- */
-public class HerokuAppCommand implements HerokuCommand {
-
- private final HerokuCommandConfig config;
-
- public HerokuAppCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws IOException {
- HttpClient client = connection.getHttpClient();
-
- String endpoint = connection.getEndpoint().toString()
- + String.format(HerokuResource.App.value, config.get(HerokuRequestKey.name));
-
- HttpGet get = connection.getHttpMethod(new HttpGet(endpoint));
- get.addHeader(HerokuResponseFormat.XML.acceptHeader);
-
- HttpResponse response = client.execute(get);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandXmlMapResponse(EntityUtils.toByteArray(response.getEntity()), success);
- }
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuAppCreateCommand.java b/src/main/java/com/heroku/api/command/HerokuAppCreateCommand.java
deleted file mode 100644
index a3ff3e1..0000000
--- a/src/main/java/com/heroku/api/command/HerokuAppCreateCommand.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.BasicHttpEntity;
-import org.apache.http.message.BasicNameValuePair;
-import org.apache.http.util.EntityUtils;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * TODO: Javadoc
- *
- * @author Naaman Newbold
- */
-public class HerokuAppCreateCommand implements HerokuCommand {
-
- private final String RESOURCE_URL = HerokuResource.Apps.value;
- private final HerokuCommandConfig config;
-
- public HerokuAppCreateCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws IOException {
- HttpClient client = connection.getHttpClient();
- String endpoint = connection.getEndpoint().toString() + RESOURCE_URL;
-
- HttpPost method = connection.getHttpMethod(new HttpPost(endpoint));
- method.addHeader(HerokuResponseFormat.JSON.acceptHeader);
-
- method.setEntity(new UrlEncodedFormEntity(Arrays.asList(
- getParam(HerokuRequestKey.stack),
- getParam(HerokuRequestKey.remote),
- getParam(HerokuRequestKey.timeout),
- getParam(HerokuRequestKey.addons)
- )));
- HttpResponse response = client.execute(method);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_ACCEPTED);
-
- return new HerokuCommandJsonMapResponse(EntityUtils.toByteArray(response.getEntity()), success);
- }
-
- private BasicNameValuePair getParam(HerokuRequestKey param) {
- return new BasicNameValuePair(param.queryParameter, config.get(param));
- }
-
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuAppDestroyCommand.java b/src/main/java/com/heroku/api/command/HerokuAppDestroyCommand.java
deleted file mode 100644
index c3009b2..0000000
--- a/src/main/java/com/heroku/api/command/HerokuAppDestroyCommand.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpDelete;
-
-import java.io.IOException;
-
-/**
- * TODO: Javadoc
- *
- * @author Naaman Newbold
- */
-public class HerokuAppDestroyCommand implements HerokuCommand {
-
- private final HerokuCommandConfig config;
-
- public HerokuAppDestroyCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws IOException {
- HttpClient client = connection.getHttpClient();
-
- String endpoint = connection.getEndpoint().toString()
- + String.format(HerokuResource.App.value, config.get(HerokuRequestKey.name));
-
- HttpDelete method = connection.getHttpMethod(new HttpDelete(endpoint));
- method.addHeader(HerokuResponseFormat.JSON.acceptHeader);
-
- HttpResponse response = client.execute(method);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandEmptyResponse(success);
- }
-
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuAppsCommand.java b/src/main/java/com/heroku/api/command/HerokuAppsCommand.java
deleted file mode 100644
index 47c461d..0000000
--- a/src/main/java/com/heroku/api/command/HerokuAppsCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.util.EntityUtils;
-
-import java.io.IOException;
-
-/**
- * TODO: Javadoc
- *
- * @author Naaman Newbold
- */
-public class HerokuAppsCommand implements HerokuCommand {
-
- private final String RESOURCE_URL = HerokuResource.Apps.value;
- private final HerokuCommandConfig config;
-
- public HerokuAppsCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws IOException {
- String endpoint = connection.getEndpoint().toString() + RESOURCE_URL;
-
- HttpClient client = connection.getHttpClient();
- HttpGet getMethod = connection.getHttpMethod(new HttpGet(endpoint));
- getMethod.addHeader(HerokuResponseFormat.JSON.acceptHeader);
- HttpResponse response = client.execute(getMethod);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandJsonListMapResponse(EntityUtils.toByteArray(response.getEntity()), success);
- }
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuCommand.java b/src/main/java/com/heroku/api/command/HerokuCommand.java
deleted file mode 100644
index 077bc0a..0000000
--- a/src/main/java/com/heroku/api/command/HerokuCommand.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.connection.HerokuAPIException;
-import com.heroku.api.connection.HerokuConnection;
-
-import java.io.IOException;
-
-/**
- * TODO: Enter JavaDoc
- *
- * @author Naaman Newbold
- */
-public interface HerokuCommand {
- HerokuCommandResponse execute(HerokuConnection connection) throws IOException;
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuCommandConfig.java b/src/main/java/com/heroku/api/command/HerokuCommandConfig.java
deleted file mode 100644
index 698aa22..0000000
--- a/src/main/java/com/heroku/api/command/HerokuCommandConfig.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuStack;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * TODO: Javadoc
- *
- * @author Naaman Newbold
- */
-public class HerokuCommandConfig {
- private final Map<HerokuRequestKey, String> config = new HashMap<HerokuRequestKey, String>();
-
- public HerokuCommandConfig onStack(HerokuStack stack) {
- set(HerokuRequestKey.stack, stack.value);
- return this;
- }
-
- public HerokuCommandConfig app(String appName) {
- set(HerokuRequestKey.name, appName);
- return this;
- }
-
- public HerokuCommandConfig set(HerokuRequestKey key, String value) {
- config.put(key, value);
- return this;
- }
-
- public String get(HerokuRequestKey key) {
- return config.get(key);
- }
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuCommandEmptyResponse.java b/src/main/java/com/heroku/api/command/HerokuCommandEmptyResponse.java
deleted file mode 100644
index 12146b2..0000000
--- a/src/main/java/com/heroku/api/command/HerokuCommandEmptyResponse.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.heroku.api.command;
-
-/**
- * TODO: Javadoc
- *
- * @author Naaman Newbold
- */
-public class HerokuCommandEmptyResponse implements HerokuCommandResponse {
- private final boolean success;
-
- public HerokuCommandEmptyResponse(boolean success) {
- this.success = success;
- }
-
- @Override
- public boolean isSuccess() {
- return success;
- }
-
- @Override
- public Object get(String key) {
- return null;
- }
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuCommandStringResponse.java b/src/main/java/com/heroku/api/command/HerokuCommandStringResponse.java
deleted file mode 100644
index eb55c11..0000000
--- a/src/main/java/com/heroku/api/command/HerokuCommandStringResponse.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.heroku.api.command;
-
-/**
- * TODO: Javadoc
- *
- * @author James Ward
- */
-public class HerokuCommandStringResponse implements HerokuCommandResponse {
-
- private final String data;
-
- private final boolean success;
-
- public HerokuCommandStringResponse(String data, boolean success) {
- this.data = data;
- this.success = success;
- }
-
- @Override
- public boolean isSuccess() {
- return success;
- }
-
- @Override
- public Object get(String key) {
- return data;
- }
-
- @Override
- public String toString() {
- return data;
- }
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuConfigAddCommand.java b/src/main/java/com/heroku/api/command/HerokuConfigAddCommand.java
deleted file mode 100644
index c49531a..0000000
--- a/src/main/java/com/heroku/api/command/HerokuConfigAddCommand.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuAPIException;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.entity.StringEntity;
-
-import java.io.IOException;
-
-/**
- * TODO: Javadoc
- *
- * @author James Ward
- */
-public class HerokuConfigAddCommand implements HerokuCommand {
-
- // put("/apps/#{app_name}/config_vars", json_encode(new_vars)).to_s
-
- private final HerokuCommandConfig config;
-
- public HerokuConfigAddCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws HerokuAPIException, IOException {
- HttpClient client = connection.getHttpClient();
-
- String endpoint = connection.getEndpoint().toString() + String.format(HerokuResource.ConfigVars.value,
- config.get(HerokuRequestKey.name));
-
- HttpEntity requestEntity = new StringEntity(config.get(HerokuRequestKey.configvars));
-
- HttpPut method = connection.getHttpMethod(new HttpPut(endpoint));
- method.addHeader(HerokuResponseFormat.XML.acceptHeader);
- method.setEntity(requestEntity);
-
- HttpResponse response = client.execute(method);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandEmptyResponse(success);
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/HerokuContentType.java b/src/main/java/com/heroku/api/command/HerokuContentType.java
deleted file mode 100644
index 9c30a97..0000000
--- a/src/main/java/com/heroku/api/command/HerokuContentType.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.heroku.api.command;
-
-import org.apache.http.message.BasicHeader;
-
-/**
- * TODO: Javadoc
- *
- * @author James Ward
- */
-public enum HerokuContentType {
- SSH_AUTHKEY ("text/ssh-authkey");
-
- public final BasicHeader contentType;
-
- HerokuContentType(String mimeType) {
- this.contentType = new BasicHeader("Content-Type", mimeType);
- }
-}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/HerokuKeysAddCommand.java b/src/main/java/com/heroku/api/command/HerokuKeysAddCommand.java
deleted file mode 100644
index 7e1a3f7..0000000
--- a/src/main/java/com/heroku/api/command/HerokuKeysAddCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuAPIException;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.entity.StringEntity;
-
-import java.io.IOException;
-
-/**
- * TODO: Javadoc
- *
- * @author James Ward
- */
-public class HerokuKeysAddCommand implements HerokuCommand {
-
- // post("/user/keys", key, { 'Content-Type' => 'text/ssh-authkey' }).to_s
-
- private final HerokuCommandConfig config;
-
- public HerokuKeysAddCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws HerokuAPIException, IOException {
- HttpClient client = connection.getHttpClient();
- String endpoint = connection.getEndpoint().toString() + HerokuResource.Keys.value;
- HttpPost method = connection.getHttpMethod(new HttpPost(endpoint));
- method.addHeader(HerokuResponseFormat.JSON.acceptHeader);
- method.addHeader(HerokuContentType.SSH_AUTHKEY.contentType);
- method.setEntity(new StringEntity(config.get(HerokuRequestKey.sshkey)));
-
- HttpResponse response = client.execute(method);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandEmptyResponse(success);
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/HerokuKeysRemoveCommand.java b/src/main/java/com/heroku/api/command/HerokuKeysRemoveCommand.java
deleted file mode 100644
index 8a20e08..0000000
--- a/src/main/java/com/heroku/api/command/HerokuKeysRemoveCommand.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuAPIException;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpDelete;
-
-
-import java.io.IOException;
-
-/**
- * TODO: Javadoc
- *
- * @author James Ward
- */
-public class HerokuKeysRemoveCommand implements HerokuCommand {
-
- // delete("/user/keys/#{escape(key)}").to_s
-
- private final HerokuCommandConfig config;
-
- public HerokuKeysRemoveCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws HerokuAPIException, IOException {
- HttpClient client = connection.getHttpClient();
-
- String endpoint = connection.getEndpoint().toString() + String.format(HerokuResource.Key.value, config.get(HerokuRequestKey.name));
- HttpDelete method = connection.getHttpMethod(new HttpDelete(endpoint));
- method.addHeader(HerokuResponseFormat.JSON.acceptHeader);
-
- HttpResponse response = client.execute(method);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandEmptyResponse(success);
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/HerokuResponseFormat.java b/src/main/java/com/heroku/api/command/HerokuResponseFormat.java
deleted file mode 100644
index 3dce0de..0000000
--- a/src/main/java/com/heroku/api/command/HerokuResponseFormat.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package com.heroku.api.command;
-
-import org.apache.http.Header;
-import org.apache.http.message.BasicHeader;
-
-/**
- * TODO: Javadoc
- *
- * @author Naaman Newbold
- */
-public enum HerokuResponseFormat {
- JSON ("json", "application/json"),
- XML ("xml", "text/xml");
-
- public final String value;
- public final Header acceptHeader;
-
- HerokuResponseFormat(String value, String mimeType) {
- this.value = value;
- this.acceptHeader = new BasicHeader("Accept", mimeType);
- }
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuSharingAddCommand.java b/src/main/java/com/heroku/api/command/HerokuSharingAddCommand.java
deleted file mode 100644
index 513b473..0000000
--- a/src/main/java/com/heroku/api/command/HerokuSharingAddCommand.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuAPIException;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.message.BasicNameValuePair;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-/**
- * TODO: Javadoc
- *
- * @author James Ward
- */
-public class HerokuSharingAddCommand implements HerokuCommand {
-
- // xml(post("/apps/#{app_name}/collaborators", { 'collaborator[email]' => email }).to_s)
-
- private final HerokuCommandConfig config;
-
- public HerokuSharingAddCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws HerokuAPIException, IOException {
- HttpClient client = connection.getHttpClient();
-
- String endpoint = connection.getEndpoint().toString() + String.format(HerokuResource.Collaborators.value, config.get(HerokuRequestKey.name));
- HttpPost method = connection.getHttpMethod(new HttpPost(endpoint));
- method.addHeader(HerokuResponseFormat.XML.acceptHeader);
- method.setEntity(new UrlEncodedFormEntity(Arrays.asList(
- getParam(HerokuRequestKey.collaborator)
- )));
-
- HttpResponse response = client.execute(method);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandEmptyResponse(success);
- }
-
- private BasicNameValuePair getParam(HerokuRequestKey param) {
- return new BasicNameValuePair(param.queryParameter, config.get(param));
- }
-
-}
diff --git a/src/main/java/com/heroku/api/command/HerokuSharingRemoveCommand.java b/src/main/java/com/heroku/api/command/HerokuSharingRemoveCommand.java
deleted file mode 100644
index 5855ae0..0000000
--- a/src/main/java/com/heroku/api/command/HerokuSharingRemoveCommand.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuAPIException;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.util.EntityUtils;
-
-import java.io.IOException;
-import java.net.URLEncoder;
-
-/**
- * TODO: Javadoc
- *
- * @author James Ward
- */
-public class HerokuSharingRemoveCommand implements HerokuCommand {
-
- // delete("/apps/#{app_name}/collaborators/#{escape(email)}").to_s
-
- private final HerokuCommandConfig config;
-
- public HerokuSharingRemoveCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws HerokuAPIException, IOException {
- String endpoint = connection.getEndpoint().toString() + String.format(HerokuResource.Collaborator.value,
- config.get(HerokuRequestKey.name),
- URLEncoder.encode(config.get(HerokuRequestKey.collaborator), "UTF-8"));
-
- HttpClient client = connection.getHttpClient();
- HttpDelete method = connection.getHttpMethod(new HttpDelete(endpoint));
- method.addHeader(HerokuResponseFormat.XML.acceptHeader);
-
- HttpResponse response = client.execute(method);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandEmptyResponse(success);
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/HerokuSharingTransferCommand.java b/src/main/java/com/heroku/api/command/HerokuSharingTransferCommand.java
deleted file mode 100644
index dc2a6cb..0000000
--- a/src/main/java/com/heroku/api/command/HerokuSharingTransferCommand.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.heroku.api.command;
-
-import com.heroku.api.HerokuResource;
-import com.heroku.api.connection.HerokuAPIException;
-import com.heroku.api.connection.HerokuConnection;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
-import org.apache.http.NameValuePair;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.entity.UrlEncodedFormEntity;
-import org.apache.http.client.methods.HttpPut;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.message.BasicNameValuePair;
-
-import java.io.IOException;
-import java.net.URLEncoder;
-import java.util.Arrays;
-
-/**
- * TODO: Javadoc
- *
- * @author James Ward
- */
-public class HerokuSharingTransferCommand implements HerokuCommand {
-
- // heroku.update(app, :transfer_owner => email)
- // put("/apps/#{name}", :app => attributes).to_s
- // http request body = app[transfer_owner]=jw%2Bdemo%40heroku.com
-
- private final HerokuCommandConfig config;
-
- public HerokuSharingTransferCommand(HerokuCommandConfig config) {
- this.config = config;
- }
-
- @Override
- public HerokuCommandResponse execute(HerokuConnection connection) throws HerokuAPIException, IOException {
- String endpoint = connection.getEndpoint().toString() + String.format(HerokuResource.App.value, config.get(HerokuRequestKey.name));
-
- HttpClient client = connection.getHttpClient();
- HttpPut method = connection.getHttpMethod(new HttpPut(endpoint));
- method.addHeader(HerokuResponseFormat.XML.acceptHeader);
- method.setEntity(new UrlEncodedFormEntity(Arrays.asList(
- getParam(HerokuRequestKey.transferOwner)
- )));
-
- HttpResponse response = client.execute(method);
- boolean success = (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK);
-
- return new HerokuCommandEmptyResponse(success);
- }
-
- private BasicNameValuePair getParam(HerokuRequestKey param) {
- return new BasicNameValuePair(param.queryParameter, config.get(param));
- }
-
-}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/HerokuCommandJsonListMapResponse.java b/src/main/java/com/heroku/api/command/JsonArrayResponse.java
similarity index 80%
rename from src/main/java/com/heroku/api/command/HerokuCommandJsonListMapResponse.java
rename to src/main/java/com/heroku/api/command/JsonArrayResponse.java
index a90e450..41178cc 100644
--- a/src/main/java/com/heroku/api/command/HerokuCommandJsonListMapResponse.java
+++ b/src/main/java/com/heroku/api/command/JsonArrayResponse.java
@@ -14,12 +14,14 @@
*
* @author Naaman Newbold
*/
-public class HerokuCommandJsonListMapResponse implements HerokuCommandResponse {
+public class JsonArrayResponse implements CommandResponse {
private final List<Map<String, String>> data;
private final boolean success;
+ private final byte[] rawData;
- public HerokuCommandJsonListMapResponse(byte[] data, boolean success) {
+ public JsonArrayResponse(byte[] data, boolean success) {
+ this.rawData = data;
Type listType = new TypeToken<List<HashMap<String, String>>>(){}.getType();
this.data = Collections.unmodifiableList(new Gson().<List<Map<String, String>>>fromJson(new String(data), listType));
this.success = success;
@@ -41,4 +43,9 @@ public Object get(String key) {
}
return null;
}
+
+ @Override
+ public byte[] getRawData() {
+ return rawData;
+ }
}
diff --git a/src/main/java/com/heroku/api/command/HerokuCommandJsonMapResponse.java b/src/main/java/com/heroku/api/command/JsonMapResponse.java
similarity index 74%
rename from src/main/java/com/heroku/api/command/HerokuCommandJsonMapResponse.java
rename to src/main/java/com/heroku/api/command/JsonMapResponse.java
index ab1e8c9..116c954 100644
--- a/src/main/java/com/heroku/api/command/HerokuCommandJsonMapResponse.java
+++ b/src/main/java/com/heroku/api/command/JsonMapResponse.java
@@ -4,19 +4,23 @@
import com.google.gson.reflect.TypeToken;
import java.lang.reflect.Type;
-import java.util.*;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
/**
* TODO: Javadoc
*
* @author Naaman Newbold
*/
-public class HerokuCommandJsonMapResponse implements HerokuCommandResponse {
+public class JsonMapResponse implements CommandResponse {
private final Map<String, String> data;
private final boolean success;
+ private final byte[] rawData;
- public HerokuCommandJsonMapResponse(byte[] data, boolean success) {
+ public JsonMapResponse(byte[] data, boolean success) {
+ this.rawData = data;
Type listType = new TypeToken<HashMap<String, String>>(){}.getType();
this.data = Collections.unmodifiableMap(new Gson().<Map<String, String>>fromJson(new String(data), listType));
@@ -29,13 +33,18 @@ public boolean isSuccess() {
}
@Override
- public Object get(String key) {
+ public String get(String key) {
if (!data.containsKey(key)) {
throw new IllegalArgumentException(key + " is not present.");
}
return data.get(key);
}
+ @Override
+ public byte[] getRawData() {
+ return rawData;
+ }
+
@Override
public String toString() {
String stringValue = "{ ";
diff --git a/src/main/java/com/heroku/api/command/KeysAddCommand.java b/src/main/java/com/heroku/api/command/KeysAddCommand.java
new file mode 100644
index 0000000..316cdd9
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/KeysAddCommand.java
@@ -0,0 +1,67 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.http.HttpHeader;
+import com.heroku.api.http.HttpStatus;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author James Ward
+ */
+public class KeysAddCommand implements Command {
+
+ // post("/user/keys", key, { 'Content-Type' => 'text/ssh-authkey' }).to_s
+
+ private final CommandConfig config;
+
+ public KeysAddCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return HerokuResource.Keys.value;
+ }
+
+ @Override
+ public boolean hasBody() {
+ return true;
+ }
+
+ @Override
+ public String getBody() {
+ return config.get(HerokuRequestKey.sshkey);
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.JSON;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>() {{
+ put(HttpHeader.ContentType.HEADER, HttpHeader.ContentType.SSH_AUTHKEY);
+ }};
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new EmptyResponse(success);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/KeysRemoveCommand.java b/src/main/java/com/heroku/api/command/KeysRemoveCommand.java
new file mode 100644
index 0000000..86cb0d9
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/KeysRemoveCommand.java
@@ -0,0 +1,64 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.http.HttpStatus;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author James Ward
+ */
+public class KeysRemoveCommand implements Command {
+
+ // delete("/user/keys/#{escape(key)}").to_s
+
+ private final CommandConfig config;
+
+ public KeysRemoveCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.DELETE;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return String.format(HerokuResource.Key.value, config.get(HerokuRequestKey.name));
+ }
+
+ @Override
+ public boolean hasBody() {
+ return false;
+ }
+
+ @Override
+ public String getBody() {
+ throw new UnsupportedOperationException("This command does not have a body. Use hasBody() to check for a body.");
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.JSON;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>();
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new EmptyResponse(success);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/SharingAddCommand.java b/src/main/java/com/heroku/api/command/SharingAddCommand.java
new file mode 100644
index 0000000..ea55bd6
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/SharingAddCommand.java
@@ -0,0 +1,74 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.exception.HerokuAPIException;
+import com.heroku.api.http.HttpHeader;
+import com.heroku.api.http.HttpStatus;
+import com.heroku.api.util.HttpUtil;
+
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author James Ward
+ */
+public class SharingAddCommand implements Command {
+
+ // xml(post("/apps/#{app_name}/collaborators", { 'collaborator[email]' => email }).to_s)
+
+ private final CommandConfig config;
+
+ public SharingAddCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.POST;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return String.format(HerokuResource.Collaborators.value, config.get(HerokuRequestKey.name));
+ }
+
+ @Override
+ public boolean hasBody() {
+ return true;
+ }
+
+ @Override
+ public String getBody() {
+ try {
+ return HttpUtil.encodeParameters(config, HerokuRequestKey.collaborator);
+ } catch (UnsupportedEncodingException e) {
+ throw new HerokuAPIException("Unable to encode parameters", e);
+ }
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.XML;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>(){{
+ put(HttpHeader.ContentType.HEADER, HttpHeader.ContentType.FORM_URLENCODED);
+ }};
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new EmptyResponse(success);
+ }
+}
diff --git a/src/main/java/com/heroku/api/command/SharingRemoveCommand.java b/src/main/java/com/heroku/api/command/SharingRemoveCommand.java
new file mode 100644
index 0000000..ed9b3cf
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/SharingRemoveCommand.java
@@ -0,0 +1,73 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.exception.HerokuAPIException;
+import com.heroku.api.http.HttpStatus;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author James Ward
+ */
+public class SharingRemoveCommand implements Command {
+
+ // delete("/apps/#{app_name}/collaborators/#{escape(email)}").to_s
+
+ private final CommandConfig config;
+
+ public SharingRemoveCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.DELETE;
+ }
+
+ @Override
+ public String getEndpoint() {
+ try {
+ return String.format(HerokuResource.Collaborator.value,
+ config.get(HerokuRequestKey.name),
+ URLEncoder.encode(config.get(HerokuRequestKey.collaborator), "UTF-8"));
+ } catch (UnsupportedEncodingException e) {
+ throw new HerokuAPIException("Unable to encode the endpoint.", e);
+ }
+ }
+
+ @Override
+ public boolean hasBody() {
+ return false;
+ }
+
+ @Override
+ public String getBody() {
+ throw new UnsupportedOperationException("This command does not have a body. Use hasBody() to check for a body.");
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.XML;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>();
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new EmptyResponse(success);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/SharingTransferCommand.java b/src/main/java/com/heroku/api/command/SharingTransferCommand.java
new file mode 100644
index 0000000..ca871a4
--- /dev/null
+++ b/src/main/java/com/heroku/api/command/SharingTransferCommand.java
@@ -0,0 +1,73 @@
+package com.heroku.api.command;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.HerokuResource;
+import com.heroku.api.exception.HerokuAPIException;
+import com.heroku.api.http.HttpStatus;
+import com.heroku.api.util.HttpUtil;
+
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author James Ward
+ */
+public class SharingTransferCommand implements Command {
+
+ // heroku.update(app, :transfer_owner => email)
+ // put("/apps/#{name}", :app => attributes).to_s
+ // http request body = app[transfer_owner]=jw%2Bdemo%40heroku.com
+
+ private final CommandConfig config;
+
+ public SharingTransferCommand(CommandConfig config) {
+ this.config = config;
+ }
+
+ @Override
+ public HttpMethod getHttpMethod() {
+ return HttpMethod.PUT;
+ }
+
+ @Override
+ public String getEndpoint() {
+ return String.format(HerokuResource.App.value, config.get(HerokuRequestKey.name));
+ }
+
+ @Override
+ public boolean hasBody() {
+ return true;
+ }
+
+ @Override
+ public String getBody() {
+ try {
+ return HttpUtil.encodeParameters(config, HerokuRequestKey.transferOwner);
+ } catch (UnsupportedEncodingException e) {
+ throw new HerokuAPIException("Unable to encode parameters.", e);
+ }
+ }
+
+ @Override
+ public ResponseType getResponseType() {
+ return ResponseType.XML;
+ }
+
+ @Override
+ public Map<String, String> getHeaders() {
+ return new HashMap<String, String>();
+ }
+
+ @Override
+ public int getSuccessCode() {
+ return HttpStatus.OK.statusCode;
+ }
+
+ @Override
+ public CommandResponse getResponse(byte[] bytes, boolean success) {
+ return new EmptyResponse(success);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/heroku/api/command/HerokuCommandXmlMapResponse.java b/src/main/java/com/heroku/api/command/XmlMapResponse.java
similarity index 86%
rename from src/main/java/com/heroku/api/command/HerokuCommandXmlMapResponse.java
rename to src/main/java/com/heroku/api/command/XmlMapResponse.java
index cb39739..086fec5 100644
--- a/src/main/java/com/heroku/api/command/HerokuCommandXmlMapResponse.java
+++ b/src/main/java/com/heroku/api/command/XmlMapResponse.java
@@ -1,15 +1,13 @@
package com.heroku.api.command;
-import com.heroku.api.connection.HerokuAPIException;
+import com.heroku.api.exception.HerokuAPIException;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
-import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import java.io.ByteArrayInputStream;
-import java.io.IOException;
import java.util.HashMap;
/**
@@ -17,7 +15,7 @@
*
* @author Naaman Newbold
*/
-public class HerokuCommandXmlMapResponse extends DefaultHandler implements HerokuCommandResponse {
+public class XmlMapResponse extends DefaultHandler implements CommandResponse {
private final byte[] rawData;
private final boolean success;
@@ -26,7 +24,7 @@ public class HerokuCommandXmlMapResponse extends DefaultHandler implements Herok
private String lastKey;
private StringBuffer charBuffer;
- public HerokuCommandXmlMapResponse(byte[] data, boolean success) {
+ public XmlMapResponse(byte[] data, boolean success) {
this.rawData = data;
this.success = success;
}
@@ -63,7 +61,7 @@ public boolean isSuccess() {
}
@Override
- public Object get(String key) {
+ public String get(String key) {
if (!rawDataIsProcessed) {
SAXParserFactory parserFactory = SAXParserFactory.newInstance();
try {
@@ -75,4 +73,9 @@ public Object get(String key) {
}
return data.get(key);
}
+
+ @Override
+ public byte[] getRawData() {
+ return rawData;
+ }
}
diff --git a/src/main/java/com/heroku/api/connection/BasicAuthConnection.java b/src/main/java/com/heroku/api/connection/BasicAuthConnection.java
new file mode 100644
index 0000000..10e702d
--- /dev/null
+++ b/src/main/java/com/heroku/api/connection/BasicAuthConnection.java
@@ -0,0 +1,114 @@
+package com.heroku.api.connection;
+
+import com.heroku.api.HerokuApiVersion;
+import com.heroku.api.command.Command;
+import com.heroku.api.command.CommandResponse;
+import com.heroku.api.http.HttpHeader;
+import org.apache.http.HttpResponse;
+import org.apache.http.auth.AuthScope;
+import org.apache.http.auth.UsernamePasswordCredentials;
+import org.apache.http.client.HttpClient;
+import org.apache.http.client.methods.*;
+import org.apache.http.entity.StringEntity;
+import org.apache.http.impl.client.DefaultHttpClient;
+import org.apache.http.util.EntityUtils;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Map;
+
+/**
+ * TODO: Enter JavaDoc
+ *
+ * @author Naaman Newbold
+ */
+public class BasicAuthConnection implements Connection {
+
+ private final URL endpoint;
+ private final String apiKey;
+ private final String userId;
+ private final String userEmail;
+
+ public BasicAuthConnection(URL endpoint, String apiKey, String userId, String userEmail) {
+ this.endpoint = endpoint;
+ this.apiKey = apiKey;
+ this.userId = userId;
+ this.userEmail = userEmail;
+ }
+
+ @Override
+ public CommandResponse executeCommand(Command command) throws IOException {
+ HttpRequestBase message = getHttpRequestBase(command.getHttpMethod(), endpoint + command.getEndpoint());
+ message.setHeader(HerokuApiVersion.HEADER, String.valueOf(HerokuApiVersion.v2.version));
+ message.setHeader(HttpHeader.Accept.HEADER, getAcceptHeader(command.getResponseType()));
+
+ for (Map.Entry<String, String> header : command.getHeaders().entrySet()) {
+ message.setHeader(header.getKey(), header.getValue());
+ }
+
+ if (command.hasBody()) {
+ ((HttpEntityEnclosingRequestBase)message).setEntity(
+ new StringEntity(command.getBody())
+ );
+ }
+
+ HttpClient client = getHttpClient();
+ HttpResponse httpResponse = client.execute(message);
+
+ boolean success = (httpResponse.getStatusLine().getStatusCode() == command.getSuccessCode());
+
+ return command.getResponse(EntityUtils.toByteArray(httpResponse.getEntity()), success);
+ }
+
+ private String getAcceptHeader(Command.ResponseType responseType) {
+ switch (responseType) {
+ case XML:
+ return HttpHeader.Accept.TEXT_XML;
+ case JSON:
+ return HttpHeader.Accept.APPLICATION_JSON;
+ default:
+ throw new UnsupportedOperationException(responseType + " is not a supported response type.");
+ }
+ }
+
+ private HttpRequestBase getHttpRequestBase(Command.HttpMethod httpMethod, String endpoint) {
+ switch (httpMethod) {
+ case GET:
+ return new HttpGet(endpoint);
+ case PUT:
+ return new HttpPut(endpoint);
+ case POST:
+ return new HttpPost(endpoint);
+ case DELETE:
+ return new HttpDelete(endpoint);
+ default:
+ throw new UnsupportedOperationException(httpMethod + " is not a support request type.");
+ }
+ }
+
+ @Override
+ public HttpClient getHttpClient() {
+ DefaultHttpClient client = new DefaultHttpClient();
+ client.getCredentialsProvider().setCredentials(
+ new AuthScope(endpoint.getHost(), endpoint.getPort()),
+ // the Basic Authentication scheme only expects an API key.
+ new UsernamePasswordCredentials("", apiKey)
+ );
+ return client;
+ }
+
+ @Override
+ public URL getEndpoint() {
+ return endpoint;
+ }
+
+ @Override
+ public String getEmail() {
+ return userEmail;
+ }
+
+ @Override
+ public String getApiKey() {
+ return apiKey;
+ }
+}
diff --git a/src/main/java/com/heroku/api/connection/HerokuBasicAuthConnectionProvider.java b/src/main/java/com/heroku/api/connection/BasicAuthConnectionProvider.java
similarity index 77%
rename from src/main/java/com/heroku/api/connection/HerokuBasicAuthConnectionProvider.java
rename to src/main/java/com/heroku/api/connection/BasicAuthConnectionProvider.java
index bb4fcca..ac43f23 100644
--- a/src/main/java/com/heroku/api/connection/HerokuBasicAuthConnectionProvider.java
+++ b/src/main/java/com/heroku/api/connection/BasicAuthConnectionProvider.java
@@ -3,7 +3,8 @@
import com.google.gson.Gson;
import com.heroku.api.HerokuApiVersion;
import com.heroku.api.HerokuResource;
-import com.heroku.api.command.HerokuResponseFormat;
+import com.heroku.api.exception.HerokuAPIException;
+import com.heroku.api.http.HttpHeader;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
@@ -23,16 +24,16 @@
*
* @author Naaman Newbold
*/
-public class HerokuBasicAuthConnectionProvider implements HerokuConnectionProvider {
+public class BasicAuthConnectionProvider implements ConnectionProvider {
private final URL endpoint;
private final String username;
private final String password;
- public HerokuBasicAuthConnectionProvider(String username, String password) {
- this(username, password, HerokuConnectionProvider.DEFAULT_ENDPOINT);
+ public BasicAuthConnectionProvider(String username, String password) {
+ this(username, password, ConnectionProvider.DEFAULT_ENDPOINT);
}
- public HerokuBasicAuthConnectionProvider(String username, String password, String endpoint) {
+ public BasicAuthConnectionProvider(String username, String password, String endpoint) {
super();
this.username = username;
this.password = password;
@@ -44,10 +45,10 @@ public HerokuBasicAuthConnectionProvider(String username, String password, Strin
}
@Override
- public HerokuConnection getConnection() throws IOException {
+ public Connection getConnection() throws IOException {
HttpPost loginPost = new HttpPost(endpoint.toString() + HerokuResource.Login.value);
- loginPost.addHeader(HerokuResponseFormat.JSON.acceptHeader);
- loginPost.addHeader(HerokuApiVersion.v2.versionHeader);
+ loginPost.addHeader(HttpHeader.Accept.HEADER, HttpHeader.Accept.APPLICATION_JSON);
+ loginPost.addHeader(HerokuApiVersion.HEADER, String.valueOf(HerokuApiVersion.v2.version));
loginPost.setEntity(new UrlEncodedFormEntity(Arrays.asList(
new BasicNameValuePair("username", username),
new BasicNameValuePair("password", password)
@@ -59,7 +60,7 @@ public HerokuConnection getConnection() throws IOException {
if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
String rawLoginResponse = EntityUtils.toString(response.getEntity());
LoginResponse loginResponse = new Gson().fromJson(rawLoginResponse, LoginResponse.class);
- return new HerokuBasicAuthConnection(
+ return new BasicAuthConnection(
endpoint,
loginResponse.api_key,
loginResponse.id,
diff --git a/src/main/java/com/heroku/api/connection/HerokuConnection.java b/src/main/java/com/heroku/api/connection/Connection.java
similarity index 57%
rename from src/main/java/com/heroku/api/connection/HerokuConnection.java
rename to src/main/java/com/heroku/api/connection/Connection.java
index a4d21e4..2612e4f 100644
--- a/src/main/java/com/heroku/api/connection/HerokuConnection.java
+++ b/src/main/java/com/heroku/api/connection/Connection.java
@@ -1,7 +1,7 @@
package com.heroku.api.connection;
-import com.heroku.api.command.HerokuCommand;
-import org.apache.http.HttpMessage;
+import com.heroku.api.command.Command;
+import com.heroku.api.command.CommandResponse;
import org.apache.http.client.HttpClient;
import java.io.IOException;
@@ -12,11 +12,16 @@
*
* @author Naaman Newbold
*/
-public interface HerokuConnection {
- void executeCommand(HerokuCommand command) throws IOException;
+public interface Connection {
+
+ CommandResponse executeCommand(Command command) throws IOException;
+
HttpClient getHttpClient();
- <T extends HttpMessage> T getHttpMethod(T method);
+
URL getEndpoint();
+
String getEmail();
+
String getApiKey();
+
}
diff --git a/src/main/java/com/heroku/api/connection/HerokuConnectionProvider.java b/src/main/java/com/heroku/api/connection/ConnectionProvider.java
similarity index 71%
rename from src/main/java/com/heroku/api/connection/HerokuConnectionProvider.java
rename to src/main/java/com/heroku/api/connection/ConnectionProvider.java
index fb55e82..8130547 100644
--- a/src/main/java/com/heroku/api/connection/HerokuConnectionProvider.java
+++ b/src/main/java/com/heroku/api/connection/ConnectionProvider.java
@@ -7,7 +7,7 @@
*
* @author Naaman Newbold
*/
-public interface HerokuConnectionProvider {
+public interface ConnectionProvider {
static final String DEFAULT_ENDPOINT = "https://api.heroku.com";
- HerokuConnection getConnection() throws IOException;
+ Connection getConnection() throws IOException;
}
diff --git a/src/main/java/com/heroku/api/connection/HerokuBasicAuthConnection.java b/src/main/java/com/heroku/api/connection/HerokuBasicAuthConnection.java
deleted file mode 100644
index a106bf9..0000000
--- a/src/main/java/com/heroku/api/connection/HerokuBasicAuthConnection.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package com.heroku.api.connection;
-
-import com.heroku.api.command.HerokuCommand;
-import org.apache.http.HttpMessage;
-import org.apache.http.auth.AuthScope;
-import org.apache.http.auth.UsernamePasswordCredentials;
-import org.apache.http.client.HttpClient;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.impl.client.DefaultHttpClient;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import java.io.IOException;
-import java.net.URL;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-
-/**
- * TODO: Enter JavaDoc
- *
- * @author Naaman Newbold
- */
-public class HerokuBasicAuthConnection implements HerokuConnection {
-
- private final URL endpoint;
- private final String apiKey;
- private final String userId;
- private final String userEmail;
-
- public HerokuBasicAuthConnection(URL endpoint, String apiKey, String userId, String userEmail) {
- this.endpoint = endpoint;
- this.apiKey = apiKey;
- this.userId = userId;
- this.userEmail = userEmail;
- }
-
- @Override
- public void executeCommand(HerokuCommand command) throws IOException {
- command.execute(this);
- }
-
- @Override
- public HttpClient getHttpClient() {
- DefaultHttpClient client = new DefaultHttpClient();
- client.getCredentialsProvider().setCredentials(
- new AuthScope(endpoint.getHost(), endpoint.getPort()),
- new UsernamePasswordCredentials(userEmail, apiKey)
- );
-
- try {
- SSLContext sslcontext = SSLContext.getInstance("TLS");
- sslcontext.init(null, new TrustManager[] { new X509TrustManager() {
- @Override
- public void checkClientTrusted(
- X509Certificate[] chain, String authType) throws CertificateException { }
-
- @Override
- public void checkServerTrusted(
- X509Certificate[] chain,String authType) throws CertificateException { }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() { return null; }
-
- } }, null);
- SSLSocketFactory sf = new SSLSocketFactory(sslcontext);
-// ClientConnectionManager cm = client.getConnectionManager();
-// SchemeRegistry schemeRegistry = cm.getSchemeRegistry();
-// schemeRegistry.register(new Scheme("https", sf, 443));
-// schemeRegistry.register(new Scheme("http", sf, 80));
-// HttpHost proxy = new HttpHost("127.0.0.1", 8080);
-// client.getParams().setParameter(ConnRoutePNames.DEFAULT_PROXY, proxy);
- } catch (Exception e) {
- System.out.println("SSL setup error:");
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
-
- return client; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- @Override
- public <T extends HttpMessage> T getHttpMethod(T method) {
- if (method == null)
- throw new IllegalArgumentException("The HttpMethod cannot be null.");
-
- method.addHeader("X-Heroku-API-Version", "2");
- return method;
- }
-
- @Override
- public URL getEndpoint() {
- return endpoint;
- }
-
- @Override
- public String getEmail() {
- return userEmail;
- }
-
- @Override
- public String getApiKey() {
- return apiKey;
- }
-}
diff --git a/src/main/java/com/heroku/api/connection/HerokuAPIException.java b/src/main/java/com/heroku/api/exception/HerokuAPIException.java
similarity index 91%
rename from src/main/java/com/heroku/api/connection/HerokuAPIException.java
rename to src/main/java/com/heroku/api/exception/HerokuAPIException.java
index fdf474f..1ce6293 100644
--- a/src/main/java/com/heroku/api/connection/HerokuAPIException.java
+++ b/src/main/java/com/heroku/api/exception/HerokuAPIException.java
@@ -1,4 +1,4 @@
-package com.heroku.api.connection;
+package com.heroku.api.exception;
/**
* TODO: Enter JavaDoc
diff --git a/src/main/java/com/heroku/api/http/HttpHeader.java b/src/main/java/com/heroku/api/http/HttpHeader.java
new file mode 100644
index 0000000..ff854b5
--- /dev/null
+++ b/src/main/java/com/heroku/api/http/HttpHeader.java
@@ -0,0 +1,22 @@
+package com.heroku.api.http;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public final class HttpHeader {
+
+ public static final class ContentType {
+ public final static String HEADER = "Content-Type";
+ public final static String FORM_URLENCODED = "application/x-www-form-urlencoded";
+ public final static String SSH_AUTHKEY = "text/ssh-authkey";
+ }
+
+ public static final class Accept {
+ public final static String HEADER = "Accept";
+ public final static String APPLICATION_JSON = "application/json";
+ public final static String TEXT_XML = "text/xml";
+ }
+
+}
diff --git a/src/main/java/com/heroku/api/http/HttpStatus.java b/src/main/java/com/heroku/api/http/HttpStatus.java
new file mode 100644
index 0000000..b47a662
--- /dev/null
+++ b/src/main/java/com/heroku/api/http/HttpStatus.java
@@ -0,0 +1,17 @@
+package com.heroku.api.http;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public enum HttpStatus {
+ OK (200),
+ ACCEPTED (202);
+
+ public final int statusCode;
+
+ HttpStatus(int statusCode) {
+ this.statusCode = statusCode;
+ }
+}
diff --git a/src/main/java/com/heroku/api/util/HttpUtil.java b/src/main/java/com/heroku/api/util/HttpUtil.java
new file mode 100644
index 0000000..bc5ed99
--- /dev/null
+++ b/src/main/java/com/heroku/api/util/HttpUtil.java
@@ -0,0 +1,33 @@
+package com.heroku.api.util;
+
+import com.heroku.api.HerokuRequestKey;
+import com.heroku.api.command.CommandConfig;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+/**
+ * TODO: Javadoc
+ *
+ * @author Naaman Newbold
+ */
+public class HttpUtil {
+ public static String encodeParameters(CommandConfig config, HerokuRequestKey... keys) throws UnsupportedEncodingException {
+ StringBuilder encodedParameters = new StringBuilder();
+ String separator = "";
+ for (HerokuRequestKey key : keys) {
+ if (config.get(key) != null) {
+ encodedParameters.append(separator);
+ encodedParameters.append(
+ URLEncoder.encode(key.queryParameter, "UTF-8")
+ );
+ encodedParameters.append("=");
+ encodedParameters.append(
+ URLEncoder.encode(config.get(key), "UTF-8")
+ );
+ separator = "&";
+ }
+ }
+ return new String(encodedParameters);
+ }
+}
diff --git a/src/test/java/com/heroku/api/ConnectionTestModule.java b/src/test/java/com/heroku/api/ConnectionTestModule.java
index 07f5a50..4249f3a 100644
--- a/src/test/java/com/heroku/api/ConnectionTestModule.java
+++ b/src/test/java/com/heroku/api/ConnectionTestModule.java
@@ -2,8 +2,8 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
-import com.heroku.api.connection.HerokuBasicAuthConnectionProvider;
-import com.heroku.api.connection.HerokuConnection;
+import com.heroku.api.connection.BasicAuthConnectionProvider;
+import com.heroku.api.connection.Connection;
import java.io.IOException;
import java.util.Properties;
@@ -20,9 +20,9 @@ protected void configure() {
}
@Provides
- HerokuConnection getConnection() throws IOException {
+ Connection getConnection() throws IOException {
AuthenticationTestCredentials cred = getCredentials();
- return new HerokuBasicAuthConnectionProvider(cred.username, cred.password).getConnection();
+ return new BasicAuthConnectionProvider(cred.username, cred.password).getConnection();
}
@Provides
diff --git a/src/test/java/com/heroku/api/command/BaseCommandIntegrationTest.java b/src/test/java/com/heroku/api/command/BaseCommandIntegrationTest.java
index 7d0a49d..0100a49 100644
--- a/src/test/java/com/heroku/api/command/BaseCommandIntegrationTest.java
+++ b/src/test/java/com/heroku/api/command/BaseCommandIntegrationTest.java
@@ -3,7 +3,7 @@
import com.google.inject.Inject;
import com.heroku.api.ConnectionTestModule;
import com.heroku.api.HerokuStack;
-import com.heroku.api.connection.HerokuConnection;
+import com.heroku.api.connection.Connection;
import org.testng.annotations.AfterTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice;
@@ -21,16 +21,16 @@
public abstract class BaseCommandIntegrationTest {
@Inject
- HerokuConnection connection;
+ Connection connection;
- private List<HerokuCommandResponse> apps = new ArrayList<HerokuCommandResponse>();
+ private List<CommandResponse> apps = new ArrayList<CommandResponse>();
@DataProvider
public Object[][] app() throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar);
+ CommandConfig config = new CommandConfig().onStack(HerokuStack.Cedar);
- HerokuCommand cmd = new HerokuAppCreateCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ Command cmd = new AppCreateCommand(config);
+ CommandResponse response = connection.executeCommand(cmd);
apps.add(response);
@@ -39,15 +39,15 @@ public Object[][] app() throws IOException {
@AfterTest
public void deleteTestApps() throws IOException {
- for (HerokuCommandResponse res : apps) {
- HerokuCommandConfig config = new HerokuCommandConfig()
+ for (CommandResponse res : apps) {
+ CommandConfig config = new CommandConfig()
.onStack(HerokuStack.Cedar)
.app(res.get("name").toString());
// quietly clean up apps created. if the destroy fails, it's ok because it might
// have been deleted before we get to it here.
- HerokuCommand cmd = new HerokuAppDestroyCommand(config);
- cmd.execute(connection);
+ Command cmd = new AppDestroyCommand(config);
+ connection.executeCommand(cmd);
}
}
diff --git a/src/test/java/com/heroku/api/command/CommandIntegrationTest.java b/src/test/java/com/heroku/api/command/CommandIntegrationTest.java
index 53b3993..afae69b 100644
--- a/src/test/java/com/heroku/api/command/CommandIntegrationTest.java
+++ b/src/test/java/com/heroku/api/command/CommandIntegrationTest.java
@@ -1,15 +1,12 @@
package com.heroku.api.command;
+import com.heroku.api.HerokuRequestKey;
import com.heroku.api.HerokuStack;
-
-import static org.testng.Assert.*;
-
import org.testng.annotations.Test;
import java.io.IOException;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.*;
/**
@@ -24,10 +21,8 @@ public class CommandIntegrationTest extends BaseCommandIntegrationTest {
@Test
public void testCreateAppCommand() throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar);
-
- HerokuCommand cmd = new HerokuAppCreateCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ Command cmd = new AppCreateCommand(new CommandConfig().onStack(HerokuStack.Cedar));
+ CommandResponse response = connection.executeCommand(cmd);
assertTrue(response.isSuccess());
assertNotNull(response.get("id"));
@@ -35,45 +30,40 @@ public void testCreateAppCommand() throws IOException {
}
@Test(dataProvider = "app")
- public void testAppCommand(HerokuCommandResponse app) throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig()
+ public void testAppCommand(CommandResponse app) throws IOException {
+ Command cmd = new AppCommand(new CommandConfig()
.onStack(HerokuStack.Cedar)
- .app(app.get("name").toString());
+ .app(app.get("name").toString()));
- HerokuCommand cmd = new HerokuAppCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ CommandResponse response = connection.executeCommand(cmd);
assertEquals(response.get("name"), app.get("name"));
}
@Test(dataProvider = "app")
- public void testListAppsCommand(HerokuCommandResponse app) throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar);
-
- HerokuCommand cmd = new HerokuAppsCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ public void testListAppsCommand(CommandResponse app) throws IOException {
+ Command cmd = new AppsCommand(new CommandConfig());
+ CommandResponse response = connection.executeCommand(cmd);
assertNotNull(response.get(app.get("name").toString()));
}
@Test(dataProvider = "app")
- public void testDestroyAppCommand(HerokuCommandResponse app) throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar).app(app.get("name").toString());
-
- HerokuCommand cmd = new HerokuAppDestroyCommand(config);
+ public void testDestroyAppCommand(CommandResponse app) throws IOException {
+ Command cmd = new AppDestroyCommand(new CommandConfig()
+ .app(app.get("name").toString()));
- HerokuCommandResponse response = cmd.execute(connection);
+ CommandResponse response = connection.executeCommand(cmd);
assertEquals(response.isSuccess(), true);
}
@Test(dataProvider = "app")
- public void testSharingAddCommand(HerokuCommandResponse app) throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar).app(app.get("name").toString());
- config.set(HerokuRequestKey.collaborator, DEMO_EMAIL);
-
- HerokuCommand cmd = new HerokuSharingAddCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ public void testSharingAddCommand(CommandResponse app) throws IOException {
+ Command cmd = new SharingAddCommand(new CommandConfig()
+ .app(app.get("name").toString())
+ .with(HerokuRequestKey.collaborator, DEMO_EMAIL));
+ CommandResponse response = connection.executeCommand(cmd);
assertTrue(response.isSuccess());
}
@@ -82,42 +72,48 @@ public void testSharingAddCommand(HerokuCommandResponse app) throws IOException
// we need two users in auth-test.properties so that we can transfer it to one and still control it,
// rather than transferring it to a black hole
@Test(dataProvider = "app")
- public void testSharingTransferCommand(HerokuCommandResponse app) throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar).app(app.get("name").toString());
- config.set(HerokuRequestKey.collaborator, DEMO_EMAIL);
-
- HerokuCommand sharingAddCommand = new HerokuSharingAddCommand(config);
- sharingAddCommand.execute(connection);
+ public void testSharingTransferCommand(CommandResponse app) throws IOException {
- config.set(HerokuRequestKey.transferOwner, DEMO_EMAIL);
+ Command sharingAddCommand = new SharingAddCommand(new CommandConfig()
+ .onStack(HerokuStack.Cedar)
+ .app(app.get("name").toString())
+ .with(HerokuRequestKey.collaborator, DEMO_EMAIL));
+ connection.executeCommand(sharingAddCommand);
- HerokuCommand sharingTransferCommand = new HerokuSharingTransferCommand(config);
- HerokuCommandResponse sharingTransferCommandResponse = sharingTransferCommand.execute(connection);
+ Command sharingTransferCommand = new SharingTransferCommand(new CommandConfig()
+ .onStack(HerokuStack.Cedar)
+ .app(app.get("name").toString())
+ .with(HerokuRequestKey.collaborator, DEMO_EMAIL)
+ .with(HerokuRequestKey.transferOwner, DEMO_EMAIL));
+ CommandResponse sharingTransferCommandResponse = connection.executeCommand(sharingTransferCommand);
assertTrue(sharingTransferCommandResponse.isSuccess());
}
@Test(dataProvider = "app")
- public void testSharingRemoveCommand(HerokuCommandResponse app) throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar).app(app.get("name").toString());
- config.set(HerokuRequestKey.collaborator, DEMO_EMAIL);
+ public void testSharingRemoveCommand(CommandResponse app) throws IOException {
- HerokuCommand sharingAddCommand = new HerokuSharingAddCommand(config);
- sharingAddCommand.execute(connection);
+ Command sharingAddCommand = new SharingAddCommand(new CommandConfig()
+ .onStack(HerokuStack.Cedar)
+ .app(app.get("name").toString())
+ .with(HerokuRequestKey.collaborator, DEMO_EMAIL));
+ connection.executeCommand(sharingAddCommand);
- HerokuCommand cmd = new HerokuSharingRemoveCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ Command cmd = new SharingRemoveCommand(new CommandConfig()
+ .onStack(HerokuStack.Cedar)
+ .app(app.get("name").toString())
+ .with(HerokuRequestKey.collaborator, DEMO_EMAIL));
+ CommandResponse response = connection.executeCommand(cmd);
assertTrue(response.isSuccess());
}
@Test(dataProvider = "app")
- public void testConfigAddCommand(HerokuCommandResponse app) throws IOException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar).app(app.get("name").toString());
- config.set(HerokuRequestKey.configvars, "{\"FOO\":\"bar\", \"BAR\":\"foo\"}");
-
- HerokuCommand cmd = new HerokuConfigAddCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ public void testConfigAddCommand(CommandResponse app) throws IOException {
+ Command cmd = new ConfigAddCommand(new CommandConfig()
+ .app(app.get("name").toString())
+ .with(HerokuRequestKey.configvars, "{\"FOO\":\"bar\", \"BAR\":\"foo\"}"));
+ CommandResponse response = connection.executeCommand(cmd);
assertTrue(response.isSuccess());
}
diff --git a/src/test/java/com/heroku/api/command/HerokuCommandResponseTest.java b/src/test/java/com/heroku/api/command/CommandResponseTest.java
similarity index 79%
rename from src/test/java/com/heroku/api/command/HerokuCommandResponseTest.java
rename to src/test/java/com/heroku/api/command/CommandResponseTest.java
index 1cdff62..e77e5e6 100644
--- a/src/test/java/com/heroku/api/command/HerokuCommandResponseTest.java
+++ b/src/test/java/com/heroku/api/command/CommandResponseTest.java
@@ -12,18 +12,18 @@
*
* @author Naaman Newbold
*/
-public class HerokuCommandResponseTest {
+public class CommandResponseTest {
@Test
public void testArrayOfJsonElementsMapsToHerokuCommandMap() {
String jsonArray = "[{\"name\":\"warm-frost-3139\",\"stack\":\"cedar\"},{\"name\":\"vivid-summer-2426\",\"stack\":\"cedar\"}]";
- HerokuCommandJsonListMapResponse res = new HerokuCommandJsonListMapResponse(jsonArray.getBytes(), true);
+ JsonArrayResponse res = new JsonArrayResponse(jsonArray.getBytes(), true);
Assert.assertNotNull(res.get("warm-frost-3139"));
}
@Test
public void testSingleJsonElementMapsToHerokuCommandMap() {
String json = "{\"name\":\"warm-frost-3139\",\"stack\":\"cedar\"}";
- HerokuCommandJsonMapResponse res = new HerokuCommandJsonMapResponse(json.getBytes(), true);
+ JsonMapResponse res = new JsonMapResponse(json.getBytes(), true);
Assert.assertEquals(res.get("name"), "warm-frost-3139");
}
@@ -36,7 +36,7 @@ public void testSingleXmlElementMapsToHerokuXmlCommandMap() throws SAXException,
" <repo-size type=\"integer\" nil=\"true\"></repo-size>\n" +
" <id>[email protected]</id>\n" +
"</app>";
- HerokuCommandXmlMapResponse response = new HerokuCommandXmlMapResponse(xml.getBytes(), true);
+ XmlMapResponse response = new XmlMapResponse(xml.getBytes(), true);
Assert.assertEquals(response.get("name"), "fierce-rain-7019");
}
}
diff --git a/src/test/java/com/heroku/api/command/NoAppCommandIntegrationTest.java b/src/test/java/com/heroku/api/command/NoAppCommandIntegrationTest.java
index 3ddf0d6..da96fa5 100644
--- a/src/test/java/com/heroku/api/command/NoAppCommandIntegrationTest.java
+++ b/src/test/java/com/heroku/api/command/NoAppCommandIntegrationTest.java
@@ -2,9 +2,10 @@
import com.google.inject.Inject;
import com.heroku.api.ConnectionTestModule;
+import com.heroku.api.HerokuRequestKey;
import com.heroku.api.HerokuStack;
-import com.heroku.api.connection.HerokuAPIException;
-import com.heroku.api.connection.HerokuConnection;
+import com.heroku.api.exception.HerokuAPIException;
+import com.heroku.api.connection.Connection;
import com.jcraft.jsch.JSch;
import com.jcraft.jsch.JSchException;
import com.jcraft.jsch.KeyPair;
@@ -30,13 +31,11 @@ public class NoAppCommandIntegrationTest {
private static final String PUBLIC_KEY_COMMENT = "foo@bar";
@Inject
- HerokuConnection connection;
+ Connection connection;
// doesn't need an app
@Test
public void testKeysAddCommand() throws IOException, HerokuAPIException, JSchException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar);
-
JSch jsch = new JSch();
KeyPair keyPair = KeyPair.genKeyPair(jsch, KeyPair.RSA);
@@ -45,9 +44,12 @@ public void testKeysAddCommand() throws IOException, HerokuAPIException, JSchExc
publicKeyOutputStream.close();
String sshPublicKey = new String(publicKeyOutputStream.toByteArray());
- config.set(HerokuRequestKey.sshkey, sshPublicKey);
- HerokuCommand cmd = new HerokuKeysAddCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ CommandConfig config = new CommandConfig()
+ .onStack(HerokuStack.Cedar)
+ .with(HerokuRequestKey.sshkey, sshPublicKey);
+
+ Command cmd = new KeysAddCommand(config);
+ CommandResponse response = connection.executeCommand(cmd);
assertTrue(response.isSuccess());
}
@@ -55,11 +57,12 @@ public void testKeysAddCommand() throws IOException, HerokuAPIException, JSchExc
// doesn't need an app
@Test(dependsOnMethods = {"testKeysAddCommand"})
public void testKeysRemoveCommand() throws IOException, HerokuAPIException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar);
+ CommandConfig config = new CommandConfig()
+ .onStack(HerokuStack.Cedar)
+ .with(HerokuRequestKey.name, PUBLIC_KEY_COMMENT);
- config.set(HerokuRequestKey.name, PUBLIC_KEY_COMMENT);
- HerokuCommand cmd = new HerokuKeysRemoveCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+ Command cmd = new KeysRemoveCommand(config);
+ CommandResponse response = connection.executeCommand(cmd);
assertTrue(response.isSuccess());
}
@@ -70,11 +73,15 @@ public void testKeysRemoveCommand() throws IOException, HerokuAPIException {
// but this depends on having two users in auth-test.properties
@Test
public void testKeysAddCommandWithDuplicateKey() throws IOException, HerokuAPIException {
- HerokuCommandConfig config = new HerokuCommandConfig().onStack(HerokuStack.Cedar);
String sshkey = FileUtils.readFileToString(new File(getClass().getResource("/id_rsa.pub").getFile()));
- config.set(HerokuRequestKey.sshkey, sshkey);
- HerokuCommand cmd = new HerokuKeysAddCommand(config);
- HerokuCommandResponse response = cmd.execute(connection);
+
+ CommandConfig config = new CommandConfig()
+ .onStack(HerokuStack.Cedar)
+ .with(HerokuRequestKey.sshkey, sshkey);
+
+ Command cmd = new KeysAddCommand(config);
+ CommandResponse response = connection.executeCommand(cmd);
+
assertFalse(response.isSuccess());
}
diff --git a/src/test/java/com/heroku/api/connection/ConnectionIntegrationTest.java b/src/test/java/com/heroku/api/connection/ConnectionIntegrationTest.java
index eab2bea..c44c3fe 100644
--- a/src/test/java/com/heroku/api/connection/ConnectionIntegrationTest.java
+++ b/src/test/java/com/heroku/api/connection/ConnectionIntegrationTest.java
@@ -2,6 +2,7 @@
import com.google.inject.Inject;
import com.heroku.api.ConnectionTestModule;
+import com.heroku.api.exception.HerokuAPIException;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Guice;
@@ -21,8 +22,8 @@ public class ConnectionIntegrationTest {
@Test(groups = "integration")
public void testValidUsernameAndPassword() throws IOException {
- HerokuConnectionProvider connectionProvider = new HerokuBasicAuthConnectionProvider(cred.username, cred.password);
- HerokuConnection conn = connectionProvider.getConnection();
+ ConnectionProvider connectionProvider = new BasicAuthConnectionProvider(cred.username, cred.password);
+ Connection conn = connectionProvider.getConnection();
Assert.assertNotNull(conn.getApiKey(), "Expected an API key from login, but it doesn't exist.");
}
@@ -40,7 +41,7 @@ public Object[][] invalidUsernamesAndPasswords() {
expectedExceptions = HerokuAPIException.class,
expectedExceptionsMessageRegExp = "Invalid username and password combination.")
public void testInvalidUsernameAndPassword(String username, String password) throws IOException {
- HerokuConnectionProvider auth = new HerokuBasicAuthConnectionProvider(username, password);
- HerokuConnection conn = auth.getConnection();
+ ConnectionProvider auth = new BasicAuthConnectionProvider(username, password);
+ Connection conn = auth.getConnection();
}
}
|
603451ed0b64de2aa5c4251d669056701ba788b9
|
drools
|
JBRULES-130--git-svn-id: https://svn.jboss.org/repos/labs/trunk/labs/jbossrules@3283 c60d74c8-e8f6-0310-9e8f-d4a2fc68ab70-
|
c
|
https://github.com/kiegroup/drools
|
diff --git a/drools-compiler/src/main/java/org/drools/lang/RuleParser.java b/drools-compiler/src/main/java/org/drools/lang/RuleParser.java
index 424a8b81d9c..4ace9c9518c 100644
--- a/drools-compiler/src/main/java/org/drools/lang/RuleParser.java
+++ b/drools-compiler/src/main/java/org/drools/lang/RuleParser.java
@@ -1,4 +1,4 @@
-// $ANTLR 3.0ea8 C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g 2006-03-28 11:19:23
+// $ANTLR 3.0ea8 C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g 2006-03-28 14:38:45
package org.drools.lang;
import java.util.List;
@@ -15,7 +15,7 @@
public class RuleParser extends Parser {
public static final String[] tokenNames = new String[] {
- "<invalid>", "<EOR>", "<DOWN>", "<UP>", "EOL", "ID", "INT", "BOOL", "STRING", "FLOAT", "MISC", "WS", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "MULTI_LINE_COMMENT", "\'package\'", "\';\'", "\'import\'", "\'expander\'", "\'global\'", "\'function\'", "\'(\'", "\',\'", "\')\'", "\'{\'", "\'}\'", "\'query\'", "\'end\'", "\'rule\'", "\'when\'", "\':\'", "\'then\'", "\'attributes\'", "\'salience\'", "\'no-loop\'", "\'xor-group\'", "\'agenda-group\'", "\'duration\'", "\'or\'", "\'==\'", "\'>\'", "\'>=\'", "\'<\'", "\'<=\'", "\'!=\'", "\'contains\'", "\'matches\'", "\'->\'", "\'||\'", "\'and\'", "\'&&\'", "\'exists\'", "\'not\'", "\'eval\'", "\'.\'", "\'use\'"
+ "<invalid>", "<EOR>", "<DOWN>", "<UP>", "EOL", "ID", "INT", "BOOL", "STRING", "FLOAT", "MISC", "WS", "SH_STYLE_SINGLE_LINE_COMMENT", "C_STYLE_SINGLE_LINE_COMMENT", "MULTI_LINE_COMMENT", "\'package\'", "\';\'", "\'import\'", "\'expander\'", "\'global\'", "\'function\'", "\'(\'", "\',\'", "\')\'", "\'{\'", "\'}\'", "\'query\'", "\'end\'", "\'rule\'", "\'when\'", "\':\'", "\'then\'", "\'attributes\'", "\'salience\'", "\'no-loop\'", "\'auto-focus\'", "\'xor-group\'", "\'agenda-group\'", "\'duration\'", "\'or\'", "\'==\'", "\'>\'", "\'>=\'", "\'<\'", "\'<=\'", "\'!=\'", "\'contains\'", "\'matches\'", "\'->\'", "\'||\'", "\'and\'", "\'&&\'", "\'exists\'", "\'not\'", "\'eval\'", "\'.\'", "\'use\'"
};
public static final int BOOL=7;
public static final int INT=6;
@@ -1006,8 +1006,9 @@ else if ( true ) {
case 48:
case 49:
case 50:
- case 54:
+ case 51:
case 55:
+ case 56:
alt18=1;
break;
case 27:
@@ -1025,7 +1026,7 @@ else if ( true ) {
throw nvae;
}
break;
- case 51:
+ case 52:
int LA18_4 = input.LA(2);
if ( expander != null ) {
alt18=1;
@@ -1040,7 +1041,7 @@ else if ( true ) {
throw nvae;
}
break;
- case 52:
+ case 53:
int LA18_5 = input.LA(2);
if ( expander != null ) {
alt18=1;
@@ -1055,7 +1056,7 @@ else if ( true ) {
throw nvae;
}
break;
- case 53:
+ case 54:
int LA18_6 = input.LA(2);
if ( expander != null ) {
alt18=1;
@@ -1188,6 +1189,7 @@ public RuleDescr rule() throws RecognitionException {
case 35:
case 36:
case 37:
+ case 38:
alt19=1;
break;
case 29:
@@ -1260,7 +1262,7 @@ else if ( expander != null ) {
throw nvae;
}
}
- else if ( (LA20_0>=EOL && LA20_0<=29)||(LA20_0>=31 && LA20_0<=55) ) {
+ else if ( (LA20_0>=EOL && LA20_0<=29)||(LA20_0>=31 && LA20_0<=56) ) {
alt20=2;
}
else {
@@ -1350,8 +1352,9 @@ else if ( true ) {
case 48:
case 49:
case 50:
- case 54:
+ case 51:
case 55:
+ case 56:
alt21=1;
break;
case 31:
@@ -1369,7 +1372,7 @@ else if ( true ) {
throw nvae;
}
break;
- case 51:
+ case 52:
int LA21_4 = input.LA(2);
if ( expander != null ) {
alt21=1;
@@ -1384,7 +1387,7 @@ else if ( true ) {
throw nvae;
}
break;
- case 52:
+ case 53:
int LA21_5 = input.LA(2);
if ( expander != null ) {
alt21=1;
@@ -1399,7 +1402,7 @@ else if ( true ) {
throw nvae;
}
break;
- case 53:
+ case 54:
int LA21_6 = input.LA(2);
if ( expander != null ) {
alt21=1;
@@ -1476,7 +1479,7 @@ else if ( true ) {
if ( LA23_0==30 ) {
alt23=1;
}
- else if ( (LA23_0>=EOL && LA23_0<=29)||(LA23_0>=31 && LA23_0<=55) ) {
+ else if ( (LA23_0>=EOL && LA23_0<=29)||(LA23_0>=31 && LA23_0<=56) ) {
alt23=2;
}
else {
@@ -1508,7 +1511,7 @@ else if ( (LA23_0>=EOL && LA23_0<=29)||(LA23_0>=31 && LA23_0<=55) ) {
if ( LA24_0==27 ) {
alt24=2;
}
- else if ( (LA24_0>=EOL && LA24_0<=26)||(LA24_0>=28 && LA24_0<=55) ) {
+ else if ( (LA24_0>=EOL && LA24_0<=26)||(LA24_0>=28 && LA24_0<=56) ) {
alt24=1;
}
@@ -1575,7 +1578,7 @@ public void rule_attributes(RuleDescr rule) throws RecognitionException {
if ( LA25_0==32 ) {
alt25=1;
}
- else if ( LA25_0==EOL||LA25_0==22||(LA25_0>=29 && LA25_0<=31)||(LA25_0>=33 && LA25_0<=37) ) {
+ else if ( LA25_0==EOL||LA25_0==22||(LA25_0>=29 && LA25_0<=31)||(LA25_0>=33 && LA25_0<=38) ) {
alt25=2;
}
else {
@@ -1601,7 +1604,7 @@ else if ( LA25_0==EOL||LA25_0==22||(LA25_0>=29 && LA25_0<=31)||(LA25_0>=33 && LA
if ( LA26_0==30 ) {
alt26=1;
}
- else if ( LA26_0==EOL||LA26_0==22||LA26_0==29||LA26_0==31||(LA26_0>=33 && LA26_0<=37) ) {
+ else if ( LA26_0==EOL||LA26_0==22||LA26_0==29||LA26_0==31||(LA26_0>=33 && LA26_0<=38) ) {
alt26=2;
}
else {
@@ -1630,7 +1633,7 @@ else if ( LA26_0==EOL||LA26_0==22||LA26_0==29||LA26_0==31||(LA26_0>=33 && LA26_0
do {
int alt28=2;
int LA28_0 = input.LA(1);
- if ( LA28_0==22||(LA28_0>=33 && LA28_0<=37) ) {
+ if ( LA28_0==22||(LA28_0>=33 && LA28_0<=38) ) {
alt28=1;
}
@@ -1645,7 +1648,7 @@ else if ( LA26_0==EOL||LA26_0==22||LA26_0==29||LA26_0==31||(LA26_0>=33 && LA26_0
if ( LA27_0==22 ) {
alt27=1;
}
- else if ( (LA27_0>=33 && LA27_0<=37) ) {
+ else if ( (LA27_0>=33 && LA27_0<=38) ) {
alt27=2;
}
else {
@@ -1701,7 +1704,7 @@ else if ( (LA27_0>=33 && LA27_0<=37) ) {
// $ANTLR start rule_attribute
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:265:1: rule_attribute returns [AttributeDescr d] : (a= salience | a= no_loop | a= agenda_group | a= duration | a= xor_group );
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:265:1: rule_attribute returns [AttributeDescr d] : (a= salience | a= no_loop | a= agenda_group | a= duration | a= xor_group | a= auto_focus );
public AttributeDescr rule_attribute() throws RecognitionException {
AttributeDescr d;
AttributeDescr a = null;
@@ -1711,8 +1714,8 @@ public AttributeDescr rule_attribute() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:270:25: (a= salience | a= no_loop | a= agenda_group | a= duration | a= xor_group )
- int alt29=5;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:270:25: (a= salience | a= no_loop | a= agenda_group | a= duration | a= xor_group | a= auto_focus )
+ int alt29=6;
switch ( input.LA(1) ) {
case 33:
alt29=1;
@@ -1720,18 +1723,21 @@ public AttributeDescr rule_attribute() throws RecognitionException {
case 34:
alt29=2;
break;
- case 36:
+ case 37:
alt29=3;
break;
- case 37:
+ case 38:
alt29=4;
break;
- case 35:
+ case 36:
alt29=5;
break;
+ case 35:
+ alt29=6;
+ break;
default:
NoViableAltException nvae =
- new NoViableAltException("265:1: rule_attribute returns [AttributeDescr d] : (a= salience | a= no_loop | a= agenda_group | a= duration | a= xor_group );", 29, 0, input);
+ new NoViableAltException("265:1: rule_attribute returns [AttributeDescr d] : (a= salience | a= no_loop | a= agenda_group | a= duration | a= xor_group | a= auto_focus );", 29, 0, input);
throw nvae;
}
@@ -1792,6 +1798,17 @@ public AttributeDescr rule_attribute() throws RecognitionException {
}
break;
+ case 6 :
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:275:25: a= auto_focus
+ {
+ following.push(FOLLOW_auto_focus_in_rule_attribute812);
+ a=auto_focus();
+ following.pop();
+
+ d = a;
+
+ }
+ break;
}
}
@@ -1807,7 +1824,7 @@ public AttributeDescr rule_attribute() throws RecognitionException {
// $ANTLR start salience
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:278:1: salience returns [AttributeDescr d ] : loc= 'salience' opt_eol i= INT ( ';' )? opt_eol ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:279:1: salience returns [AttributeDescr d ] : loc= 'salience' opt_eol i= INT ( ';' )? opt_eol ;
public AttributeDescr salience() throws RecognitionException {
AttributeDescr d;
Token loc=null;
@@ -1817,44 +1834,44 @@ public AttributeDescr salience() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:283:17: (loc= 'salience' opt_eol i= INT ( ';' )? opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:283:17: loc= 'salience' opt_eol i= INT ( ';' )? opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:284:17: (loc= 'salience' opt_eol i= INT ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:284:17: loc= 'salience' opt_eol i= INT ( ';' )? opt_eol
{
loc=(Token)input.LT(1);
- match(input,33,FOLLOW_33_in_salience834);
- following.push(FOLLOW_opt_eol_in_salience836);
+ match(input,33,FOLLOW_33_in_salience845);
+ following.push(FOLLOW_opt_eol_in_salience847);
opt_eol();
following.pop();
i=(Token)input.LT(1);
- match(input,INT,FOLLOW_INT_in_salience840);
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:283:46: ( ';' )?
+ match(input,INT,FOLLOW_INT_in_salience851);
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:284:46: ( ';' )?
int alt30=2;
int LA30_0 = input.LA(1);
if ( LA30_0==16 ) {
alt30=1;
}
- else if ( LA30_0==EOL||LA30_0==22||LA30_0==29||LA30_0==31||(LA30_0>=33 && LA30_0<=37) ) {
+ else if ( LA30_0==EOL||LA30_0==22||LA30_0==29||LA30_0==31||(LA30_0>=33 && LA30_0<=38) ) {
alt30=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("283:46: ( \';\' )?", 30, 0, input);
+ new NoViableAltException("284:46: ( \';\' )?", 30, 0, input);
throw nvae;
}
switch (alt30) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:283:46: ';'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:284:46: ';'
{
- match(input,16,FOLLOW_16_in_salience842);
+ match(input,16,FOLLOW_16_in_salience853);
}
break;
}
- following.push(FOLLOW_opt_eol_in_salience845);
+ following.push(FOLLOW_opt_eol_in_salience856);
opt_eol();
following.pop();
@@ -1878,7 +1895,7 @@ else if ( LA30_0==EOL||LA30_0==22||LA30_0==29||LA30_0==31||(LA30_0>=33 && LA30_0
// $ANTLR start no_loop
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:290:1: no_loop returns [AttributeDescr d] : ( (loc= 'no-loop' opt_eol ( ';' )? opt_eol ) | (loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol ) );
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:291:1: no_loop returns [AttributeDescr d] : ( (loc= 'no-loop' opt_eol ( ';' )? opt_eol ) | (loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol ) );
public AttributeDescr no_loop() throws RecognitionException {
AttributeDescr d;
Token loc=null;
@@ -1888,7 +1905,7 @@ public AttributeDescr no_loop() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:295:17: ( (loc= 'no-loop' opt_eol ( ';' )? opt_eol ) | (loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol ) )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:296:17: ( (loc= 'no-loop' opt_eol ( ';' )? opt_eol ) | (loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol ) )
int alt33=2;
int LA33_0 = input.LA(1);
if ( LA33_0==34 ) {
@@ -1896,62 +1913,62 @@ public AttributeDescr no_loop() throws RecognitionException {
if ( LA33_1==BOOL ) {
alt33=2;
}
- else if ( LA33_1==EOL||LA33_1==16||LA33_1==22||LA33_1==29||LA33_1==31||(LA33_1>=33 && LA33_1<=37) ) {
+ else if ( LA33_1==EOL||LA33_1==16||LA33_1==22||LA33_1==29||LA33_1==31||(LA33_1>=33 && LA33_1<=38) ) {
alt33=1;
}
else {
NoViableAltException nvae =
- new NoViableAltException("290:1: no_loop returns [AttributeDescr d] : ( (loc= \'no-loop\' opt_eol ( \';\' )? opt_eol ) | (loc= \'no-loop\' t= BOOL opt_eol ( \';\' )? opt_eol ) );", 33, 1, input);
+ new NoViableAltException("291:1: no_loop returns [AttributeDescr d] : ( (loc= \'no-loop\' opt_eol ( \';\' )? opt_eol ) | (loc= \'no-loop\' t= BOOL opt_eol ( \';\' )? opt_eol ) );", 33, 1, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
- new NoViableAltException("290:1: no_loop returns [AttributeDescr d] : ( (loc= \'no-loop\' opt_eol ( \';\' )? opt_eol ) | (loc= \'no-loop\' t= BOOL opt_eol ( \';\' )? opt_eol ) );", 33, 0, input);
+ new NoViableAltException("291:1: no_loop returns [AttributeDescr d] : ( (loc= \'no-loop\' opt_eol ( \';\' )? opt_eol ) | (loc= \'no-loop\' t= BOOL opt_eol ( \';\' )? opt_eol ) );", 33, 0, input);
throw nvae;
}
switch (alt33) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:295:17: (loc= 'no-loop' opt_eol ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:296:17: (loc= 'no-loop' opt_eol ( ';' )? opt_eol )
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:295:17: (loc= 'no-loop' opt_eol ( ';' )? opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:296:25: loc= 'no-loop' opt_eol ( ';' )? opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:296:17: (loc= 'no-loop' opt_eol ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:297:25: loc= 'no-loop' opt_eol ( ';' )? opt_eol
{
loc=(Token)input.LT(1);
- match(input,34,FOLLOW_34_in_no_loop880);
- following.push(FOLLOW_opt_eol_in_no_loop882);
+ match(input,34,FOLLOW_34_in_no_loop891);
+ following.push(FOLLOW_opt_eol_in_no_loop893);
opt_eol();
following.pop();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:296:47: ( ';' )?
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:297:47: ( ';' )?
int alt31=2;
int LA31_0 = input.LA(1);
if ( LA31_0==16 ) {
alt31=1;
}
- else if ( LA31_0==EOL||LA31_0==22||LA31_0==29||LA31_0==31||(LA31_0>=33 && LA31_0<=37) ) {
+ else if ( LA31_0==EOL||LA31_0==22||LA31_0==29||LA31_0==31||(LA31_0>=33 && LA31_0<=38) ) {
alt31=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("296:47: ( \';\' )?", 31, 0, input);
+ new NoViableAltException("297:47: ( \';\' )?", 31, 0, input);
throw nvae;
}
switch (alt31) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:296:47: ';'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:297:47: ';'
{
- match(input,16,FOLLOW_16_in_no_loop884);
+ match(input,16,FOLLOW_16_in_no_loop895);
}
break;
}
- following.push(FOLLOW_opt_eol_in_no_loop887);
+ following.push(FOLLOW_opt_eol_in_no_loop898);
opt_eol();
following.pop();
@@ -1966,46 +1983,46 @@ else if ( LA31_0==EOL||LA31_0==22||LA31_0==29||LA31_0==31||(LA31_0>=33 && LA31_0
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:303:17: (loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:304:17: (loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol )
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:303:17: (loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:304:25: loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:304:17: (loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:305:25: loc= 'no-loop' t= BOOL opt_eol ( ';' )? opt_eol
{
loc=(Token)input.LT(1);
- match(input,34,FOLLOW_34_in_no_loop912);
+ match(input,34,FOLLOW_34_in_no_loop923);
t=(Token)input.LT(1);
- match(input,BOOL,FOLLOW_BOOL_in_no_loop916);
- following.push(FOLLOW_opt_eol_in_no_loop918);
+ match(input,BOOL,FOLLOW_BOOL_in_no_loop927);
+ following.push(FOLLOW_opt_eol_in_no_loop929);
opt_eol();
following.pop();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:304:54: ( ';' )?
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:305:54: ( ';' )?
int alt32=2;
int LA32_0 = input.LA(1);
if ( LA32_0==16 ) {
alt32=1;
}
- else if ( LA32_0==EOL||LA32_0==22||LA32_0==29||LA32_0==31||(LA32_0>=33 && LA32_0<=37) ) {
+ else if ( LA32_0==EOL||LA32_0==22||LA32_0==29||LA32_0==31||(LA32_0>=33 && LA32_0<=38) ) {
alt32=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("304:54: ( \';\' )?", 32, 0, input);
+ new NoViableAltException("305:54: ( \';\' )?", 32, 0, input);
throw nvae;
}
switch (alt32) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:304:54: ';'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:305:54: ';'
{
- match(input,16,FOLLOW_16_in_no_loop920);
+ match(input,16,FOLLOW_16_in_no_loop931);
}
break;
}
- following.push(FOLLOW_opt_eol_in_no_loop923);
+ following.push(FOLLOW_opt_eol_in_no_loop934);
opt_eol();
following.pop();
@@ -2033,8 +2050,164 @@ else if ( LA32_0==EOL||LA32_0==22||LA32_0==29||LA32_0==31||(LA32_0>=33 && LA32_0
// $ANTLR end no_loop
+ // $ANTLR start auto_focus
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:315:1: auto_focus returns [AttributeDescr d] : ( (loc= 'auto-focus' opt_eol ( ';' )? opt_eol ) | (loc= 'auto-focus' t= BOOL opt_eol ( ';' )? opt_eol ) );
+ public AttributeDescr auto_focus() throws RecognitionException {
+ AttributeDescr d;
+ Token loc=null;
+ Token t=null;
+
+
+ d = null;
+
+ try {
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:320:17: ( (loc= 'auto-focus' opt_eol ( ';' )? opt_eol ) | (loc= 'auto-focus' t= BOOL opt_eol ( ';' )? opt_eol ) )
+ int alt36=2;
+ int LA36_0 = input.LA(1);
+ if ( LA36_0==35 ) {
+ int LA36_1 = input.LA(2);
+ if ( LA36_1==BOOL ) {
+ alt36=2;
+ }
+ else if ( LA36_1==EOL||LA36_1==16||LA36_1==22||LA36_1==29||LA36_1==31||(LA36_1>=33 && LA36_1<=38) ) {
+ alt36=1;
+ }
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("315:1: auto_focus returns [AttributeDescr d] : ( (loc= \'auto-focus\' opt_eol ( \';\' )? opt_eol ) | (loc= \'auto-focus\' t= BOOL opt_eol ( \';\' )? opt_eol ) );", 36, 1, input);
+
+ throw nvae;
+ }
+ }
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("315:1: auto_focus returns [AttributeDescr d] : ( (loc= \'auto-focus\' opt_eol ( \';\' )? opt_eol ) | (loc= \'auto-focus\' t= BOOL opt_eol ( \';\' )? opt_eol ) );", 36, 0, input);
+
+ throw nvae;
+ }
+ switch (alt36) {
+ case 1 :
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:320:17: (loc= 'auto-focus' opt_eol ( ';' )? opt_eol )
+ {
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:320:17: (loc= 'auto-focus' opt_eol ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:321:25: loc= 'auto-focus' opt_eol ( ';' )? opt_eol
+ {
+ loc=(Token)input.LT(1);
+ match(input,35,FOLLOW_35_in_auto_focus980);
+ following.push(FOLLOW_opt_eol_in_auto_focus982);
+ opt_eol();
+ following.pop();
+
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:321:50: ( ';' )?
+ int alt34=2;
+ int LA34_0 = input.LA(1);
+ if ( LA34_0==16 ) {
+ alt34=1;
+ }
+ else if ( LA34_0==EOL||LA34_0==22||LA34_0==29||LA34_0==31||(LA34_0>=33 && LA34_0<=38) ) {
+ alt34=2;
+ }
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("321:50: ( \';\' )?", 34, 0, input);
+
+ throw nvae;
+ }
+ switch (alt34) {
+ case 1 :
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:321:50: ';'
+ {
+ match(input,16,FOLLOW_16_in_auto_focus984);
+
+ }
+ break;
+
+ }
+
+ following.push(FOLLOW_opt_eol_in_auto_focus987);
+ opt_eol();
+ following.pop();
+
+
+ d = new AttributeDescr( "auto-focus", "true" );
+ d.setLocation( loc.getLine(), loc.getCharPositionInLine() );
+
+
+ }
+
+
+ }
+ break;
+ case 2 :
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:328:17: (loc= 'auto-focus' t= BOOL opt_eol ( ';' )? opt_eol )
+ {
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:328:17: (loc= 'auto-focus' t= BOOL opt_eol ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:329:25: loc= 'auto-focus' t= BOOL opt_eol ( ';' )? opt_eol
+ {
+ loc=(Token)input.LT(1);
+ match(input,35,FOLLOW_35_in_auto_focus1012);
+ t=(Token)input.LT(1);
+ match(input,BOOL,FOLLOW_BOOL_in_auto_focus1016);
+ following.push(FOLLOW_opt_eol_in_auto_focus1018);
+ opt_eol();
+ following.pop();
+
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:329:57: ( ';' )?
+ int alt35=2;
+ int LA35_0 = input.LA(1);
+ if ( LA35_0==16 ) {
+ alt35=1;
+ }
+ else if ( LA35_0==EOL||LA35_0==22||LA35_0==29||LA35_0==31||(LA35_0>=33 && LA35_0<=38) ) {
+ alt35=2;
+ }
+ else {
+ NoViableAltException nvae =
+ new NoViableAltException("329:57: ( \';\' )?", 35, 0, input);
+
+ throw nvae;
+ }
+ switch (alt35) {
+ case 1 :
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:329:57: ';'
+ {
+ match(input,16,FOLLOW_16_in_auto_focus1020);
+
+ }
+ break;
+
+ }
+
+ following.push(FOLLOW_opt_eol_in_auto_focus1023);
+ opt_eol();
+ following.pop();
+
+
+ d = new AttributeDescr( "auto-focus", t.getText() );
+ d.setLocation( loc.getLine(), loc.getCharPositionInLine() );
+
+
+ }
+
+
+ }
+ break;
+
+ }
+ }
+ catch (RecognitionException re) {
+ reportError(re);
+ recover(input,re);
+ }
+ finally {
+ }
+ return d;
+ }
+ // $ANTLR end auto_focus
+
+
// $ANTLR start xor_group
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:314:1: xor_group returns [AttributeDescr d] : loc= 'xor-group' opt_eol name= STRING ( ';' )? opt_eol ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:339:1: xor_group returns [AttributeDescr d] : loc= 'xor-group' opt_eol name= STRING ( ';' )? opt_eol ;
public AttributeDescr xor_group() throws RecognitionException {
AttributeDescr d;
Token loc=null;
@@ -2044,44 +2217,44 @@ public AttributeDescr xor_group() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:319:17: (loc= 'xor-group' opt_eol name= STRING ( ';' )? opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:319:17: loc= 'xor-group' opt_eol name= STRING ( ';' )? opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:344:17: (loc= 'xor-group' opt_eol name= STRING ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:344:17: loc= 'xor-group' opt_eol name= STRING ( ';' )? opt_eol
{
loc=(Token)input.LT(1);
- match(input,35,FOLLOW_35_in_xor_group964);
- following.push(FOLLOW_opt_eol_in_xor_group966);
+ match(input,36,FOLLOW_36_in_xor_group1065);
+ following.push(FOLLOW_opt_eol_in_xor_group1067);
opt_eol();
following.pop();
name=(Token)input.LT(1);
- match(input,STRING,FOLLOW_STRING_in_xor_group970);
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:319:53: ( ';' )?
- int alt34=2;
- int LA34_0 = input.LA(1);
- if ( LA34_0==16 ) {
- alt34=1;
+ match(input,STRING,FOLLOW_STRING_in_xor_group1071);
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:344:53: ( ';' )?
+ int alt37=2;
+ int LA37_0 = input.LA(1);
+ if ( LA37_0==16 ) {
+ alt37=1;
}
- else if ( LA34_0==EOL||LA34_0==22||LA34_0==29||LA34_0==31||(LA34_0>=33 && LA34_0<=37) ) {
- alt34=2;
+ else if ( LA37_0==EOL||LA37_0==22||LA37_0==29||LA37_0==31||(LA37_0>=33 && LA37_0<=38) ) {
+ alt37=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("319:53: ( \';\' )?", 34, 0, input);
+ new NoViableAltException("344:53: ( \';\' )?", 37, 0, input);
throw nvae;
}
- switch (alt34) {
+ switch (alt37) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:319:53: ';'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:344:53: ';'
{
- match(input,16,FOLLOW_16_in_xor_group972);
+ match(input,16,FOLLOW_16_in_xor_group1073);
}
break;
}
- following.push(FOLLOW_opt_eol_in_xor_group975);
+ following.push(FOLLOW_opt_eol_in_xor_group1076);
opt_eol();
following.pop();
@@ -2105,7 +2278,7 @@ else if ( LA34_0==EOL||LA34_0==22||LA34_0==29||LA34_0==31||(LA34_0>=33 && LA34_0
// $ANTLR start agenda_group
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:326:1: agenda_group returns [AttributeDescr d] : loc= 'agenda-group' opt_eol name= STRING ( ';' )? opt_eol ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:351:1: agenda_group returns [AttributeDescr d] : loc= 'agenda-group' opt_eol name= STRING ( ';' )? opt_eol ;
public AttributeDescr agenda_group() throws RecognitionException {
AttributeDescr d;
Token loc=null;
@@ -2115,44 +2288,44 @@ public AttributeDescr agenda_group() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:331:17: (loc= 'agenda-group' opt_eol name= STRING ( ';' )? opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:331:17: loc= 'agenda-group' opt_eol name= STRING ( ';' )? opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:356:17: (loc= 'agenda-group' opt_eol name= STRING ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:356:17: loc= 'agenda-group' opt_eol name= STRING ( ';' )? opt_eol
{
loc=(Token)input.LT(1);
- match(input,36,FOLLOW_36_in_agenda_group1004);
- following.push(FOLLOW_opt_eol_in_agenda_group1006);
+ match(input,37,FOLLOW_37_in_agenda_group1105);
+ following.push(FOLLOW_opt_eol_in_agenda_group1107);
opt_eol();
following.pop();
name=(Token)input.LT(1);
- match(input,STRING,FOLLOW_STRING_in_agenda_group1010);
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:331:56: ( ';' )?
- int alt35=2;
- int LA35_0 = input.LA(1);
- if ( LA35_0==16 ) {
- alt35=1;
+ match(input,STRING,FOLLOW_STRING_in_agenda_group1111);
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:356:56: ( ';' )?
+ int alt38=2;
+ int LA38_0 = input.LA(1);
+ if ( LA38_0==16 ) {
+ alt38=1;
}
- else if ( LA35_0==EOL||LA35_0==22||LA35_0==29||LA35_0==31||(LA35_0>=33 && LA35_0<=37) ) {
- alt35=2;
+ else if ( LA38_0==EOL||LA38_0==22||LA38_0==29||LA38_0==31||(LA38_0>=33 && LA38_0<=38) ) {
+ alt38=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("331:56: ( \';\' )?", 35, 0, input);
+ new NoViableAltException("356:56: ( \';\' )?", 38, 0, input);
throw nvae;
}
- switch (alt35) {
+ switch (alt38) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:331:56: ';'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:356:56: ';'
{
- match(input,16,FOLLOW_16_in_agenda_group1012);
+ match(input,16,FOLLOW_16_in_agenda_group1113);
}
break;
}
- following.push(FOLLOW_opt_eol_in_agenda_group1015);
+ following.push(FOLLOW_opt_eol_in_agenda_group1116);
opt_eol();
following.pop();
@@ -2176,7 +2349,7 @@ else if ( LA35_0==EOL||LA35_0==22||LA35_0==29||LA35_0==31||(LA35_0>=33 && LA35_0
// $ANTLR start duration
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:339:1: duration returns [AttributeDescr d] : loc= 'duration' opt_eol i= INT ( ';' )? opt_eol ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:364:1: duration returns [AttributeDescr d] : loc= 'duration' opt_eol i= INT ( ';' )? opt_eol ;
public AttributeDescr duration() throws RecognitionException {
AttributeDescr d;
Token loc=null;
@@ -2186,44 +2359,44 @@ public AttributeDescr duration() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:344:17: (loc= 'duration' opt_eol i= INT ( ';' )? opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:344:17: loc= 'duration' opt_eol i= INT ( ';' )? opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:369:17: (loc= 'duration' opt_eol i= INT ( ';' )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:369:17: loc= 'duration' opt_eol i= INT ( ';' )? opt_eol
{
loc=(Token)input.LT(1);
- match(input,37,FOLLOW_37_in_duration1047);
- following.push(FOLLOW_opt_eol_in_duration1049);
+ match(input,38,FOLLOW_38_in_duration1148);
+ following.push(FOLLOW_opt_eol_in_duration1150);
opt_eol();
following.pop();
i=(Token)input.LT(1);
- match(input,INT,FOLLOW_INT_in_duration1053);
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:344:46: ( ';' )?
- int alt36=2;
- int LA36_0 = input.LA(1);
- if ( LA36_0==16 ) {
- alt36=1;
+ match(input,INT,FOLLOW_INT_in_duration1154);
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:369:46: ( ';' )?
+ int alt39=2;
+ int LA39_0 = input.LA(1);
+ if ( LA39_0==16 ) {
+ alt39=1;
}
- else if ( LA36_0==EOL||LA36_0==22||LA36_0==29||LA36_0==31||(LA36_0>=33 && LA36_0<=37) ) {
- alt36=2;
+ else if ( LA39_0==EOL||LA39_0==22||LA39_0==29||LA39_0==31||(LA39_0>=33 && LA39_0<=38) ) {
+ alt39=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("344:46: ( \';\' )?", 36, 0, input);
+ new NoViableAltException("369:46: ( \';\' )?", 39, 0, input);
throw nvae;
}
- switch (alt36) {
+ switch (alt39) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:344:46: ';'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:369:46: ';'
{
- match(input,16,FOLLOW_16_in_duration1055);
+ match(input,16,FOLLOW_16_in_duration1156);
}
break;
}
- following.push(FOLLOW_opt_eol_in_duration1058);
+ following.push(FOLLOW_opt_eol_in_duration1159);
opt_eol();
following.pop();
@@ -2247,30 +2420,30 @@ else if ( LA36_0==EOL||LA36_0==22||LA36_0==29||LA36_0==31||(LA36_0>=33 && LA36_0
// $ANTLR start normal_lhs_block
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:352:1: normal_lhs_block[AndDescr descrs] : (d= lhs )* ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:377:1: normal_lhs_block[AndDescr descrs] : (d= lhs )* ;
public void normal_lhs_block(AndDescr descrs) throws RecognitionException {
PatternDescr d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:354:17: ( (d= lhs )* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:354:17: (d= lhs )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:379:17: ( (d= lhs )* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:379:17: (d= lhs )*
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:354:17: (d= lhs )*
- loop37:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:379:17: (d= lhs )*
+ loop40:
do {
- int alt37=2;
- int LA37_0 = input.LA(1);
- if ( LA37_0==ID||LA37_0==21||(LA37_0>=51 && LA37_0<=53) ) {
- alt37=1;
+ int alt40=2;
+ int LA40_0 = input.LA(1);
+ if ( LA40_0==ID||LA40_0==21||(LA40_0>=52 && LA40_0<=54) ) {
+ alt40=1;
}
- switch (alt37) {
+ switch (alt40) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:354:25: d= lhs
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:379:25: d= lhs
{
- following.push(FOLLOW_lhs_in_normal_lhs_block1084);
+ following.push(FOLLOW_lhs_in_normal_lhs_block1185);
d=lhs();
following.pop();
@@ -2280,7 +2453,7 @@ public void normal_lhs_block(AndDescr descrs) throws RecognitionException {
break;
default :
- break loop37;
+ break loop40;
}
} while (true);
@@ -2300,25 +2473,25 @@ public void normal_lhs_block(AndDescr descrs) throws RecognitionException {
// $ANTLR start expander_lhs_block
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:362:1: expander_lhs_block[AndDescr descrs] : ( options {greedy=false; } : text= paren_chunk EOL )* ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:387:1: expander_lhs_block[AndDescr descrs] : ( options {greedy=false; } : text= paren_chunk EOL )* ;
public void expander_lhs_block(AndDescr descrs) throws RecognitionException {
String text = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:365:17: ( ( options {greedy=false; } : text= paren_chunk EOL )* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:365:17: ( options {greedy=false; } : text= paren_chunk EOL )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:390:17: ( ( options {greedy=false; } : text= paren_chunk EOL )* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:390:17: ( options {greedy=false; } : text= paren_chunk EOL )*
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:365:17: ( options {greedy=false; } : text= paren_chunk EOL )*
- loop38:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:390:17: ( options {greedy=false; } : text= paren_chunk EOL )*
+ loop41:
do {
- int alt38=2;
+ int alt41=2;
switch ( input.LA(1) ) {
case 27:
- alt38=2;
+ alt41=2;
break;
case 31:
- alt38=2;
+ alt41=2;
break;
case EOL:
case ID:
@@ -2370,20 +2543,21 @@ public void expander_lhs_block(AndDescr descrs) throws RecognitionException {
case 53:
case 54:
case 55:
- alt38=1;
+ case 56:
+ alt41=1;
break;
}
- switch (alt38) {
+ switch (alt41) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:366:25: text= paren_chunk EOL
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:391:25: text= paren_chunk EOL
{
- following.push(FOLLOW_paren_chunk_in_expander_lhs_block1130);
+ following.push(FOLLOW_paren_chunk_in_expander_lhs_block1231);
text=paren_chunk();
following.pop();
- match(input,EOL,FOLLOW_EOL_in_expander_lhs_block1132);
+ match(input,EOL,FOLLOW_EOL_in_expander_lhs_block1233);
//only expand non null
if (text != null) {
@@ -2396,7 +2570,7 @@ public void expander_lhs_block(AndDescr descrs) throws RecognitionException {
break;
default :
- break loop38;
+ break loop41;
}
} while (true);
@@ -2416,7 +2590,7 @@ public void expander_lhs_block(AndDescr descrs) throws RecognitionException {
// $ANTLR start lhs
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:381:1: lhs returns [PatternDescr d] : l= lhs_or ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:406:1: lhs returns [PatternDescr d] : l= lhs_or ;
public PatternDescr lhs() throws RecognitionException {
PatternDescr d;
PatternDescr l = null;
@@ -2426,10 +2600,10 @@ public PatternDescr lhs() throws RecognitionException {
d=null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:385:17: (l= lhs_or )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:385:17: l= lhs_or
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:410:17: (l= lhs_or )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:410:17: l= lhs_or
{
- following.push(FOLLOW_lhs_or_in_lhs1176);
+ following.push(FOLLOW_lhs_or_in_lhs1277);
l=lhs_or();
following.pop();
@@ -2450,7 +2624,7 @@ public PatternDescr lhs() throws RecognitionException {
// $ANTLR start lhs_column
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:389:1: lhs_column returns [PatternDescr d] : (f= fact_binding | f= fact );
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:414:1: lhs_column returns [PatternDescr d] : (f= fact_binding | f= fact );
public PatternDescr lhs_column() throws RecognitionException {
PatternDescr d;
PatternDescr f = null;
@@ -2460,14 +2634,14 @@ public PatternDescr lhs_column() throws RecognitionException {
d=null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:393:17: (f= fact_binding | f= fact )
- int alt39=2;
- alt39 = dfa39.predict(input);
- switch (alt39) {
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:418:17: (f= fact_binding | f= fact )
+ int alt42=2;
+ alt42 = dfa42.predict(input);
+ switch (alt42) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:393:17: f= fact_binding
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:418:17: f= fact_binding
{
- following.push(FOLLOW_fact_binding_in_lhs_column1203);
+ following.push(FOLLOW_fact_binding_in_lhs_column1304);
f=fact_binding();
following.pop();
@@ -2476,9 +2650,9 @@ public PatternDescr lhs_column() throws RecognitionException {
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:394:17: f= fact
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:419:17: f= fact
{
- following.push(FOLLOW_fact_in_lhs_column1212);
+ following.push(FOLLOW_fact_in_lhs_column1313);
f=fact();
following.pop();
@@ -2501,7 +2675,7 @@ public PatternDescr lhs_column() throws RecognitionException {
// $ANTLR start fact_binding
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:397:1: fact_binding returns [PatternDescr d] : id= ID opt_eol ':' opt_eol f= fact opt_eol ( 'or' f= fact )* ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:422:1: fact_binding returns [PatternDescr d] : id= ID opt_eol ':' opt_eol f= fact opt_eol ( 'or' f= fact )* ;
public PatternDescr fact_binding() throws RecognitionException {
PatternDescr d;
Token id=null;
@@ -2513,25 +2687,25 @@ public PatternDescr fact_binding() throws RecognitionException {
boolean multi=false;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:403:17: (id= ID opt_eol ':' opt_eol f= fact opt_eol ( 'or' f= fact )* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:403:17: id= ID opt_eol ':' opt_eol f= fact opt_eol ( 'or' f= fact )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:428:17: (id= ID opt_eol ':' opt_eol f= fact opt_eol ( 'or' f= fact )* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:428:17: id= ID opt_eol ':' opt_eol f= fact opt_eol ( 'or' f= fact )*
{
id=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_fact_binding1244);
- following.push(FOLLOW_opt_eol_in_fact_binding1254);
+ match(input,ID,FOLLOW_ID_in_fact_binding1345);
+ following.push(FOLLOW_opt_eol_in_fact_binding1355);
opt_eol();
following.pop();
- match(input,30,FOLLOW_30_in_fact_binding1256);
- following.push(FOLLOW_opt_eol_in_fact_binding1258);
+ match(input,30,FOLLOW_30_in_fact_binding1357);
+ following.push(FOLLOW_opt_eol_in_fact_binding1359);
opt_eol();
following.pop();
- following.push(FOLLOW_fact_in_fact_binding1266);
+ following.push(FOLLOW_fact_in_fact_binding1367);
f=fact();
following.pop();
- following.push(FOLLOW_opt_eol_in_fact_binding1268);
+ following.push(FOLLOW_opt_eol_in_fact_binding1369);
opt_eol();
following.pop();
@@ -2539,21 +2713,21 @@ public PatternDescr fact_binding() throws RecognitionException {
((ColumnDescr)f).setIdentifier( id.getText() );
d = f;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:411:17: ( 'or' f= fact )*
- loop40:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:436:17: ( 'or' f= fact )*
+ loop43:
do {
- int alt40=2;
- int LA40_0 = input.LA(1);
- if ( LA40_0==38 ) {
- alt40=1;
+ int alt43=2;
+ int LA43_0 = input.LA(1);
+ if ( LA43_0==39 ) {
+ alt43=1;
}
- switch (alt40) {
+ switch (alt43) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:411:25: 'or' f= fact
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:436:25: 'or' f= fact
{
- match(input,38,FOLLOW_38_in_fact_binding1280);
+ match(input,39,FOLLOW_39_in_fact_binding1381);
if ( ! multi ) {
PatternDescr first = d;
d = new OrDescr();
@@ -2561,7 +2735,7 @@ public PatternDescr fact_binding() throws RecognitionException {
multi=true;
}
- following.push(FOLLOW_fact_in_fact_binding1294);
+ following.push(FOLLOW_fact_in_fact_binding1395);
f=fact();
following.pop();
@@ -2574,7 +2748,7 @@ public PatternDescr fact_binding() throws RecognitionException {
break;
default :
- break loop40;
+ break loop43;
}
} while (true);
@@ -2594,7 +2768,7 @@ public PatternDescr fact_binding() throws RecognitionException {
// $ANTLR start fact
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:427:1: fact returns [PatternDescr d] : id= ID opt_eol '(' opt_eol (c= constraints )? opt_eol ')' opt_eol ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:452:1: fact returns [PatternDescr d] : id= ID opt_eol '(' opt_eol (c= constraints )? opt_eol ')' opt_eol ;
public PatternDescr fact() throws RecognitionException {
PatternDescr d;
Token id=null;
@@ -2605,32 +2779,32 @@ public PatternDescr fact() throws RecognitionException {
d=null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:431:17: (id= ID opt_eol '(' opt_eol (c= constraints )? opt_eol ')' opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:431:17: id= ID opt_eol '(' opt_eol (c= constraints )? opt_eol ')' opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:456:17: (id= ID opt_eol '(' opt_eol (c= constraints )? opt_eol ')' opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:456:17: id= ID opt_eol '(' opt_eol (c= constraints )? opt_eol ')' opt_eol
{
id=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_fact1334);
+ match(input,ID,FOLLOW_ID_in_fact1435);
d = new ColumnDescr( id.getText() );
d.setLocation( id.getLine(), id.getCharPositionInLine() );
- following.push(FOLLOW_opt_eol_in_fact1342);
+ following.push(FOLLOW_opt_eol_in_fact1443);
opt_eol();
following.pop();
- match(input,21,FOLLOW_21_in_fact1348);
- following.push(FOLLOW_opt_eol_in_fact1350);
+ match(input,21,FOLLOW_21_in_fact1449);
+ following.push(FOLLOW_opt_eol_in_fact1451);
opt_eol();
following.pop();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:436:29: (c= constraints )?
- int alt41=2;
- alt41 = dfa41.predict(input);
- switch (alt41) {
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:461:29: (c= constraints )?
+ int alt44=2;
+ alt44 = dfa44.predict(input);
+ switch (alt44) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:436:33: c= constraints
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:461:33: c= constraints
{
- following.push(FOLLOW_constraints_in_fact1356);
+ following.push(FOLLOW_constraints_in_fact1457);
c=constraints();
following.pop();
@@ -2645,12 +2819,12 @@ public PatternDescr fact() throws RecognitionException {
}
- following.push(FOLLOW_opt_eol_in_fact1375);
+ following.push(FOLLOW_opt_eol_in_fact1476);
opt_eol();
following.pop();
- match(input,23,FOLLOW_23_in_fact1377);
- following.push(FOLLOW_opt_eol_in_fact1379);
+ match(input,23,FOLLOW_23_in_fact1478);
+ following.push(FOLLOW_opt_eol_in_fact1480);
opt_eol();
following.pop();
@@ -2670,76 +2844,76 @@ public PatternDescr fact() throws RecognitionException {
// $ANTLR start constraints
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:447:1: constraints returns [List constraints] : opt_eol ( constraint[constraints] | predicate[constraints] ) ( opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] ) )* opt_eol ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:472:1: constraints returns [List constraints] : opt_eol ( constraint[constraints] | predicate[constraints] ) ( opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] ) )* opt_eol ;
public List constraints() throws RecognitionException {
List constraints;
constraints = new ArrayList();
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:451:17: ( opt_eol ( constraint[constraints] | predicate[constraints] ) ( opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] ) )* opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:451:17: opt_eol ( constraint[constraints] | predicate[constraints] ) ( opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] ) )* opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:476:17: ( opt_eol ( constraint[constraints] | predicate[constraints] ) ( opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] ) )* opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:476:17: opt_eol ( constraint[constraints] | predicate[constraints] ) ( opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] ) )* opt_eol
{
- following.push(FOLLOW_opt_eol_in_constraints1404);
+ following.push(FOLLOW_opt_eol_in_constraints1505);
opt_eol();
following.pop();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:452:17: ( constraint[constraints] | predicate[constraints] )
- int alt42=2;
- int LA42_0 = input.LA(1);
- if ( LA42_0==EOL ) {
- alt42=1;
- }
- else if ( LA42_0==ID ) {
- int LA42_2 = input.LA(2);
- if ( LA42_2==30 ) {
- int LA42_3 = input.LA(3);
- if ( LA42_3==ID ) {
- int LA42_8 = input.LA(4);
- if ( LA42_8==47 ) {
- alt42=2;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:477:17: ( constraint[constraints] | predicate[constraints] )
+ int alt45=2;
+ int LA45_0 = input.LA(1);
+ if ( LA45_0==EOL ) {
+ alt45=1;
+ }
+ else if ( LA45_0==ID ) {
+ int LA45_2 = input.LA(2);
+ if ( LA45_2==30 ) {
+ int LA45_3 = input.LA(3);
+ if ( LA45_3==ID ) {
+ int LA45_8 = input.LA(4);
+ if ( LA45_8==48 ) {
+ alt45=2;
}
- else if ( LA42_8==EOL||(LA42_8>=22 && LA42_8<=23)||(LA42_8>=39 && LA42_8<=46) ) {
- alt42=1;
+ else if ( LA45_8==EOL||(LA45_8>=22 && LA45_8<=23)||(LA45_8>=40 && LA45_8<=47) ) {
+ alt45=1;
}
else {
NoViableAltException nvae =
- new NoViableAltException("452:17: ( constraint[constraints] | predicate[constraints] )", 42, 8, input);
+ new NoViableAltException("477:17: ( constraint[constraints] | predicate[constraints] )", 45, 8, input);
throw nvae;
}
}
- else if ( LA42_3==EOL ) {
- alt42=1;
+ else if ( LA45_3==EOL ) {
+ alt45=1;
}
else {
NoViableAltException nvae =
- new NoViableAltException("452:17: ( constraint[constraints] | predicate[constraints] )", 42, 3, input);
+ new NoViableAltException("477:17: ( constraint[constraints] | predicate[constraints] )", 45, 3, input);
throw nvae;
}
}
- else if ( LA42_2==EOL||(LA42_2>=22 && LA42_2<=23)||(LA42_2>=39 && LA42_2<=46) ) {
- alt42=1;
+ else if ( LA45_2==EOL||(LA45_2>=22 && LA45_2<=23)||(LA45_2>=40 && LA45_2<=47) ) {
+ alt45=1;
}
else {
NoViableAltException nvae =
- new NoViableAltException("452:17: ( constraint[constraints] | predicate[constraints] )", 42, 2, input);
+ new NoViableAltException("477:17: ( constraint[constraints] | predicate[constraints] )", 45, 2, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
- new NoViableAltException("452:17: ( constraint[constraints] | predicate[constraints] )", 42, 0, input);
+ new NoViableAltException("477:17: ( constraint[constraints] | predicate[constraints] )", 45, 0, input);
throw nvae;
}
- switch (alt42) {
+ switch (alt45) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:452:18: constraint[constraints]
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:477:18: constraint[constraints]
{
- following.push(FOLLOW_constraint_in_constraints1409);
+ following.push(FOLLOW_constraint_in_constraints1510);
constraint(constraints);
following.pop();
@@ -2747,9 +2921,9 @@ else if ( LA42_2==EOL||(LA42_2>=22 && LA42_2<=23)||(LA42_2>=39 && LA42_2<=46) )
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:452:42: predicate[constraints]
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:477:42: predicate[constraints]
{
- following.push(FOLLOW_predicate_in_constraints1412);
+ following.push(FOLLOW_predicate_in_constraints1513);
predicate(constraints);
following.pop();
@@ -2759,80 +2933,80 @@ else if ( LA42_2==EOL||(LA42_2>=22 && LA42_2<=23)||(LA42_2>=39 && LA42_2<=46) )
}
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:453:17: ( opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] ) )*
- loop44:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:478:17: ( opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] ) )*
+ loop47:
do {
- int alt44=2;
- alt44 = dfa44.predict(input);
- switch (alt44) {
+ int alt47=2;
+ alt47 = dfa47.predict(input);
+ switch (alt47) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:453:19: opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:478:19: opt_eol ',' opt_eol ( constraint[constraints] | predicate[constraints] )
{
- following.push(FOLLOW_opt_eol_in_constraints1420);
+ following.push(FOLLOW_opt_eol_in_constraints1521);
opt_eol();
following.pop();
- match(input,22,FOLLOW_22_in_constraints1422);
- following.push(FOLLOW_opt_eol_in_constraints1424);
+ match(input,22,FOLLOW_22_in_constraints1523);
+ following.push(FOLLOW_opt_eol_in_constraints1525);
opt_eol();
following.pop();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:453:39: ( constraint[constraints] | predicate[constraints] )
- int alt43=2;
- int LA43_0 = input.LA(1);
- if ( LA43_0==EOL ) {
- alt43=1;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:478:39: ( constraint[constraints] | predicate[constraints] )
+ int alt46=2;
+ int LA46_0 = input.LA(1);
+ if ( LA46_0==EOL ) {
+ alt46=1;
}
- else if ( LA43_0==ID ) {
- int LA43_2 = input.LA(2);
- if ( LA43_2==30 ) {
- int LA43_3 = input.LA(3);
- if ( LA43_3==ID ) {
- int LA43_8 = input.LA(4);
- if ( LA43_8==47 ) {
- alt43=2;
+ else if ( LA46_0==ID ) {
+ int LA46_2 = input.LA(2);
+ if ( LA46_2==30 ) {
+ int LA46_3 = input.LA(3);
+ if ( LA46_3==ID ) {
+ int LA46_8 = input.LA(4);
+ if ( LA46_8==48 ) {
+ alt46=2;
}
- else if ( LA43_8==EOL||(LA43_8>=22 && LA43_8<=23)||(LA43_8>=39 && LA43_8<=46) ) {
- alt43=1;
+ else if ( LA46_8==EOL||(LA46_8>=22 && LA46_8<=23)||(LA46_8>=40 && LA46_8<=47) ) {
+ alt46=1;
}
else {
NoViableAltException nvae =
- new NoViableAltException("453:39: ( constraint[constraints] | predicate[constraints] )", 43, 8, input);
+ new NoViableAltException("478:39: ( constraint[constraints] | predicate[constraints] )", 46, 8, input);
throw nvae;
}
}
- else if ( LA43_3==EOL ) {
- alt43=1;
+ else if ( LA46_3==EOL ) {
+ alt46=1;
}
else {
NoViableAltException nvae =
- new NoViableAltException("453:39: ( constraint[constraints] | predicate[constraints] )", 43, 3, input);
+ new NoViableAltException("478:39: ( constraint[constraints] | predicate[constraints] )", 46, 3, input);
throw nvae;
}
}
- else if ( LA43_2==EOL||(LA43_2>=22 && LA43_2<=23)||(LA43_2>=39 && LA43_2<=46) ) {
- alt43=1;
+ else if ( LA46_2==EOL||(LA46_2>=22 && LA46_2<=23)||(LA46_2>=40 && LA46_2<=47) ) {
+ alt46=1;
}
else {
NoViableAltException nvae =
- new NoViableAltException("453:39: ( constraint[constraints] | predicate[constraints] )", 43, 2, input);
+ new NoViableAltException("478:39: ( constraint[constraints] | predicate[constraints] )", 46, 2, input);
throw nvae;
}
}
else {
NoViableAltException nvae =
- new NoViableAltException("453:39: ( constraint[constraints] | predicate[constraints] )", 43, 0, input);
+ new NoViableAltException("478:39: ( constraint[constraints] | predicate[constraints] )", 46, 0, input);
throw nvae;
}
- switch (alt43) {
+ switch (alt46) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:453:40: constraint[constraints]
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:478:40: constraint[constraints]
{
- following.push(FOLLOW_constraint_in_constraints1427);
+ following.push(FOLLOW_constraint_in_constraints1528);
constraint(constraints);
following.pop();
@@ -2840,9 +3014,9 @@ else if ( LA43_2==EOL||(LA43_2>=22 && LA43_2<=23)||(LA43_2>=39 && LA43_2<=46) )
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:453:64: predicate[constraints]
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:478:64: predicate[constraints]
{
- following.push(FOLLOW_predicate_in_constraints1430);
+ following.push(FOLLOW_predicate_in_constraints1531);
predicate(constraints);
following.pop();
@@ -2857,11 +3031,11 @@ else if ( LA43_2==EOL||(LA43_2>=22 && LA43_2<=23)||(LA43_2>=39 && LA43_2<=46) )
break;
default :
- break loop44;
+ break loop47;
}
} while (true);
- following.push(FOLLOW_opt_eol_in_constraints1438);
+ following.push(FOLLOW_opt_eol_in_constraints1539);
opt_eol();
following.pop();
@@ -2881,7 +3055,7 @@ else if ( LA43_2==EOL||(LA43_2>=22 && LA43_2<=23)||(LA43_2>=39 && LA43_2<=46) )
// $ANTLR start constraint
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:457:1: constraint[List constraints] : opt_eol (fb= ID opt_eol ':' opt_eol )? f= ID opt_eol (op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )? opt_eol ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:482:1: constraint[List constraints] : opt_eol (fb= ID opt_eol ':' opt_eol )? f= ID opt_eol (op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )? opt_eol ;
public void constraint(List constraints) throws RecognitionException {
Token fb=null;
Token f=null;
@@ -2896,28 +3070,28 @@ public void constraint(List constraints) throws RecognitionException {
PatternDescr d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:461:17: ( opt_eol (fb= ID opt_eol ':' opt_eol )? f= ID opt_eol (op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )? opt_eol )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:461:17: opt_eol (fb= ID opt_eol ':' opt_eol )? f= ID opt_eol (op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )? opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:486:17: ( opt_eol (fb= ID opt_eol ':' opt_eol )? f= ID opt_eol (op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )? opt_eol )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:486:17: opt_eol (fb= ID opt_eol ':' opt_eol )? f= ID opt_eol (op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )? opt_eol
{
- following.push(FOLLOW_opt_eol_in_constraint1457);
+ following.push(FOLLOW_opt_eol_in_constraint1558);
opt_eol();
following.pop();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:462:17: (fb= ID opt_eol ':' opt_eol )?
- int alt45=2;
- alt45 = dfa45.predict(input);
- switch (alt45) {
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:487:17: (fb= ID opt_eol ':' opt_eol )?
+ int alt48=2;
+ alt48 = dfa48.predict(input);
+ switch (alt48) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:462:19: fb= ID opt_eol ':' opt_eol
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:487:19: fb= ID opt_eol ':' opt_eol
{
fb=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_constraint1465);
- following.push(FOLLOW_opt_eol_in_constraint1467);
+ match(input,ID,FOLLOW_ID_in_constraint1566);
+ following.push(FOLLOW_opt_eol_in_constraint1568);
opt_eol();
following.pop();
- match(input,30,FOLLOW_30_in_constraint1469);
- following.push(FOLLOW_opt_eol_in_constraint1471);
+ match(input,30,FOLLOW_30_in_constraint1570);
+ following.push(FOLLOW_opt_eol_in_constraint1572);
opt_eol();
following.pop();
@@ -2928,7 +3102,7 @@ public void constraint(List constraints) throws RecognitionException {
}
f=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_constraint1481);
+ match(input,ID,FOLLOW_ID_in_constraint1582);
if ( fb != null ) {
//System.err.println( "fb: " + fb.getText() );
@@ -2940,72 +3114,72 @@ public void constraint(List constraints) throws RecognitionException {
constraints.add( d );
}
- following.push(FOLLOW_opt_eol_in_constraint1491);
+ following.push(FOLLOW_opt_eol_in_constraint1592);
opt_eol();
following.pop();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:475:33: (op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )?
- int alt47=2;
- int LA47_0 = input.LA(1);
- if ( (LA47_0>=39 && LA47_0<=46) ) {
- alt47=1;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:500:33: (op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )?
+ int alt50=2;
+ int LA50_0 = input.LA(1);
+ if ( (LA50_0>=40 && LA50_0<=47) ) {
+ alt50=1;
}
- else if ( LA47_0==EOL||(LA47_0>=22 && LA47_0<=23) ) {
- alt47=2;
+ else if ( LA50_0==EOL||(LA50_0>=22 && LA50_0<=23) ) {
+ alt50=2;
}
else {
NoViableAltException nvae =
- new NoViableAltException("475:33: (op= (\'==\'|\'>\'|\'>=\'|\'<\'|\'<=\'|\'!=\'|\'contains\'|\'matches\') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )?", 47, 0, input);
+ new NoViableAltException("500:33: (op= (\'==\'|\'>\'|\'>=\'|\'<\'|\'<=\'|\'!=\'|\'contains\'|\'matches\') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint ) )?", 50, 0, input);
throw nvae;
}
- switch (alt47) {
+ switch (alt50) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:475:41: op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:500:41: op= ('=='|'>'|'>='|'<'|'<='|'!='|'contains'|'matches') opt_eol (bvc= ID | lc= literal_constraint | rvc= retval_constraint )
{
op=(Token)input.LT(1);
- if ( (input.LA(1)>=39 && input.LA(1)<=46) ) {
+ if ( (input.LA(1)>=40 && input.LA(1)<=47) ) {
input.consume();
errorRecovery=false;
}
else {
MismatchedSetException mse =
new MismatchedSetException(null,input);
- recoverFromMismatchedSet(input,mse,FOLLOW_set_in_constraint1499); throw mse;
+ recoverFromMismatchedSet(input,mse,FOLLOW_set_in_constraint1600); throw mse;
}
- following.push(FOLLOW_opt_eol_in_constraint1571);
+ following.push(FOLLOW_opt_eol_in_constraint1672);
opt_eol();
following.pop();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:485:41: (bvc= ID | lc= literal_constraint | rvc= retval_constraint )
- int alt46=3;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:510:41: (bvc= ID | lc= literal_constraint | rvc= retval_constraint )
+ int alt49=3;
switch ( input.LA(1) ) {
case ID:
- alt46=1;
+ alt49=1;
break;
case INT:
case BOOL:
case STRING:
case FLOAT:
- alt46=2;
+ alt49=2;
break;
case 21:
- alt46=3;
+ alt49=3;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("485:41: (bvc= ID | lc= literal_constraint | rvc= retval_constraint )", 46, 0, input);
+ new NoViableAltException("510:41: (bvc= ID | lc= literal_constraint | rvc= retval_constraint )", 49, 0, input);
throw nvae;
}
- switch (alt46) {
+ switch (alt49) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:485:49: bvc= ID
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:510:49: bvc= ID
{
bvc=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_constraint1589);
+ match(input,ID,FOLLOW_ID_in_constraint1690);
d = new BoundVariableDescr( f.getText(), op.getText(), bvc.getText() );
d.setLocation( f.getLine(), f.getCharPositionInLine() );
@@ -3015,9 +3189,9 @@ else if ( LA47_0==EOL||(LA47_0>=22 && LA47_0<=23) ) {
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:492:49: lc= literal_constraint
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:517:49: lc= literal_constraint
{
- following.push(FOLLOW_literal_constraint_in_constraint1614);
+ following.push(FOLLOW_literal_constraint_in_constraint1715);
lc=literal_constraint();
following.pop();
@@ -3030,9 +3204,9 @@ else if ( LA47_0==EOL||(LA47_0>=22 && LA47_0<=23) ) {
}
break;
case 3 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:498:49: rvc= retval_constraint
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:523:49: rvc= retval_constraint
{
- following.push(FOLLOW_retval_constraint_in_constraint1634);
+ following.push(FOLLOW_retval_constraint_in_constraint1735);
rvc=retval_constraint();
following.pop();
@@ -3053,7 +3227,7 @@ else if ( LA47_0==EOL||(LA47_0>=22 && LA47_0<=23) ) {
}
- following.push(FOLLOW_opt_eol_in_constraint1667);
+ following.push(FOLLOW_opt_eol_in_constraint1768);
opt_eol();
following.pop();
@@ -3073,7 +3247,7 @@ else if ( LA47_0==EOL||(LA47_0>=22 && LA47_0<=23) ) {
// $ANTLR start literal_constraint
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:509:1: literal_constraint returns [String text] : (t= STRING | t= INT | t= FLOAT | t= BOOL ) ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:534:1: literal_constraint returns [String text] : (t= STRING | t= INT | t= FLOAT | t= BOOL ) ;
public String literal_constraint() throws RecognitionException {
String text;
Token t=null;
@@ -3082,64 +3256,64 @@ public String literal_constraint() throws RecognitionException {
text = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:513:17: ( (t= STRING | t= INT | t= FLOAT | t= BOOL ) )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:513:17: (t= STRING | t= INT | t= FLOAT | t= BOOL )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:538:17: ( (t= STRING | t= INT | t= FLOAT | t= BOOL ) )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:538:17: (t= STRING | t= INT | t= FLOAT | t= BOOL )
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:513:17: (t= STRING | t= INT | t= FLOAT | t= BOOL )
- int alt48=4;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:538:17: (t= STRING | t= INT | t= FLOAT | t= BOOL )
+ int alt51=4;
switch ( input.LA(1) ) {
case STRING:
- alt48=1;
+ alt51=1;
break;
case INT:
- alt48=2;
+ alt51=2;
break;
case FLOAT:
- alt48=3;
+ alt51=3;
break;
case BOOL:
- alt48=4;
+ alt51=4;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("513:17: (t= STRING | t= INT | t= FLOAT | t= BOOL )", 48, 0, input);
+ new NoViableAltException("538:17: (t= STRING | t= INT | t= FLOAT | t= BOOL )", 51, 0, input);
throw nvae;
}
- switch (alt48) {
+ switch (alt51) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:513:25: t= STRING
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:538:25: t= STRING
{
t=(Token)input.LT(1);
- match(input,STRING,FOLLOW_STRING_in_literal_constraint1694);
+ match(input,STRING,FOLLOW_STRING_in_literal_constraint1795);
text = getString( t );
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:514:25: t= INT
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:539:25: t= INT
{
t=(Token)input.LT(1);
- match(input,INT,FOLLOW_INT_in_literal_constraint1705);
+ match(input,INT,FOLLOW_INT_in_literal_constraint1806);
text = t.getText();
}
break;
case 3 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:515:25: t= FLOAT
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:540:25: t= FLOAT
{
t=(Token)input.LT(1);
- match(input,FLOAT,FOLLOW_FLOAT_in_literal_constraint1718);
+ match(input,FLOAT,FOLLOW_FLOAT_in_literal_constraint1819);
text = t.getText();
}
break;
case 4 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:516:25: t= BOOL
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:541:25: t= BOOL
{
t=(Token)input.LT(1);
- match(input,BOOL,FOLLOW_BOOL_in_literal_constraint1729);
+ match(input,BOOL,FOLLOW_BOOL_in_literal_constraint1830);
text = t.getText();
}
@@ -3163,7 +3337,7 @@ public String literal_constraint() throws RecognitionException {
// $ANTLR start retval_constraint
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:520:1: retval_constraint returns [String text] : '(' c= paren_chunk ')' ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:545:1: retval_constraint returns [String text] : '(' c= paren_chunk ')' ;
public String retval_constraint() throws RecognitionException {
String text;
String c = null;
@@ -3173,15 +3347,15 @@ public String retval_constraint() throws RecognitionException {
text = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:525:17: ( '(' c= paren_chunk ')' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:525:17: '(' c= paren_chunk ')'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:550:17: ( '(' c= paren_chunk ')' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:550:17: '(' c= paren_chunk ')'
{
- match(input,21,FOLLOW_21_in_retval_constraint1762);
- following.push(FOLLOW_paren_chunk_in_retval_constraint1766);
+ match(input,21,FOLLOW_21_in_retval_constraint1863);
+ following.push(FOLLOW_paren_chunk_in_retval_constraint1867);
c=paren_chunk();
following.pop();
- match(input,23,FOLLOW_23_in_retval_constraint1768);
+ match(input,23,FOLLOW_23_in_retval_constraint1869);
text = c;
}
@@ -3199,7 +3373,7 @@ public String retval_constraint() throws RecognitionException {
// $ANTLR start predicate
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:528:1: predicate[List constraints] : decl= ID ':' field= ID '->' '(' text= paren_chunk ')' ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:553:1: predicate[List constraints] : decl= ID ':' field= ID '->' '(' text= paren_chunk ')' ;
public void predicate(List constraints) throws RecognitionException {
Token decl=null;
Token field=null;
@@ -3207,21 +3381,21 @@ public void predicate(List constraints) throws RecognitionException {
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:530:17: (decl= ID ':' field= ID '->' '(' text= paren_chunk ')' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:530:17: decl= ID ':' field= ID '->' '(' text= paren_chunk ')'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:555:17: (decl= ID ':' field= ID '->' '(' text= paren_chunk ')' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:555:17: decl= ID ':' field= ID '->' '(' text= paren_chunk ')'
{
decl=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_predicate1786);
- match(input,30,FOLLOW_30_in_predicate1788);
+ match(input,ID,FOLLOW_ID_in_predicate1887);
+ match(input,30,FOLLOW_30_in_predicate1889);
field=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_predicate1792);
- match(input,47,FOLLOW_47_in_predicate1794);
- match(input,21,FOLLOW_21_in_predicate1796);
- following.push(FOLLOW_paren_chunk_in_predicate1800);
+ match(input,ID,FOLLOW_ID_in_predicate1893);
+ match(input,48,FOLLOW_48_in_predicate1895);
+ match(input,21,FOLLOW_21_in_predicate1897);
+ following.push(FOLLOW_paren_chunk_in_predicate1901);
text=paren_chunk();
following.pop();
- match(input,23,FOLLOW_23_in_predicate1802);
+ match(input,23,FOLLOW_23_in_predicate1903);
PredicateDescr d = new PredicateDescr(field.getText(), decl.getText(), text );
constraints.add( d );
@@ -3242,7 +3416,7 @@ public void predicate(List constraints) throws RecognitionException {
// $ANTLR start paren_chunk
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:537:1: paren_chunk returns [String text] : ( options {greedy=false; } : '(' c= paren_chunk ')' | any= . )* ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:562:1: paren_chunk returns [String text] : ( options {greedy=false; } : '(' c= paren_chunk ')' | any= . )* ;
public String paren_chunk() throws RecognitionException {
String text;
Token any=null;
@@ -3253,22 +3427,22 @@ public String paren_chunk() throws RecognitionException {
text = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:543:17: ( ( options {greedy=false; } : '(' c= paren_chunk ')' | any= . )* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:543:17: ( options {greedy=false; } : '(' c= paren_chunk ')' | any= . )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:568:17: ( ( options {greedy=false; } : '(' c= paren_chunk ')' | any= . )* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:568:17: ( options {greedy=false; } : '(' c= paren_chunk ')' | any= . )*
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:543:17: ( options {greedy=false; } : '(' c= paren_chunk ')' | any= . )*
- loop49:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:568:17: ( options {greedy=false; } : '(' c= paren_chunk ')' | any= . )*
+ loop52:
do {
- int alt49=3;
+ int alt52=3;
switch ( input.LA(1) ) {
case EOL:
- alt49=3;
+ alt52=3;
break;
case 23:
- alt49=3;
+ alt52=3;
break;
case 21:
- alt49=1;
+ alt52=1;
break;
case ID:
case INT:
@@ -3319,21 +3493,22 @@ public String paren_chunk() throws RecognitionException {
case 53:
case 54:
case 55:
- alt49=2;
+ case 56:
+ alt52=2;
break;
}
- switch (alt49) {
+ switch (alt52) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:544:25: '(' c= paren_chunk ')'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:569:25: '(' c= paren_chunk ')'
{
- match(input,21,FOLLOW_21_in_paren_chunk1847);
- following.push(FOLLOW_paren_chunk_in_paren_chunk1851);
+ match(input,21,FOLLOW_21_in_paren_chunk1948);
+ following.push(FOLLOW_paren_chunk_in_paren_chunk1952);
c=paren_chunk();
following.pop();
- match(input,23,FOLLOW_23_in_paren_chunk1853);
+ match(input,23,FOLLOW_23_in_paren_chunk1954);
//System.err.println( "chunk [" + c + "]" );
if ( c == null ) {
@@ -3349,7 +3524,7 @@ public String paren_chunk() throws RecognitionException {
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:556:19: any= .
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:581:19: any= .
{
any=(Token)input.LT(1);
matchAny(input);
@@ -3366,7 +3541,7 @@ public String paren_chunk() throws RecognitionException {
break;
default :
- break loop49;
+ break loop52;
}
} while (true);
@@ -3386,7 +3561,7 @@ public String paren_chunk() throws RecognitionException {
// $ANTLR start curly_chunk
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:568:1: curly_chunk returns [String text] : ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:593:1: curly_chunk returns [String text] : ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* ;
public String curly_chunk() throws RecognitionException {
String text;
Token any=null;
@@ -3397,19 +3572,19 @@ public String curly_chunk() throws RecognitionException {
text = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:574:17: ( ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:574:17: ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:599:17: ( ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:599:17: ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )*
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:574:17: ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )*
- loop50:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:599:17: ( options {greedy=false; } : '{' c= curly_chunk '}' | any= . )*
+ loop53:
do {
- int alt50=3;
+ int alt53=3;
switch ( input.LA(1) ) {
case 25:
- alt50=3;
+ alt53=3;
break;
case 24:
- alt50=1;
+ alt53=1;
break;
case EOL:
case ID:
@@ -3461,21 +3636,22 @@ public String curly_chunk() throws RecognitionException {
case 53:
case 54:
case 55:
- alt50=2;
+ case 56:
+ alt53=2;
break;
}
- switch (alt50) {
+ switch (alt53) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:575:25: '{' c= curly_chunk '}'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:600:25: '{' c= curly_chunk '}'
{
- match(input,24,FOLLOW_24_in_curly_chunk1921);
- following.push(FOLLOW_curly_chunk_in_curly_chunk1925);
+ match(input,24,FOLLOW_24_in_curly_chunk2022);
+ following.push(FOLLOW_curly_chunk_in_curly_chunk2026);
c=curly_chunk();
following.pop();
- match(input,25,FOLLOW_25_in_curly_chunk1927);
+ match(input,25,FOLLOW_25_in_curly_chunk2028);
//System.err.println( "chunk [" + c + "]" );
if ( c == null ) {
@@ -3491,7 +3667,7 @@ public String curly_chunk() throws RecognitionException {
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:587:19: any= .
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:612:19: any= .
{
any=(Token)input.LT(1);
matchAny(input);
@@ -3508,7 +3684,7 @@ public String curly_chunk() throws RecognitionException {
break;
default :
- break loop50;
+ break loop53;
}
} while (true);
@@ -3528,7 +3704,7 @@ public String curly_chunk() throws RecognitionException {
// $ANTLR start lhs_or
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:599:1: lhs_or returns [PatternDescr d] : left= lhs_and ( ('or'|'||')right= lhs_and )* ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:624:1: lhs_or returns [PatternDescr d] : left= lhs_and ( ('or'|'||')right= lhs_and )* ;
public PatternDescr lhs_or() throws RecognitionException {
PatternDescr d;
PatternDescr left = null;
@@ -3540,40 +3716,40 @@ public PatternDescr lhs_or() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:604:17: (left= lhs_and ( ('or'|'||')right= lhs_and )* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:604:17: left= lhs_and ( ('or'|'||')right= lhs_and )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:629:17: (left= lhs_and ( ('or'|'||')right= lhs_and )* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:629:17: left= lhs_and ( ('or'|'||')right= lhs_and )*
{
OrDescr or = null;
- following.push(FOLLOW_lhs_and_in_lhs_or1985);
+ following.push(FOLLOW_lhs_and_in_lhs_or2086);
left=lhs_and();
following.pop();
d = left;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:606:17: ( ('or'|'||')right= lhs_and )*
- loop51:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:631:17: ( ('or'|'||')right= lhs_and )*
+ loop54:
do {
- int alt51=2;
- int LA51_0 = input.LA(1);
- if ( LA51_0==38||LA51_0==48 ) {
- alt51=1;
+ int alt54=2;
+ int LA54_0 = input.LA(1);
+ if ( LA54_0==39||LA54_0==49 ) {
+ alt54=1;
}
- switch (alt51) {
+ switch (alt54) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:606:25: ('or'|'||')right= lhs_and
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:631:25: ('or'|'||')right= lhs_and
{
- if ( input.LA(1)==38||input.LA(1)==48 ) {
+ if ( input.LA(1)==39||input.LA(1)==49 ) {
input.consume();
errorRecovery=false;
}
else {
MismatchedSetException mse =
new MismatchedSetException(null,input);
- recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_or1995); throw mse;
+ recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_or2096); throw mse;
}
- following.push(FOLLOW_lhs_and_in_lhs_or2006);
+ following.push(FOLLOW_lhs_and_in_lhs_or2107);
right=lhs_and();
following.pop();
@@ -3591,7 +3767,7 @@ public PatternDescr lhs_or() throws RecognitionException {
break;
default :
- break loop51;
+ break loop54;
}
} while (true);
@@ -3611,7 +3787,7 @@ public PatternDescr lhs_or() throws RecognitionException {
// $ANTLR start lhs_and
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:620:1: lhs_and returns [PatternDescr d] : left= lhs_unary ( ('and'|'&&')right= lhs_unary )* ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:645:1: lhs_and returns [PatternDescr d] : left= lhs_unary ( ('and'|'&&')right= lhs_unary )* ;
public PatternDescr lhs_and() throws RecognitionException {
PatternDescr d;
PatternDescr left = null;
@@ -3623,40 +3799,40 @@ public PatternDescr lhs_and() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:625:17: (left= lhs_unary ( ('and'|'&&')right= lhs_unary )* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:625:17: left= lhs_unary ( ('and'|'&&')right= lhs_unary )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:650:17: (left= lhs_unary ( ('and'|'&&')right= lhs_unary )* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:650:17: left= lhs_unary ( ('and'|'&&')right= lhs_unary )*
{
AndDescr and = null;
- following.push(FOLLOW_lhs_unary_in_lhs_and2046);
+ following.push(FOLLOW_lhs_unary_in_lhs_and2147);
left=lhs_unary();
following.pop();
d = left;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:627:17: ( ('and'|'&&')right= lhs_unary )*
- loop52:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:652:17: ( ('and'|'&&')right= lhs_unary )*
+ loop55:
do {
- int alt52=2;
- int LA52_0 = input.LA(1);
- if ( (LA52_0>=49 && LA52_0<=50) ) {
- alt52=1;
+ int alt55=2;
+ int LA55_0 = input.LA(1);
+ if ( (LA55_0>=50 && LA55_0<=51) ) {
+ alt55=1;
}
- switch (alt52) {
+ switch (alt55) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:627:25: ('and'|'&&')right= lhs_unary
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:652:25: ('and'|'&&')right= lhs_unary
{
- if ( (input.LA(1)>=49 && input.LA(1)<=50) ) {
+ if ( (input.LA(1)>=50 && input.LA(1)<=51) ) {
input.consume();
errorRecovery=false;
}
else {
MismatchedSetException mse =
new MismatchedSetException(null,input);
- recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_and2055); throw mse;
+ recoverFromMismatchedSet(input,mse,FOLLOW_set_in_lhs_and2156); throw mse;
}
- following.push(FOLLOW_lhs_unary_in_lhs_and2066);
+ following.push(FOLLOW_lhs_unary_in_lhs_and2167);
right=lhs_unary();
following.pop();
@@ -3674,7 +3850,7 @@ public PatternDescr lhs_and() throws RecognitionException {
break;
default :
- break loop52;
+ break loop55;
}
} while (true);
@@ -3694,7 +3870,7 @@ public PatternDescr lhs_and() throws RecognitionException {
// $ANTLR start lhs_unary
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:641:1: lhs_unary returns [PatternDescr d] : (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:666:1: lhs_unary returns [PatternDescr d] : (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) ;
public PatternDescr lhs_unary() throws RecognitionException {
PatternDescr d;
PatternDescr u = null;
@@ -3704,39 +3880,39 @@ public PatternDescr lhs_unary() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:645:17: ( (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:645:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:670:17: ( (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' ) )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:670:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' )
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:645:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' )
- int alt53=5;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:670:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | '(' u= lhs ')' )
+ int alt56=5;
switch ( input.LA(1) ) {
- case 51:
- alt53=1;
- break;
case 52:
- alt53=2;
+ alt56=1;
break;
case 53:
- alt53=3;
+ alt56=2;
+ break;
+ case 54:
+ alt56=3;
break;
case ID:
- alt53=4;
+ alt56=4;
break;
case 21:
- alt53=5;
+ alt56=5;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("645:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | \'(\' u= lhs \')\' )", 53, 0, input);
+ new NoViableAltException("670:17: (u= lhs_exist | u= lhs_not | u= lhs_eval | u= lhs_column | \'(\' u= lhs \')\' )", 56, 0, input);
throw nvae;
}
- switch (alt53) {
+ switch (alt56) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:645:25: u= lhs_exist
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:670:25: u= lhs_exist
{
- following.push(FOLLOW_lhs_exist_in_lhs_unary2104);
+ following.push(FOLLOW_lhs_exist_in_lhs_unary2205);
u=lhs_exist();
following.pop();
@@ -3744,9 +3920,9 @@ public PatternDescr lhs_unary() throws RecognitionException {
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:646:25: u= lhs_not
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:671:25: u= lhs_not
{
- following.push(FOLLOW_lhs_not_in_lhs_unary2112);
+ following.push(FOLLOW_lhs_not_in_lhs_unary2213);
u=lhs_not();
following.pop();
@@ -3754,9 +3930,9 @@ public PatternDescr lhs_unary() throws RecognitionException {
}
break;
case 3 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:647:25: u= lhs_eval
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:672:25: u= lhs_eval
{
- following.push(FOLLOW_lhs_eval_in_lhs_unary2120);
+ following.push(FOLLOW_lhs_eval_in_lhs_unary2221);
u=lhs_eval();
following.pop();
@@ -3764,9 +3940,9 @@ public PatternDescr lhs_unary() throws RecognitionException {
}
break;
case 4 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:648:25: u= lhs_column
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:673:25: u= lhs_column
{
- following.push(FOLLOW_lhs_column_in_lhs_unary2128);
+ following.push(FOLLOW_lhs_column_in_lhs_unary2229);
u=lhs_column();
following.pop();
@@ -3774,14 +3950,14 @@ public PatternDescr lhs_unary() throws RecognitionException {
}
break;
case 5 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:649:25: '(' u= lhs ')'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:674:25: '(' u= lhs ')'
{
- match(input,21,FOLLOW_21_in_lhs_unary2134);
- following.push(FOLLOW_lhs_in_lhs_unary2138);
+ match(input,21,FOLLOW_21_in_lhs_unary2235);
+ following.push(FOLLOW_lhs_in_lhs_unary2239);
u=lhs();
following.pop();
- match(input,23,FOLLOW_23_in_lhs_unary2140);
+ match(input,23,FOLLOW_23_in_lhs_unary2241);
}
break;
@@ -3805,7 +3981,7 @@ public PatternDescr lhs_unary() throws RecognitionException {
// $ANTLR start lhs_exist
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:653:1: lhs_exist returns [PatternDescr d] : loc= 'exists' column= lhs_column ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:678:1: lhs_exist returns [PatternDescr d] : loc= 'exists' column= lhs_column ;
public PatternDescr lhs_exist() throws RecognitionException {
PatternDescr d;
Token loc=null;
@@ -3816,12 +3992,12 @@ public PatternDescr lhs_exist() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:657:17: (loc= 'exists' column= lhs_column )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:657:17: loc= 'exists' column= lhs_column
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:682:17: (loc= 'exists' column= lhs_column )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:682:17: loc= 'exists' column= lhs_column
{
loc=(Token)input.LT(1);
- match(input,51,FOLLOW_51_in_lhs_exist2170);
- following.push(FOLLOW_lhs_column_in_lhs_exist2174);
+ match(input,52,FOLLOW_52_in_lhs_exist2271);
+ following.push(FOLLOW_lhs_column_in_lhs_exist2275);
column=lhs_column();
following.pop();
@@ -3845,7 +4021,7 @@ public PatternDescr lhs_exist() throws RecognitionException {
// $ANTLR start lhs_not
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:664:1: lhs_not returns [NotDescr d] : loc= 'not' column= lhs_column ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:689:1: lhs_not returns [NotDescr d] : loc= 'not' column= lhs_column ;
public NotDescr lhs_not() throws RecognitionException {
NotDescr d;
Token loc=null;
@@ -3856,12 +4032,12 @@ public NotDescr lhs_not() throws RecognitionException {
d = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:668:17: (loc= 'not' column= lhs_column )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:668:17: loc= 'not' column= lhs_column
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:693:17: (loc= 'not' column= lhs_column )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:693:17: loc= 'not' column= lhs_column
{
loc=(Token)input.LT(1);
- match(input,52,FOLLOW_52_in_lhs_not2204);
- following.push(FOLLOW_lhs_column_in_lhs_not2208);
+ match(input,53,FOLLOW_53_in_lhs_not2305);
+ following.push(FOLLOW_lhs_column_in_lhs_not2309);
column=lhs_column();
following.pop();
@@ -3885,7 +4061,7 @@ public NotDescr lhs_not() throws RecognitionException {
// $ANTLR start lhs_eval
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:675:1: lhs_eval returns [PatternDescr d] : 'eval' '(' c= paren_chunk ')' ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:700:1: lhs_eval returns [PatternDescr d] : 'eval' '(' c= paren_chunk ')' ;
public PatternDescr lhs_eval() throws RecognitionException {
PatternDescr d;
String c = null;
@@ -3896,16 +4072,16 @@ public PatternDescr lhs_eval() throws RecognitionException {
String text = "";
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:680:17: ( 'eval' '(' c= paren_chunk ')' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:680:17: 'eval' '(' c= paren_chunk ')'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:705:17: ( 'eval' '(' c= paren_chunk ')' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:705:17: 'eval' '(' c= paren_chunk ')'
{
- match(input,53,FOLLOW_53_in_lhs_eval2234);
- match(input,21,FOLLOW_21_in_lhs_eval2236);
- following.push(FOLLOW_paren_chunk_in_lhs_eval2240);
+ match(input,54,FOLLOW_54_in_lhs_eval2335);
+ match(input,21,FOLLOW_21_in_lhs_eval2337);
+ following.push(FOLLOW_paren_chunk_in_lhs_eval2341);
c=paren_chunk();
following.pop();
- match(input,23,FOLLOW_23_in_lhs_eval2242);
+ match(input,23,FOLLOW_23_in_lhs_eval2343);
d = new EvalDescr( c );
}
@@ -3923,7 +4099,7 @@ public PatternDescr lhs_eval() throws RecognitionException {
// $ANTLR start dotted_name
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:684:1: dotted_name returns [String name] : id= ID ( '.' id= ID )* ;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:709:1: dotted_name returns [String name] : id= ID ( '.' id= ID )* ;
public String dotted_name() throws RecognitionException {
String name;
Token id=null;
@@ -3932,36 +4108,36 @@ public String dotted_name() throws RecognitionException {
name = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:689:17: (id= ID ( '.' id= ID )* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:689:17: id= ID ( '.' id= ID )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:714:17: (id= ID ( '.' id= ID )* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:714:17: id= ID ( '.' id= ID )*
{
id=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_dotted_name2274);
+ match(input,ID,FOLLOW_ID_in_dotted_name2375);
name=id.getText();
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:689:46: ( '.' id= ID )*
- loop54:
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:714:46: ( '.' id= ID )*
+ loop57:
do {
- int alt54=2;
- int LA54_0 = input.LA(1);
- if ( LA54_0==54 ) {
- alt54=1;
+ int alt57=2;
+ int LA57_0 = input.LA(1);
+ if ( LA57_0==55 ) {
+ alt57=1;
}
- switch (alt54) {
+ switch (alt57) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:689:48: '.' id= ID
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:714:48: '.' id= ID
{
- match(input,54,FOLLOW_54_in_dotted_name2280);
+ match(input,55,FOLLOW_55_in_dotted_name2381);
id=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_dotted_name2284);
+ match(input,ID,FOLLOW_ID_in_dotted_name2385);
name = name + "." + id.getText();
}
break;
default :
- break loop54;
+ break loop57;
}
} while (true);
@@ -3981,7 +4157,7 @@ public String dotted_name() throws RecognitionException {
// $ANTLR start word
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:693:1: word returns [String word] : (id= ID | 'import' | 'use' | 'rule' | 'query' | 'salience' | 'no-loop' | 'when' | 'then' | 'end' | str= STRING );
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:718:1: word returns [String word] : (id= ID | 'import' | 'use' | 'rule' | 'query' | 'salience' | 'no-loop' | 'when' | 'then' | 'end' | str= STRING );
public String word() throws RecognitionException {
String word;
Token id=null;
@@ -3991,136 +4167,136 @@ public String word() throws RecognitionException {
word = null;
try {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:697:17: (id= ID | 'import' | 'use' | 'rule' | 'query' | 'salience' | 'no-loop' | 'when' | 'then' | 'end' | str= STRING )
- int alt55=11;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:722:17: (id= ID | 'import' | 'use' | 'rule' | 'query' | 'salience' | 'no-loop' | 'when' | 'then' | 'end' | str= STRING )
+ int alt58=11;
switch ( input.LA(1) ) {
case ID:
- alt55=1;
+ alt58=1;
break;
case 17:
- alt55=2;
+ alt58=2;
break;
- case 55:
- alt55=3;
+ case 56:
+ alt58=3;
break;
case 28:
- alt55=4;
+ alt58=4;
break;
case 26:
- alt55=5;
+ alt58=5;
break;
case 33:
- alt55=6;
+ alt58=6;
break;
case 34:
- alt55=7;
+ alt58=7;
break;
case 29:
- alt55=8;
+ alt58=8;
break;
case 31:
- alt55=9;
+ alt58=9;
break;
case 27:
- alt55=10;
+ alt58=10;
break;
case STRING:
- alt55=11;
+ alt58=11;
break;
default:
NoViableAltException nvae =
- new NoViableAltException("693:1: word returns [String word] : (id= ID | \'import\' | \'use\' | \'rule\' | \'query\' | \'salience\' | \'no-loop\' | \'when\' | \'then\' | \'end\' | str= STRING );", 55, 0, input);
+ new NoViableAltException("718:1: word returns [String word] : (id= ID | \'import\' | \'use\' | \'rule\' | \'query\' | \'salience\' | \'no-loop\' | \'when\' | \'then\' | \'end\' | str= STRING );", 58, 0, input);
throw nvae;
}
- switch (alt55) {
+ switch (alt58) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:697:17: id= ID
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:722:17: id= ID
{
id=(Token)input.LT(1);
- match(input,ID,FOLLOW_ID_in_word2314);
+ match(input,ID,FOLLOW_ID_in_word2415);
word=id.getText();
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:698:17: 'import'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:723:17: 'import'
{
- match(input,17,FOLLOW_17_in_word2326);
+ match(input,17,FOLLOW_17_in_word2427);
word="import";
}
break;
case 3 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:699:17: 'use'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:724:17: 'use'
{
- match(input,55,FOLLOW_55_in_word2335);
+ match(input,56,FOLLOW_56_in_word2436);
word="use";
}
break;
case 4 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:700:17: 'rule'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:725:17: 'rule'
{
- match(input,28,FOLLOW_28_in_word2347);
+ match(input,28,FOLLOW_28_in_word2448);
word="rule";
}
break;
case 5 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:701:17: 'query'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:726:17: 'query'
{
- match(input,26,FOLLOW_26_in_word2358);
+ match(input,26,FOLLOW_26_in_word2459);
word="query";
}
break;
case 6 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:702:17: 'salience'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:727:17: 'salience'
{
- match(input,33,FOLLOW_33_in_word2368);
+ match(input,33,FOLLOW_33_in_word2469);
word="salience";
}
break;
case 7 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:703:17: 'no-loop'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:728:17: 'no-loop'
{
- match(input,34,FOLLOW_34_in_word2376);
+ match(input,34,FOLLOW_34_in_word2477);
word="no-loop";
}
break;
case 8 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:704:17: 'when'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:729:17: 'when'
{
- match(input,29,FOLLOW_29_in_word2384);
+ match(input,29,FOLLOW_29_in_word2485);
word="when";
}
break;
case 9 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:705:17: 'then'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:730:17: 'then'
{
- match(input,31,FOLLOW_31_in_word2395);
+ match(input,31,FOLLOW_31_in_word2496);
word="then";
}
break;
case 10 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:706:17: 'end'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:731:17: 'end'
{
- match(input,27,FOLLOW_27_in_word2406);
+ match(input,27,FOLLOW_27_in_word2507);
word="end";
}
break;
case 11 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:707:17: str= STRING
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:732:17: str= STRING
{
str=(Token)input.LT(1);
- match(input,STRING,FOLLOW_STRING_in_word2420);
+ match(input,STRING,FOLLOW_STRING_in_word2521);
word=getString(str);
}
@@ -4139,7 +4315,7 @@ public String word() throws RecognitionException {
// $ANTLR end word
- protected DFA2 dfa2 = new DFA2();protected DFA13 dfa13 = new DFA13();protected DFA14 dfa14 = new DFA14();protected DFA15 dfa15 = new DFA15();protected DFA39 dfa39 = new DFA39();protected DFA41 dfa41 = new DFA41();protected DFA44 dfa44 = new DFA44();protected DFA45 dfa45 = new DFA45();
+ protected DFA2 dfa2 = new DFA2();protected DFA13 dfa13 = new DFA13();protected DFA14 dfa14 = new DFA14();protected DFA15 dfa15 = new DFA15();protected DFA42 dfa42 = new DFA42();protected DFA44 dfa44 = new DFA44();protected DFA47 dfa47 = new DFA47();protected DFA48 dfa48 = new DFA48();
class DFA2 extends DFA {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
@@ -4193,19 +4369,19 @@ public DFA.State transition(IntStream input) throws RecognitionException {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
}
- DFA.State s5 = new DFA.State() {{alt=1;}};
DFA.State s2 = new DFA.State() {{alt=2;}};
+ DFA.State s5 = new DFA.State() {{alt=1;}};
DFA.State s3 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
- case ID:
- return s5;
+ case 21:
+ return s2;
case EOL:
return s3;
- case 21:
- return s2;
+ case ID:
+ return s5;
default:
NoViableAltException nvae =
@@ -4224,7 +4400,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
return s2;
case ID:
- case 54:
+ case 55:
return s5;
default:
@@ -4251,16 +4427,16 @@ public DFA.State transition(IntStream input) throws RecognitionException {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
}
- DFA.State s6 = new DFA.State() {{alt=1;}};
+ DFA.State s3 = new DFA.State() {{alt=1;}};
DFA.State s2 = new DFA.State() {{alt=2;}};
- DFA.State s3 = new DFA.State() {
+ DFA.State s4 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
case ID:
- return s6;
+ return s3;
case EOL:
- return s3;
+ return s4;
case 22:
case 23:
@@ -4268,7 +4444,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
default:
NoViableAltException nvae =
- new NoViableAltException("", 14, 3, input);
+ new NoViableAltException("", 14, 4, input);
throw nvae; }
}
@@ -4276,17 +4452,17 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s1 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
- case EOL:
+ case ID:
+ case 55:
return s3;
+ case EOL:
+ return s4;
+
case 22:
case 23:
return s2;
- case ID:
- case 54:
- return s6;
-
default:
NoViableAltException nvae =
new NoViableAltException("", 14, 1, input);
@@ -4311,20 +4487,20 @@ public DFA.State transition(IntStream input) throws RecognitionException {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
}
- DFA.State s2 = new DFA.State() {{alt=2;}};
DFA.State s6 = new DFA.State() {{alt=1;}};
+ DFA.State s2 = new DFA.State() {{alt=2;}};
DFA.State s3 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
- case 22:
- case 23:
- return s2;
+ case ID:
+ return s6;
case EOL:
return s3;
- case ID:
- return s6;
+ case 22:
+ case 23:
+ return s2;
default:
NoViableAltException nvae =
@@ -4344,7 +4520,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
return s2;
case ID:
- case 54:
+ case 55:
return s6;
default:
@@ -4367,7 +4543,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
- }class DFA39 extends DFA {
+ }class DFA42 extends DFA {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
}
@@ -4387,7 +4563,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
default:
NoViableAltException nvae =
- new NoViableAltException("", 39, 2, input);
+ new NoViableAltException("", 42, 2, input);
throw nvae; }
}
@@ -4406,24 +4582,24 @@ public DFA.State transition(IntStream input) throws RecognitionException {
default:
NoViableAltException nvae =
- new NoViableAltException("", 39, 1, input);
+ new NoViableAltException("", 42, 1, input);
throw nvae; }
}
};
DFA.State s0 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA39_0 = input.LA(1);
- if ( LA39_0==ID ) {return s1;}
+ int LA42_0 = input.LA(1);
+ if ( LA42_0==ID ) {return s1;}
NoViableAltException nvae =
- new NoViableAltException("", 39, 0, input);
+ new NoViableAltException("", 42, 0, input);
throw nvae;
}
};
- }class DFA41 extends DFA {
+ }class DFA44 extends DFA {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
}
@@ -4443,7 +4619,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
default:
NoViableAltException nvae =
- new NoViableAltException("", 41, 1, input);
+ new NoViableAltException("", 44, 1, input);
throw nvae; }
}
@@ -4462,33 +4638,33 @@ public DFA.State transition(IntStream input) throws RecognitionException {
default:
NoViableAltException nvae =
- new NoViableAltException("", 41, 0, input);
+ new NoViableAltException("", 44, 0, input);
throw nvae; }
}
};
- }class DFA44 extends DFA {
+ }class DFA47 extends DFA {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
}
- DFA.State s2 = new DFA.State() {{alt=2;}};
DFA.State s3 = new DFA.State() {{alt=1;}};
+ DFA.State s2 = new DFA.State() {{alt=2;}};
DFA.State s1 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
- case 23:
- return s2;
+ case 22:
+ return s3;
case EOL:
return s1;
- case 22:
- return s3;
+ case 23:
+ return s2;
default:
NoViableAltException nvae =
- new NoViableAltException("", 44, 1, input);
+ new NoViableAltException("", 47, 1, input);
throw nvae; }
}
@@ -4507,13 +4683,13 @@ public DFA.State transition(IntStream input) throws RecognitionException {
default:
NoViableAltException nvae =
- new NoViableAltException("", 44, 0, input);
+ new NoViableAltException("", 47, 0, input);
throw nvae; }
}
};
- }class DFA45 extends DFA {
+ }class DFA48 extends DFA {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
}
@@ -4524,7 +4700,6 @@ public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
case 22:
case 23:
- case 39:
case 40:
case 41:
case 42:
@@ -4532,6 +4707,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
case 44:
case 45:
case 46:
+ case 47:
return s4;
case EOL:
@@ -4542,7 +4718,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
default:
NoViableAltException nvae =
- new NoViableAltException("", 45, 2, input);
+ new NoViableAltException("", 48, 2, input);
throw nvae; }
}
@@ -4558,7 +4734,6 @@ public DFA.State transition(IntStream input) throws RecognitionException {
case 22:
case 23:
- case 39:
case 40:
case 41:
case 42:
@@ -4566,22 +4741,23 @@ public DFA.State transition(IntStream input) throws RecognitionException {
case 44:
case 45:
case 46:
+ case 47:
return s4;
default:
NoViableAltException nvae =
- new NoViableAltException("", 45, 1, input);
+ new NoViableAltException("", 48, 1, input);
throw nvae; }
}
};
DFA.State s0 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA45_0 = input.LA(1);
- if ( LA45_0==ID ) {return s1;}
+ int LA48_0 = input.LA(1);
+ if ( LA48_0==ID ) {return s1;}
NoViableAltException nvae =
- new NoViableAltException("", 45, 0, input);
+ new NoViableAltException("", 48, 0, input);
throw nvae;
}
@@ -4641,172 +4817,182 @@ public DFA.State transition(IntStream input) throws RecognitionException {
public static final BitSet FOLLOW_opt_eol_in_function382 = new BitSet(new long[]{0x0000000000C00000L});
public static final BitSet FOLLOW_23_in_function407 = new BitSet(new long[]{0x0000000000000012L});
public static final BitSet FOLLOW_opt_eol_in_function411 = new BitSet(new long[]{0x0000000001000000L});
- public static final BitSet FOLLOW_24_in_function415 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_24_in_function415 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
public static final BitSet FOLLOW_curly_chunk_in_function422 = new BitSet(new long[]{0x0000000002000000L});
public static final BitSet FOLLOW_25_in_function431 = new BitSet(new long[]{0x0000000000000012L});
public static final BitSet FOLLOW_opt_eol_in_function439 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_opt_eol_in_query463 = new BitSet(new long[]{0x0000000004000000L});
- public static final BitSet FOLLOW_26_in_query469 = new BitSet(new long[]{0x00800006BC020120L});
+ public static final BitSet FOLLOW_26_in_query469 = new BitSet(new long[]{0x01000006BC020120L});
public static final BitSet FOLLOW_word_in_query473 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_query475 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_opt_eol_in_query475 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
public static final BitSet FOLLOW_expander_lhs_block_in_query491 = new BitSet(new long[]{0x0000000008000000L});
public static final BitSet FOLLOW_normal_lhs_block_in_query499 = new BitSet(new long[]{0x0000000008000000L});
public static final BitSet FOLLOW_27_in_query514 = new BitSet(new long[]{0x0000000000000012L});
public static final BitSet FOLLOW_opt_eol_in_query516 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_opt_eol_in_rule539 = new BitSet(new long[]{0x0000000010000000L});
- public static final BitSet FOLLOW_28_in_rule545 = new BitSet(new long[]{0x00800006BC020120L});
+ public static final BitSet FOLLOW_28_in_rule545 = new BitSet(new long[]{0x01000006BC020120L});
public static final BitSet FOLLOW_word_in_rule549 = new BitSet(new long[]{0x0000000000000012L});
public static final BitSet FOLLOW_opt_eol_in_rule551 = new BitSet(new long[]{0x0000000140000012L});
public static final BitSet FOLLOW_rule_attributes_in_rule562 = new BitSet(new long[]{0x0000000000000012L});
public static final BitSet FOLLOW_opt_eol_in_rule572 = new BitSet(new long[]{0x00000000A0000000L});
public static final BitSet FOLLOW_29_in_rule580 = new BitSet(new long[]{0x0000000040000012L});
public static final BitSet FOLLOW_30_in_rule582 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_rule585 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_opt_eol_in_rule585 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
public static final BitSet FOLLOW_expander_lhs_block_in_rule603 = new BitSet(new long[]{0x0000000080000000L});
public static final BitSet FOLLOW_normal_lhs_block_in_rule612 = new BitSet(new long[]{0x0000000080000000L});
public static final BitSet FOLLOW_31_in_rule633 = new BitSet(new long[]{0x0000000040000012L});
public static final BitSet FOLLOW_30_in_rule635 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_rule639 = new BitSet(new long[]{0x00FFFFFFFFFFFFF0L});
+ public static final BitSet FOLLOW_opt_eol_in_rule639 = new BitSet(new long[]{0x01FFFFFFFFFFFFF0L});
public static final BitSet FOLLOW_27_in_rule674 = new BitSet(new long[]{0x0000000000000012L});
public static final BitSet FOLLOW_opt_eol_in_rule676 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_32_in_rule_attributes694 = new BitSet(new long[]{0x0000000040000012L});
public static final BitSet FOLLOW_30_in_rule_attributes697 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_rule_attributes700 = new BitSet(new long[]{0x0000003E00400002L});
- public static final BitSet FOLLOW_22_in_rule_attributes707 = new BitSet(new long[]{0x0000003E00000000L});
+ public static final BitSet FOLLOW_opt_eol_in_rule_attributes700 = new BitSet(new long[]{0x0000007E00400002L});
+ public static final BitSet FOLLOW_22_in_rule_attributes707 = new BitSet(new long[]{0x0000007E00000000L});
public static final BitSet FOLLOW_rule_attribute_in_rule_attributes712 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_rule_attributes714 = new BitSet(new long[]{0x0000003E00400002L});
+ public static final BitSet FOLLOW_opt_eol_in_rule_attributes714 = new BitSet(new long[]{0x0000007E00400002L});
public static final BitSet FOLLOW_salience_in_rule_attribute753 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_no_loop_in_rule_attribute763 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_agenda_group_in_rule_attribute774 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_duration_in_rule_attribute787 = new BitSet(new long[]{0x0000000000000002L});
public static final BitSet FOLLOW_xor_group_in_rule_attribute801 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_33_in_salience834 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_salience836 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_INT_in_salience840 = new BitSet(new long[]{0x0000000000010012L});
- public static final BitSet FOLLOW_16_in_salience842 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_salience845 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_34_in_no_loop880 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_no_loop882 = new BitSet(new long[]{0x0000000000010012L});
- public static final BitSet FOLLOW_16_in_no_loop884 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_no_loop887 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_34_in_no_loop912 = new BitSet(new long[]{0x0000000000000080L});
- public static final BitSet FOLLOW_BOOL_in_no_loop916 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_no_loop918 = new BitSet(new long[]{0x0000000000010012L});
- public static final BitSet FOLLOW_16_in_no_loop920 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_no_loop923 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_35_in_xor_group964 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_xor_group966 = new BitSet(new long[]{0x0000000000000100L});
- public static final BitSet FOLLOW_STRING_in_xor_group970 = new BitSet(new long[]{0x0000000000010012L});
- public static final BitSet FOLLOW_16_in_xor_group972 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_xor_group975 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_36_in_agenda_group1004 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_agenda_group1006 = new BitSet(new long[]{0x0000000000000100L});
- public static final BitSet FOLLOW_STRING_in_agenda_group1010 = new BitSet(new long[]{0x0000000000010012L});
- public static final BitSet FOLLOW_16_in_agenda_group1012 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_agenda_group1015 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_37_in_duration1047 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_duration1049 = new BitSet(new long[]{0x0000000000000040L});
- public static final BitSet FOLLOW_INT_in_duration1053 = new BitSet(new long[]{0x0000000000010012L});
- public static final BitSet FOLLOW_16_in_duration1055 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_duration1058 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_lhs_in_normal_lhs_block1084 = new BitSet(new long[]{0x0038000000200022L});
- public static final BitSet FOLLOW_paren_chunk_in_expander_lhs_block1130 = new BitSet(new long[]{0x0000000000000010L});
- public static final BitSet FOLLOW_EOL_in_expander_lhs_block1132 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
- public static final BitSet FOLLOW_lhs_or_in_lhs1176 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_fact_binding_in_lhs_column1203 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_fact_in_lhs_column1212 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ID_in_fact_binding1244 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_fact_binding1254 = new BitSet(new long[]{0x0000000040000000L});
- public static final BitSet FOLLOW_30_in_fact_binding1256 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_fact_binding1258 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_fact_in_fact_binding1266 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_fact_binding1268 = new BitSet(new long[]{0x0000004000000002L});
- public static final BitSet FOLLOW_38_in_fact_binding1280 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_fact_in_fact_binding1294 = new BitSet(new long[]{0x0000004000000002L});
- public static final BitSet FOLLOW_ID_in_fact1334 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_fact1342 = new BitSet(new long[]{0x0000000000200000L});
- public static final BitSet FOLLOW_21_in_fact1348 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_fact1350 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_constraints_in_fact1356 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_fact1375 = new BitSet(new long[]{0x0000000000800000L});
- public static final BitSet FOLLOW_23_in_fact1377 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_fact1379 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_opt_eol_in_constraints1404 = new BitSet(new long[]{0x0000000000000032L});
- public static final BitSet FOLLOW_constraint_in_constraints1409 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_predicate_in_constraints1412 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_constraints1420 = new BitSet(new long[]{0x0000000000400000L});
- public static final BitSet FOLLOW_22_in_constraints1422 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_constraints1424 = new BitSet(new long[]{0x0000000000000032L});
- public static final BitSet FOLLOW_constraint_in_constraints1427 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_predicate_in_constraints1430 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_constraints1438 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_opt_eol_in_constraint1457 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_constraint1465 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_constraint1467 = new BitSet(new long[]{0x0000000040000000L});
- public static final BitSet FOLLOW_30_in_constraint1469 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_constraint1471 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_constraint1481 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_constraint1491 = new BitSet(new long[]{0x00007F8000000012L});
- public static final BitSet FOLLOW_set_in_constraint1499 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_constraint1571 = new BitSet(new long[]{0x00000000002003E0L});
- public static final BitSet FOLLOW_ID_in_constraint1589 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_literal_constraint_in_constraint1614 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_retval_constraint_in_constraint1634 = new BitSet(new long[]{0x0000000000000012L});
- public static final BitSet FOLLOW_opt_eol_in_constraint1667 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRING_in_literal_constraint1694 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_INT_in_literal_constraint1705 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_FLOAT_in_literal_constraint1718 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_BOOL_in_literal_constraint1729 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_21_in_retval_constraint1762 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
- public static final BitSet FOLLOW_paren_chunk_in_retval_constraint1766 = new BitSet(new long[]{0x0000000000800000L});
- public static final BitSet FOLLOW_23_in_retval_constraint1768 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ID_in_predicate1786 = new BitSet(new long[]{0x0000000040000000L});
- public static final BitSet FOLLOW_30_in_predicate1788 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_predicate1792 = new BitSet(new long[]{0x0000800000000000L});
- public static final BitSet FOLLOW_47_in_predicate1794 = new BitSet(new long[]{0x0000000000200000L});
- public static final BitSet FOLLOW_21_in_predicate1796 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
- public static final BitSet FOLLOW_paren_chunk_in_predicate1800 = new BitSet(new long[]{0x0000000000800000L});
- public static final BitSet FOLLOW_23_in_predicate1802 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_21_in_paren_chunk1847 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
- public static final BitSet FOLLOW_paren_chunk_in_paren_chunk1851 = new BitSet(new long[]{0x0000000000800000L});
- public static final BitSet FOLLOW_23_in_paren_chunk1853 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
- public static final BitSet FOLLOW_24_in_curly_chunk1921 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
- public static final BitSet FOLLOW_curly_chunk_in_curly_chunk1925 = new BitSet(new long[]{0x0000000002000000L});
- public static final BitSet FOLLOW_25_in_curly_chunk1927 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
- public static final BitSet FOLLOW_lhs_and_in_lhs_or1985 = new BitSet(new long[]{0x0001004000000002L});
- public static final BitSet FOLLOW_set_in_lhs_or1995 = new BitSet(new long[]{0x0038000000200020L});
- public static final BitSet FOLLOW_lhs_and_in_lhs_or2006 = new BitSet(new long[]{0x0001004000000002L});
- public static final BitSet FOLLOW_lhs_unary_in_lhs_and2046 = new BitSet(new long[]{0x0006000000000002L});
- public static final BitSet FOLLOW_set_in_lhs_and2055 = new BitSet(new long[]{0x0038000000200020L});
- public static final BitSet FOLLOW_lhs_unary_in_lhs_and2066 = new BitSet(new long[]{0x0006000000000002L});
- public static final BitSet FOLLOW_lhs_exist_in_lhs_unary2104 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_lhs_not_in_lhs_unary2112 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_lhs_eval_in_lhs_unary2120 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_lhs_column_in_lhs_unary2128 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_21_in_lhs_unary2134 = new BitSet(new long[]{0x0038000000200020L});
- public static final BitSet FOLLOW_lhs_in_lhs_unary2138 = new BitSet(new long[]{0x0000000000800000L});
- public static final BitSet FOLLOW_23_in_lhs_unary2140 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_51_in_lhs_exist2170 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_lhs_column_in_lhs_exist2174 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_52_in_lhs_not2204 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_lhs_column_in_lhs_not2208 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_53_in_lhs_eval2234 = new BitSet(new long[]{0x0000000000200000L});
- public static final BitSet FOLLOW_21_in_lhs_eval2236 = new BitSet(new long[]{0x00FFFFFFFFFFFFF2L});
- public static final BitSet FOLLOW_paren_chunk_in_lhs_eval2240 = new BitSet(new long[]{0x0000000000800000L});
- public static final BitSet FOLLOW_23_in_lhs_eval2242 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_ID_in_dotted_name2274 = new BitSet(new long[]{0x0040000000000002L});
- public static final BitSet FOLLOW_54_in_dotted_name2280 = new BitSet(new long[]{0x0000000000000020L});
- public static final BitSet FOLLOW_ID_in_dotted_name2284 = new BitSet(new long[]{0x0040000000000002L});
- public static final BitSet FOLLOW_ID_in_word2314 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_17_in_word2326 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_55_in_word2335 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_28_in_word2347 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_26_in_word2358 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_33_in_word2368 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_34_in_word2376 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_29_in_word2384 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_31_in_word2395 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_27_in_word2406 = new BitSet(new long[]{0x0000000000000002L});
- public static final BitSet FOLLOW_STRING_in_word2420 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_auto_focus_in_rule_attribute812 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_33_in_salience845 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_salience847 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_INT_in_salience851 = new BitSet(new long[]{0x0000000000010012L});
+ public static final BitSet FOLLOW_16_in_salience853 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_salience856 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_34_in_no_loop891 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_no_loop893 = new BitSet(new long[]{0x0000000000010012L});
+ public static final BitSet FOLLOW_16_in_no_loop895 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_no_loop898 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_34_in_no_loop923 = new BitSet(new long[]{0x0000000000000080L});
+ public static final BitSet FOLLOW_BOOL_in_no_loop927 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_no_loop929 = new BitSet(new long[]{0x0000000000010012L});
+ public static final BitSet FOLLOW_16_in_no_loop931 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_no_loop934 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_35_in_auto_focus980 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_auto_focus982 = new BitSet(new long[]{0x0000000000010012L});
+ public static final BitSet FOLLOW_16_in_auto_focus984 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_auto_focus987 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_35_in_auto_focus1012 = new BitSet(new long[]{0x0000000000000080L});
+ public static final BitSet FOLLOW_BOOL_in_auto_focus1016 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_auto_focus1018 = new BitSet(new long[]{0x0000000000010012L});
+ public static final BitSet FOLLOW_16_in_auto_focus1020 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_auto_focus1023 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_36_in_xor_group1065 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_xor_group1067 = new BitSet(new long[]{0x0000000000000100L});
+ public static final BitSet FOLLOW_STRING_in_xor_group1071 = new BitSet(new long[]{0x0000000000010012L});
+ public static final BitSet FOLLOW_16_in_xor_group1073 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_xor_group1076 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_37_in_agenda_group1105 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_agenda_group1107 = new BitSet(new long[]{0x0000000000000100L});
+ public static final BitSet FOLLOW_STRING_in_agenda_group1111 = new BitSet(new long[]{0x0000000000010012L});
+ public static final BitSet FOLLOW_16_in_agenda_group1113 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_agenda_group1116 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_38_in_duration1148 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_duration1150 = new BitSet(new long[]{0x0000000000000040L});
+ public static final BitSet FOLLOW_INT_in_duration1154 = new BitSet(new long[]{0x0000000000010012L});
+ public static final BitSet FOLLOW_16_in_duration1156 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_duration1159 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_lhs_in_normal_lhs_block1185 = new BitSet(new long[]{0x0070000000200022L});
+ public static final BitSet FOLLOW_paren_chunk_in_expander_lhs_block1231 = new BitSet(new long[]{0x0000000000000010L});
+ public static final BitSet FOLLOW_EOL_in_expander_lhs_block1233 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_lhs_or_in_lhs1277 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_fact_binding_in_lhs_column1304 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_fact_in_lhs_column1313 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_fact_binding1345 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_fact_binding1355 = new BitSet(new long[]{0x0000000040000000L});
+ public static final BitSet FOLLOW_30_in_fact_binding1357 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_fact_binding1359 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_fact_in_fact_binding1367 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_fact_binding1369 = new BitSet(new long[]{0x0000008000000002L});
+ public static final BitSet FOLLOW_39_in_fact_binding1381 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_fact_in_fact_binding1395 = new BitSet(new long[]{0x0000008000000002L});
+ public static final BitSet FOLLOW_ID_in_fact1435 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_fact1443 = new BitSet(new long[]{0x0000000000200000L});
+ public static final BitSet FOLLOW_21_in_fact1449 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_fact1451 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_constraints_in_fact1457 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_fact1476 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_23_in_fact1478 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_fact1480 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_opt_eol_in_constraints1505 = new BitSet(new long[]{0x0000000000000032L});
+ public static final BitSet FOLLOW_constraint_in_constraints1510 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_predicate_in_constraints1513 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_constraints1521 = new BitSet(new long[]{0x0000000000400000L});
+ public static final BitSet FOLLOW_22_in_constraints1523 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_constraints1525 = new BitSet(new long[]{0x0000000000000032L});
+ public static final BitSet FOLLOW_constraint_in_constraints1528 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_predicate_in_constraints1531 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_constraints1539 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_opt_eol_in_constraint1558 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_constraint1566 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_constraint1568 = new BitSet(new long[]{0x0000000040000000L});
+ public static final BitSet FOLLOW_30_in_constraint1570 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_constraint1572 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_constraint1582 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_constraint1592 = new BitSet(new long[]{0x0000FF0000000012L});
+ public static final BitSet FOLLOW_set_in_constraint1600 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_constraint1672 = new BitSet(new long[]{0x00000000002003E0L});
+ public static final BitSet FOLLOW_ID_in_constraint1690 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_literal_constraint_in_constraint1715 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_retval_constraint_in_constraint1735 = new BitSet(new long[]{0x0000000000000012L});
+ public static final BitSet FOLLOW_opt_eol_in_constraint1768 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_in_literal_constraint1795 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_INT_in_literal_constraint1806 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_FLOAT_in_literal_constraint1819 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_BOOL_in_literal_constraint1830 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_21_in_retval_constraint1863 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_paren_chunk_in_retval_constraint1867 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_23_in_retval_constraint1869 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_predicate1887 = new BitSet(new long[]{0x0000000040000000L});
+ public static final BitSet FOLLOW_30_in_predicate1889 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_predicate1893 = new BitSet(new long[]{0x0001000000000000L});
+ public static final BitSet FOLLOW_48_in_predicate1895 = new BitSet(new long[]{0x0000000000200000L});
+ public static final BitSet FOLLOW_21_in_predicate1897 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_paren_chunk_in_predicate1901 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_23_in_predicate1903 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_21_in_paren_chunk1948 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_paren_chunk_in_paren_chunk1952 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_23_in_paren_chunk1954 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_24_in_curly_chunk2022 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_curly_chunk_in_curly_chunk2026 = new BitSet(new long[]{0x0000000002000000L});
+ public static final BitSet FOLLOW_25_in_curly_chunk2028 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_lhs_and_in_lhs_or2086 = new BitSet(new long[]{0x0002008000000002L});
+ public static final BitSet FOLLOW_set_in_lhs_or2096 = new BitSet(new long[]{0x0070000000200020L});
+ public static final BitSet FOLLOW_lhs_and_in_lhs_or2107 = new BitSet(new long[]{0x0002008000000002L});
+ public static final BitSet FOLLOW_lhs_unary_in_lhs_and2147 = new BitSet(new long[]{0x000C000000000002L});
+ public static final BitSet FOLLOW_set_in_lhs_and2156 = new BitSet(new long[]{0x0070000000200020L});
+ public static final BitSet FOLLOW_lhs_unary_in_lhs_and2167 = new BitSet(new long[]{0x000C000000000002L});
+ public static final BitSet FOLLOW_lhs_exist_in_lhs_unary2205 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_lhs_not_in_lhs_unary2213 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_lhs_eval_in_lhs_unary2221 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_lhs_column_in_lhs_unary2229 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_21_in_lhs_unary2235 = new BitSet(new long[]{0x0070000000200020L});
+ public static final BitSet FOLLOW_lhs_in_lhs_unary2239 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_23_in_lhs_unary2241 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_52_in_lhs_exist2271 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_lhs_column_in_lhs_exist2275 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_53_in_lhs_not2305 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_lhs_column_in_lhs_not2309 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_54_in_lhs_eval2335 = new BitSet(new long[]{0x0000000000200000L});
+ public static final BitSet FOLLOW_21_in_lhs_eval2337 = new BitSet(new long[]{0x01FFFFFFFFFFFFF2L});
+ public static final BitSet FOLLOW_paren_chunk_in_lhs_eval2341 = new BitSet(new long[]{0x0000000000800000L});
+ public static final BitSet FOLLOW_23_in_lhs_eval2343 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_ID_in_dotted_name2375 = new BitSet(new long[]{0x0080000000000002L});
+ public static final BitSet FOLLOW_55_in_dotted_name2381 = new BitSet(new long[]{0x0000000000000020L});
+ public static final BitSet FOLLOW_ID_in_dotted_name2385 = new BitSet(new long[]{0x0080000000000002L});
+ public static final BitSet FOLLOW_ID_in_word2415 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_17_in_word2427 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_56_in_word2436 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_28_in_word2448 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_26_in_word2459 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_33_in_word2469 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_34_in_word2477 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_29_in_word2485 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_31_in_word2496 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_27_in_word2507 = new BitSet(new long[]{0x0000000000000002L});
+ public static final BitSet FOLLOW_STRING_in_word2521 = new BitSet(new long[]{0x0000000000000002L});
}
\ No newline at end of file
diff --git a/drools-compiler/src/main/java/org/drools/lang/RuleParserLexer.java b/drools-compiler/src/main/java/org/drools/lang/RuleParserLexer.java
index 5593cab34df..d69f3246d93 100644
--- a/drools-compiler/src/main/java/org/drools/lang/RuleParserLexer.java
+++ b/drools-compiler/src/main/java/org/drools/lang/RuleParserLexer.java
@@ -1,4 +1,4 @@
-// $ANTLR 3.0ea8 C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g 2006-03-28 11:19:24
+// $ANTLR 3.0ea8 C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g 2006-03-28 14:38:45
package org.drools.lang;
@@ -48,13 +48,14 @@ public class RuleParserLexer extends Lexer {
public static final int T28=28;
public static final int T42=42;
public static final int T40=40;
+ public static final int T56=56;
public static final int T48=48;
public static final int T15=15;
public static final int T54=54;
public static final int EOF=-1;
public static final int T47=47;
public static final int EOL=4;
- public static final int Tokens=56;
+ public static final int Tokens=57;
public static final int T53=53;
public static final int T31=31;
public static final int MULTI_LINE_COMMENT=14;
@@ -550,10 +551,10 @@ public void mT35() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:26:7: ( 'xor-group' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:26:7: 'xor-group'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:26:7: ( 'auto-focus' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:26:7: 'auto-focus'
{
- match("xor-group");
+ match("auto-focus");
}
@@ -574,10 +575,10 @@ public void mT36() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:27:7: ( 'agenda-group' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:27:7: 'agenda-group'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:27:7: ( 'xor-group' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:27:7: 'xor-group'
{
- match("agenda-group");
+ match("xor-group");
}
@@ -598,10 +599,10 @@ public void mT37() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:28:7: ( 'duration' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:28:7: 'duration'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:28:7: ( 'agenda-group' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:28:7: 'agenda-group'
{
- match("duration");
+ match("agenda-group");
}
@@ -622,10 +623,10 @@ public void mT38() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:29:7: ( 'or' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:29:7: 'or'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:29:7: ( 'duration' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:29:7: 'duration'
{
- match("or");
+ match("duration");
}
@@ -646,10 +647,10 @@ public void mT39() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:30:7: ( '==' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:30:7: '=='
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:30:7: ( 'or' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:30:7: 'or'
{
- match("==");
+ match("or");
}
@@ -670,10 +671,11 @@ public void mT40() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:31:7: ( '>' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:31:7: '>'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:31:7: ( '==' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:31:7: '=='
{
- match('>');
+ match("==");
+
}
@@ -693,11 +695,10 @@ public void mT41() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:32:7: ( '>=' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:32:7: '>='
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:32:7: ( '>' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:32:7: '>'
{
- match(">=");
-
+ match('>');
}
@@ -717,10 +718,11 @@ public void mT42() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:33:7: ( '<' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:33:7: '<'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:33:7: ( '>=' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:33:7: '>='
{
- match('<');
+ match(">=");
+
}
@@ -740,11 +742,10 @@ public void mT43() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:34:7: ( '<=' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:34:7: '<='
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:34:7: ( '<' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:34:7: '<'
{
- match("<=");
-
+ match('<');
}
@@ -764,10 +765,10 @@ public void mT44() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:35:7: ( '!=' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:35:7: '!='
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:35:7: ( '<=' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:35:7: '<='
{
- match("!=");
+ match("<=");
}
@@ -788,10 +789,10 @@ public void mT45() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:36:7: ( 'contains' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:36:7: 'contains'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:36:7: ( '!=' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:36:7: '!='
{
- match("contains");
+ match("!=");
}
@@ -812,10 +813,10 @@ public void mT46() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:37:7: ( 'matches' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:37:7: 'matches'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:37:7: ( 'contains' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:37:7: 'contains'
{
- match("matches");
+ match("contains");
}
@@ -836,10 +837,10 @@ public void mT47() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:38:7: ( '->' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:38:7: '->'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:38:7: ( 'matches' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:38:7: 'matches'
{
- match("->");
+ match("matches");
}
@@ -860,10 +861,10 @@ public void mT48() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:39:7: ( '||' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:39:7: '||'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:39:7: ( '->' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:39:7: '->'
{
- match("||");
+ match("->");
}
@@ -884,10 +885,10 @@ public void mT49() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:40:7: ( 'and' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:40:7: 'and'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:40:7: ( '||' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:40:7: '||'
{
- match("and");
+ match("||");
}
@@ -908,10 +909,10 @@ public void mT50() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:41:7: ( '&&' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:41:7: '&&'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:41:7: ( 'and' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:41:7: 'and'
{
- match("&&");
+ match("and");
}
@@ -932,10 +933,10 @@ public void mT51() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:42:7: ( 'exists' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:42:7: 'exists'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:42:7: ( '&&' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:42:7: '&&'
{
- match("exists");
+ match("&&");
}
@@ -956,10 +957,10 @@ public void mT52() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:43:7: ( 'not' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:43:7: 'not'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:43:7: ( 'exists' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:43:7: 'exists'
{
- match("not");
+ match("exists");
}
@@ -980,10 +981,10 @@ public void mT53() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:44:7: ( 'eval' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:44:7: 'eval'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:44:7: ( 'not' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:44:7: 'not'
{
- match("eval");
+ match("not");
}
@@ -1004,10 +1005,11 @@ public void mT54() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:45:7: ( '.' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:45:7: '.'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:45:7: ( 'eval' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:45:7: 'eval'
{
- match('.');
+ match("eval");
+
}
@@ -1027,8 +1029,31 @@ public void mT55() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:46:7: ( 'use' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:46:7: 'use'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:46:7: ( '.' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:46:7: '.'
+ {
+ match('.');
+
+ }
+
+ if ( token==null ) {emit(type,line,charPosition,channel,start,getCharIndex()-1);}
+ }
+ finally {
+ }
+ }
+ // $ANTLR end T55
+
+
+ // $ANTLR start T56
+ public void mT56() throws RecognitionException {
+ try {
+ int type = T56;
+ int start = getCharIndex();
+ int line = getLine();
+ int charPosition = getCharPositionInLine();
+ int channel = Token.DEFAULT_CHANNEL;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:47:7: ( 'use' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:47:7: 'use'
{
match("use");
@@ -1040,7 +1065,7 @@ public void mT55() throws RecognitionException {
finally {
}
}
- // $ANTLR end T55
+ // $ANTLR end T56
// $ANTLR start MISC
@@ -1051,8 +1076,8 @@ public void mMISC() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:711:9: ( ('!'|'@'|'$'|'%'|'^'|'&'|'*'|'_'|'-'|'+'|'|'|','|'{'|'}'|'['|']'|';'))
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:712:17: ('!'|'@'|'$'|'%'|'^'|'&'|'*'|'_'|'-'|'+'|'|'|','|'{'|'}'|'['|']'|';')
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:736:9: ( ('!'|'@'|'$'|'%'|'^'|'&'|'*'|'_'|'-'|'+'|'|'|','|'{'|'}'|'['|']'|';'))
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:737:17: ('!'|'@'|'$'|'%'|'^'|'&'|'*'|'_'|'-'|'+'|'|'|','|'{'|'}'|'['|']'|';')
{
if ( input.LA(1)=='!'||(input.LA(1)>='$' && input.LA(1)<='&')||(input.LA(1)>='*' && input.LA(1)<='-')||input.LA(1)==';'||input.LA(1)=='@'||input.LA(1)=='['||(input.LA(1)>=']' && input.LA(1)<='_')||(input.LA(1)>='{' && input.LA(1)<='}') ) {
input.consume();
@@ -1083,8 +1108,8 @@ public void mWS() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:715:17: ( (' '|'\t'|'\f'))
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:715:17: (' '|'\t'|'\f')
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:740:17: ( (' '|'\t'|'\f'))
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:740:17: (' '|'\t'|'\f')
{
if ( input.LA(1)=='\t'||input.LA(1)=='\f'||input.LA(1)==' ' ) {
input.consume();
@@ -1116,10 +1141,10 @@ public void mEOL() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:723:17: ( ( '\r\n' | '\r' | '\n' ) )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:723:17: ( '\r\n' | '\r' | '\n' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:748:17: ( ( '\r\n' | '\r' | '\n' ) )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:748:17: ( '\r\n' | '\r' | '\n' )
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:723:17: ( '\r\n' | '\r' | '\n' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:748:17: ( '\r\n' | '\r' | '\n' )
int alt1=3;
int LA1_0 = input.LA(1);
if ( LA1_0=='\r' ) {
@@ -1135,13 +1160,13 @@ else if ( LA1_0=='\n' ) {
}
else {
NoViableAltException nvae =
- new NoViableAltException("723:17: ( \'\\r\\n\' | \'\\r\' | \'\\n\' )", 1, 0, input);
+ new NoViableAltException("748:17: ( \'\\r\\n\' | \'\\r\' | \'\\n\' )", 1, 0, input);
throw nvae;
}
switch (alt1) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:723:25: '\r\n'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:748:25: '\r\n'
{
match("\r\n");
@@ -1149,14 +1174,14 @@ else if ( LA1_0=='\n' ) {
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:724:25: '\r'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:749:25: '\r'
{
match('\r');
}
break;
case 3 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:725:25: '\n'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:750:25: '\n'
{
match('\n');
@@ -1184,10 +1209,10 @@ public void mINT() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:730:17: ( ( '-' )? ( '0' .. '9' )+ )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:730:17: ( '-' )? ( '0' .. '9' )+
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:755:17: ( ( '-' )? ( '0' .. '9' )+ )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:755:17: ( '-' )? ( '0' .. '9' )+
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:730:17: ( '-' )?
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:755:17: ( '-' )?
int alt2=2;
int LA2_0 = input.LA(1);
if ( LA2_0=='-' ) {
@@ -1198,13 +1223,13 @@ else if ( (LA2_0>='0' && LA2_0<='9') ) {
}
else {
NoViableAltException nvae =
- new NoViableAltException("730:17: ( \'-\' )?", 2, 0, input);
+ new NoViableAltException("755:17: ( \'-\' )?", 2, 0, input);
throw nvae;
}
switch (alt2) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:730:18: '-'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:755:18: '-'
{
match('-');
@@ -1213,7 +1238,7 @@ else if ( (LA2_0>='0' && LA2_0<='9') ) {
}
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:730:23: ( '0' .. '9' )+
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:755:23: ( '0' .. '9' )+
int cnt3=0;
loop3:
do {
@@ -1226,7 +1251,7 @@ else if ( (LA2_0>='0' && LA2_0<='9') ) {
switch (alt3) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:730:24: '0' .. '9'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:755:24: '0' .. '9'
{
matchRange('0','9');
@@ -1261,10 +1286,10 @@ public void mFLOAT() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:734:17: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:734:17: ( '0' .. '9' )+ '.' ( '0' .. '9' )+
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:759:17: ( ( '0' .. '9' )+ '.' ( '0' .. '9' )+ )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:759:17: ( '0' .. '9' )+ '.' ( '0' .. '9' )+
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:734:17: ( '0' .. '9' )+
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:759:17: ( '0' .. '9' )+
int cnt4=0;
loop4:
do {
@@ -1277,7 +1302,7 @@ public void mFLOAT() throws RecognitionException {
switch (alt4) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:734:18: '0' .. '9'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:759:18: '0' .. '9'
{
matchRange('0','9');
@@ -1294,7 +1319,7 @@ public void mFLOAT() throws RecognitionException {
} while (true);
match('.');
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:734:33: ( '0' .. '9' )+
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:759:33: ( '0' .. '9' )+
int cnt5=0;
loop5:
do {
@@ -1307,7 +1332,7 @@ public void mFLOAT() throws RecognitionException {
switch (alt5) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:734:34: '0' .. '9'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:759:34: '0' .. '9'
{
matchRange('0','9');
@@ -1342,11 +1367,11 @@ public void mSTRING() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:738:17: ( '"' ( options {greedy=false; } : . )* '"' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:738:17: '"' ( options {greedy=false; } : . )* '"'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:763:17: ( '"' ( options {greedy=false; } : . )* '"' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:763:17: '"' ( options {greedy=false; } : . )* '"'
{
match('"');
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:738:21: ( options {greedy=false; } : . )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:763:21: ( options {greedy=false; } : . )*
loop6:
do {
int alt6=2;
@@ -1361,7 +1386,7 @@ else if ( (LA6_0>='\u0000' && LA6_0<='!')||(LA6_0>='#' && LA6_0<='\uFFFE') ) {
switch (alt6) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:738:48: .
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:763:48: .
{
matchAny();
@@ -1393,10 +1418,10 @@ public void mBOOL() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:742:17: ( ( 'true' | 'false' ) )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:742:17: ( 'true' | 'false' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:767:17: ( ( 'true' | 'false' ) )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:767:17: ( 'true' | 'false' )
{
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:742:17: ( 'true' | 'false' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:767:17: ( 'true' | 'false' )
int alt7=2;
int LA7_0 = input.LA(1);
if ( LA7_0=='t' ) {
@@ -1407,13 +1432,13 @@ else if ( LA7_0=='f' ) {
}
else {
NoViableAltException nvae =
- new NoViableAltException("742:17: ( \'true\' | \'false\' )", 7, 0, input);
+ new NoViableAltException("767:17: ( \'true\' | \'false\' )", 7, 0, input);
throw nvae;
}
switch (alt7) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:742:18: 'true'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:767:18: 'true'
{
match("true");
@@ -1421,7 +1446,7 @@ else if ( LA7_0=='f' ) {
}
break;
case 2 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:742:25: 'false'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:767:25: 'false'
{
match("false");
@@ -1450,8 +1475,8 @@ public void mID() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:746:17: ( ('a'..'z'|'A'..'Z'|'_'|'$') ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'))* )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:746:17: ('a'..'z'|'A'..'Z'|'_'|'$') ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'))*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:771:17: ( ('a'..'z'|'A'..'Z'|'_'|'$') ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'))* )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:771:17: ('a'..'z'|'A'..'Z'|'_'|'$') ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'))*
{
if ( input.LA(1)=='$'||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
input.consume();
@@ -1463,7 +1488,7 @@ public void mID() throws RecognitionException {
recover(mse); throw mse;
}
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:746:44: ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'))*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:771:44: ( ('a'..'z'|'A'..'Z'|'_'|'0'..'9'))*
loop8:
do {
int alt8=2;
@@ -1475,7 +1500,7 @@ public void mID() throws RecognitionException {
switch (alt8) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:746:45: ('a'..'z'|'A'..'Z'|'_'|'0'..'9')
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:771:45: ('a'..'z'|'A'..'Z'|'_'|'0'..'9')
{
if ( (input.LA(1)>='0' && input.LA(1)<='9')||(input.LA(1)>='A' && input.LA(1)<='Z')||input.LA(1)=='_'||(input.LA(1)>='a' && input.LA(1)<='z') ) {
input.consume();
@@ -1515,11 +1540,11 @@ public void mSH_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:751:17: ( '#' ( options {greedy=false; } : . )* EOL )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:751:17: '#' ( options {greedy=false; } : . )* EOL
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:776:17: ( '#' ( options {greedy=false; } : . )* EOL )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:776:17: '#' ( options {greedy=false; } : . )* EOL
{
match('#');
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:751:21: ( options {greedy=false; } : . )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:776:21: ( options {greedy=false; } : . )*
loop9:
do {
int alt9=2;
@@ -1537,7 +1562,7 @@ else if ( (LA9_0>='\u0000' && LA9_0<='\t')||(LA9_0>='\u000B' && LA9_0<='\f')||(L
switch (alt9) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:751:48: .
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:776:48: .
{
matchAny();
@@ -1570,12 +1595,12 @@ public void mC_STYLE_SINGLE_LINE_COMMENT() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:757:17: ( '//' ( options {greedy=false; } : . )* EOL )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:757:17: '//' ( options {greedy=false; } : . )* EOL
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:782:17: ( '//' ( options {greedy=false; } : . )* EOL )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:782:17: '//' ( options {greedy=false; } : . )* EOL
{
match("//");
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:757:22: ( options {greedy=false; } : . )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:782:22: ( options {greedy=false; } : . )*
loop10:
do {
int alt10=2;
@@ -1593,7 +1618,7 @@ else if ( (LA10_0>='\u0000' && LA10_0<='\t')||(LA10_0>='\u000B' && LA10_0<='\f')
switch (alt10) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:757:49: .
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:782:49: .
{
matchAny();
@@ -1626,12 +1651,12 @@ public void mMULTI_LINE_COMMENT() throws RecognitionException {
int line = getLine();
int charPosition = getCharPositionInLine();
int channel = Token.DEFAULT_CHANNEL;
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:762:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:762:17: '/*' ( options {greedy=false; } : . )* '*/'
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:787:17: ( '/*' ( options {greedy=false; } : . )* '*/' )
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:787:17: '/*' ( options {greedy=false; } : . )* '*/'
{
match("/*");
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:762:22: ( options {greedy=false; } : . )*
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:787:22: ( options {greedy=false; } : . )*
loop11:
do {
int alt11=2;
@@ -1654,7 +1679,7 @@ else if ( (LA11_0>='\u0000' && LA11_0<=')')||(LA11_0>='+' && LA11_0<='\uFFFE') )
switch (alt11) {
case 1 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:762:48: .
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:787:48: .
{
matchAny();
@@ -1680,8 +1705,8 @@ else if ( (LA11_0>='\u0000' && LA11_0<=')')||(LA11_0>='+' && LA11_0<='\uFFFE') )
// $ANTLR end MULTI_LINE_COMMENT
public void mTokens() throws RecognitionException {
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:10: ( T15 | T16 | T17 | T18 | T19 | T20 | T21 | T22 | T23 | T24 | T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | MISC | WS | EOL | INT | FLOAT | STRING | BOOL | ID | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT )
- int alt12=52;
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:10: ( T15 | T16 | T17 | T18 | T19 | T20 | T21 | T22 | T23 | T24 | T25 | T26 | T27 | T28 | T29 | T30 | T31 | T32 | T33 | T34 | T35 | T36 | T37 | T38 | T39 | T40 | T41 | T42 | T43 | T44 | T45 | T46 | T47 | T48 | T49 | T50 | T51 | T52 | T53 | T54 | T55 | T56 | MISC | WS | EOL | INT | FLOAT | STRING | BOOL | ID | SH_STYLE_SINGLE_LINE_COMMENT | C_STYLE_SINGLE_LINE_COMMENT | MULTI_LINE_COMMENT )
+ int alt12=53;
alt12 = dfa12.predict(input);
switch (alt12) {
case 1 :
@@ -1972,77 +1997,84 @@ public void mTokens() throws RecognitionException {
}
break;
case 42 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:174: MISC
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:174: T56
{
- mMISC();
+ mT56();
}
break;
case 43 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:179: WS
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:178: MISC
{
- mWS();
+ mMISC();
}
break;
case 44 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:182: EOL
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:183: WS
{
- mEOL();
+ mWS();
}
break;
case 45 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:186: INT
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:186: EOL
{
- mINT();
+ mEOL();
}
break;
case 46 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:190: FLOAT
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:190: INT
{
- mFLOAT();
+ mINT();
}
break;
case 47 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:196: STRING
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:194: FLOAT
{
- mSTRING();
+ mFLOAT();
}
break;
case 48 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:203: BOOL
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:200: STRING
{
- mBOOL();
+ mSTRING();
}
break;
case 49 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:208: ID
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:207: BOOL
{
- mID();
+ mBOOL();
}
break;
case 50 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:211: SH_STYLE_SINGLE_LINE_COMMENT
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:212: ID
{
- mSH_STYLE_SINGLE_LINE_COMMENT();
+ mID();
}
break;
case 51 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:240: C_STYLE_SINGLE_LINE_COMMENT
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:215: SH_STYLE_SINGLE_LINE_COMMENT
{
- mC_STYLE_SINGLE_LINE_COMMENT();
+ mSH_STYLE_SINGLE_LINE_COMMENT();
}
break;
case 52 :
- // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:268: MULTI_LINE_COMMENT
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:244: C_STYLE_SINGLE_LINE_COMMENT
+ {
+ mC_STYLE_SINGLE_LINE_COMMENT();
+
+ }
+ break;
+ case 53 :
+ // C:\Projects\jboss-rules\drools-compiler\src\main\resources\org\drools\lang\drl.g:1:272: MULTI_LINE_COMMENT
{
mMULTI_LINE_COMMENT();
@@ -2059,44 +2091,44 @@ class DFA12 extends DFA {
public int predict(IntStream input) throws RecognitionException {
return predict(input, s0);
}
- DFA.State s394 = new DFA.State() {{alt=1;}};
- DFA.State s41 = new DFA.State() {{alt=49;}};
- DFA.State s361 = new DFA.State() {
+ DFA.State s404 = new DFA.State() {{alt=1;}};
+ DFA.State s41 = new DFA.State() {{alt=50;}};
+ DFA.State s371 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_361 = input.LA(1);
- if ( (LA12_361>='0' && LA12_361<='9')||(LA12_361>='A' && LA12_361<='Z')||LA12_361=='_'||(LA12_361>='a' && LA12_361<='z') ) {return s41;}
- return s394;
+ int LA12_371 = input.LA(1);
+ if ( (LA12_371>='0' && LA12_371<='9')||(LA12_371>='A' && LA12_371<='Z')||LA12_371=='_'||(LA12_371>='a' && LA12_371<='z') ) {return s41;}
+ return s404;
}
};
- DFA.State s321 = new DFA.State() {
+ DFA.State s331 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_321 = input.LA(1);
- if ( LA12_321=='e' ) {return s361;}
+ int LA12_331 = input.LA(1);
+ if ( LA12_331=='e' ) {return s371;}
return s41;
}
};
- DFA.State s269 = new DFA.State() {
+ DFA.State s276 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_269 = input.LA(1);
- if ( LA12_269=='g' ) {return s321;}
+ int LA12_276 = input.LA(1);
+ if ( LA12_276=='g' ) {return s331;}
return s41;
}
};
- DFA.State s201 = new DFA.State() {
+ DFA.State s205 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_201 = input.LA(1);
- if ( LA12_201=='a' ) {return s269;}
+ int LA12_205 = input.LA(1);
+ if ( LA12_205=='a' ) {return s276;}
return s41;
}
};
- DFA.State s128 = new DFA.State() {
+ DFA.State s129 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_128 = input.LA(1);
- if ( LA12_128=='k' ) {return s201;}
+ int LA12_129 = input.LA(1);
+ if ( LA12_129=='k' ) {return s205;}
return s41;
}
@@ -2104,7 +2136,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s44 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_44 = input.LA(1);
- if ( LA12_44=='c' ) {return s128;}
+ if ( LA12_44=='c' ) {return s129;}
return s41;
}
@@ -2125,35 +2157,35 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
- DFA.State s364 = new DFA.State() {{alt=3;}};
- DFA.State s324 = new DFA.State() {
+ DFA.State s374 = new DFA.State() {{alt=3;}};
+ DFA.State s334 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_324 = input.LA(1);
- if ( (LA12_324>='0' && LA12_324<='9')||(LA12_324>='A' && LA12_324<='Z')||LA12_324=='_'||(LA12_324>='a' && LA12_324<='z') ) {return s41;}
- return s364;
+ int LA12_334 = input.LA(1);
+ if ( (LA12_334>='0' && LA12_334<='9')||(LA12_334>='A' && LA12_334<='Z')||LA12_334=='_'||(LA12_334>='a' && LA12_334<='z') ) {return s41;}
+ return s374;
}
};
- DFA.State s272 = new DFA.State() {
+ DFA.State s279 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_272 = input.LA(1);
- if ( LA12_272=='t' ) {return s324;}
+ int LA12_279 = input.LA(1);
+ if ( LA12_279=='t' ) {return s334;}
return s41;
}
};
- DFA.State s204 = new DFA.State() {
+ DFA.State s208 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_204 = input.LA(1);
- if ( LA12_204=='r' ) {return s272;}
+ int LA12_208 = input.LA(1);
+ if ( LA12_208=='r' ) {return s279;}
return s41;
}
};
- DFA.State s131 = new DFA.State() {
+ DFA.State s132 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_131 = input.LA(1);
- if ( LA12_131=='o' ) {return s204;}
+ int LA12_132 = input.LA(1);
+ if ( LA12_132=='o' ) {return s208;}
return s41;
}
@@ -2161,7 +2193,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s48 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_48 = input.LA(1);
- if ( LA12_48=='p' ) {return s131;}
+ if ( LA12_48=='p' ) {return s132;}
return s41;
}
@@ -2174,84 +2206,84 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
- DFA.State s416 = new DFA.State() {{alt=4;}};
- DFA.State s396 = new DFA.State() {
+ DFA.State s426 = new DFA.State() {{alt=4;}};
+ DFA.State s406 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_396 = input.LA(1);
- if ( (LA12_396>='0' && LA12_396<='9')||(LA12_396>='A' && LA12_396<='Z')||LA12_396=='_'||(LA12_396>='a' && LA12_396<='z') ) {return s41;}
- return s416;
+ int LA12_406 = input.LA(1);
+ if ( (LA12_406>='0' && LA12_406<='9')||(LA12_406>='A' && LA12_406<='Z')||LA12_406=='_'||(LA12_406>='a' && LA12_406<='z') ) {return s41;}
+ return s426;
}
};
- DFA.State s366 = new DFA.State() {
+ DFA.State s376 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_366 = input.LA(1);
- if ( LA12_366=='r' ) {return s396;}
+ int LA12_376 = input.LA(1);
+ if ( LA12_376=='r' ) {return s406;}
return s41;
}
};
- DFA.State s327 = new DFA.State() {
+ DFA.State s337 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_327 = input.LA(1);
- if ( LA12_327=='e' ) {return s366;}
+ int LA12_337 = input.LA(1);
+ if ( LA12_337=='e' ) {return s376;}
return s41;
}
};
- DFA.State s275 = new DFA.State() {
+ DFA.State s282 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_275 = input.LA(1);
- if ( LA12_275=='d' ) {return s327;}
+ int LA12_282 = input.LA(1);
+ if ( LA12_282=='d' ) {return s337;}
return s41;
}
};
- DFA.State s207 = new DFA.State() {
+ DFA.State s211 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_207 = input.LA(1);
- if ( LA12_207=='n' ) {return s275;}
+ int LA12_211 = input.LA(1);
+ if ( LA12_211=='n' ) {return s282;}
return s41;
}
};
- DFA.State s134 = new DFA.State() {
+ DFA.State s135 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_134 = input.LA(1);
- if ( LA12_134=='a' ) {return s207;}
+ int LA12_135 = input.LA(1);
+ if ( LA12_135=='a' ) {return s211;}
return s41;
}
};
- DFA.State s369 = new DFA.State() {{alt=37;}};
- DFA.State s330 = new DFA.State() {
+ DFA.State s379 = new DFA.State() {{alt=38;}};
+ DFA.State s340 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_330 = input.LA(1);
- if ( (LA12_330>='0' && LA12_330<='9')||(LA12_330>='A' && LA12_330<='Z')||LA12_330=='_'||(LA12_330>='a' && LA12_330<='z') ) {return s41;}
- return s369;
+ int LA12_340 = input.LA(1);
+ if ( (LA12_340>='0' && LA12_340<='9')||(LA12_340>='A' && LA12_340<='Z')||LA12_340=='_'||(LA12_340>='a' && LA12_340<='z') ) {return s41;}
+ return s379;
}
};
- DFA.State s278 = new DFA.State() {
+ DFA.State s285 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_278 = input.LA(1);
- if ( LA12_278=='s' ) {return s330;}
+ int LA12_285 = input.LA(1);
+ if ( LA12_285=='s' ) {return s340;}
return s41;
}
};
- DFA.State s210 = new DFA.State() {
+ DFA.State s214 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_210 = input.LA(1);
- if ( LA12_210=='t' ) {return s278;}
+ int LA12_214 = input.LA(1);
+ if ( LA12_214=='t' ) {return s285;}
return s41;
}
};
- DFA.State s135 = new DFA.State() {
+ DFA.State s136 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_135 = input.LA(1);
- if ( LA12_135=='s' ) {return s210;}
+ int LA12_136 = input.LA(1);
+ if ( LA12_136=='s' ) {return s214;}
return s41;
}
@@ -2260,29 +2292,29 @@ public DFA.State transition(IntStream input) throws RecognitionException {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
case 'p':
- return s134;
+ return s135;
case 'i':
- return s135;
+ return s136;
default:
return s41;
}
}
};
- DFA.State s281 = new DFA.State() {{alt=39;}};
- DFA.State s213 = new DFA.State() {
+ DFA.State s288 = new DFA.State() {{alt=40;}};
+ DFA.State s217 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_213 = input.LA(1);
- if ( (LA12_213>='0' && LA12_213<='9')||(LA12_213>='A' && LA12_213<='Z')||LA12_213=='_'||(LA12_213>='a' && LA12_213<='z') ) {return s41;}
- return s281;
+ int LA12_217 = input.LA(1);
+ if ( (LA12_217>='0' && LA12_217<='9')||(LA12_217>='A' && LA12_217<='Z')||LA12_217=='_'||(LA12_217>='a' && LA12_217<='z') ) {return s41;}
+ return s288;
}
};
- DFA.State s138 = new DFA.State() {
+ DFA.State s139 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_138 = input.LA(1);
- if ( LA12_138=='l' ) {return s213;}
+ int LA12_139 = input.LA(1);
+ if ( LA12_139=='l' ) {return s217;}
return s41;
}
@@ -2290,24 +2322,24 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s52 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_52 = input.LA(1);
- if ( LA12_52=='a' ) {return s138;}
+ if ( LA12_52=='a' ) {return s139;}
return s41;
}
};
- DFA.State s216 = new DFA.State() {{alt=13;}};
- DFA.State s141 = new DFA.State() {
+ DFA.State s220 = new DFA.State() {{alt=13;}};
+ DFA.State s142 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_141 = input.LA(1);
- if ( (LA12_141>='0' && LA12_141<='9')||(LA12_141>='A' && LA12_141<='Z')||LA12_141=='_'||(LA12_141>='a' && LA12_141<='z') ) {return s41;}
- return s216;
+ int LA12_142 = input.LA(1);
+ if ( (LA12_142>='0' && LA12_142<='9')||(LA12_142>='A' && LA12_142<='Z')||LA12_142=='_'||(LA12_142>='a' && LA12_142<='z') ) {return s41;}
+ return s220;
}
};
DFA.State s53 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_53 = input.LA(1);
- if ( LA12_53=='d' ) {return s141;}
+ if ( LA12_53=='d' ) {return s142;}
return s41;
}
@@ -2329,35 +2361,35 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
}
};
- DFA.State s371 = new DFA.State() {{alt=5;}};
- DFA.State s333 = new DFA.State() {
+ DFA.State s381 = new DFA.State() {{alt=5;}};
+ DFA.State s343 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_333 = input.LA(1);
- if ( (LA12_333>='0' && LA12_333<='9')||(LA12_333>='A' && LA12_333<='Z')||LA12_333=='_'||(LA12_333>='a' && LA12_333<='z') ) {return s41;}
- return s371;
+ int LA12_343 = input.LA(1);
+ if ( (LA12_343>='0' && LA12_343<='9')||(LA12_343>='A' && LA12_343<='Z')||LA12_343=='_'||(LA12_343>='a' && LA12_343<='z') ) {return s41;}
+ return s381;
}
};
- DFA.State s283 = new DFA.State() {
+ DFA.State s290 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_283 = input.LA(1);
- if ( LA12_283=='l' ) {return s333;}
+ int LA12_290 = input.LA(1);
+ if ( LA12_290=='l' ) {return s343;}
return s41;
}
};
- DFA.State s218 = new DFA.State() {
+ DFA.State s222 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_218 = input.LA(1);
- if ( LA12_218=='a' ) {return s283;}
+ int LA12_222 = input.LA(1);
+ if ( LA12_222=='a' ) {return s290;}
return s41;
}
};
- DFA.State s144 = new DFA.State() {
+ DFA.State s145 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_144 = input.LA(1);
- if ( LA12_144=='b' ) {return s218;}
+ int LA12_145 = input.LA(1);
+ if ( LA12_145=='b' ) {return s222;}
return s41;
}
@@ -2365,7 +2397,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s56 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_56 = input.LA(1);
- if ( LA12_56=='o' ) {return s144;}
+ if ( LA12_56=='o' ) {return s145;}
return s41;
}
@@ -2378,84 +2410,84 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
- DFA.State s418 = new DFA.State() {{alt=6;}};
- DFA.State s399 = new DFA.State() {
+ DFA.State s308 = new DFA.State() {{alt=49;}};
+ DFA.State s293 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_399 = input.LA(1);
- if ( (LA12_399>='0' && LA12_399<='9')||(LA12_399>='A' && LA12_399<='Z')||LA12_399=='_'||(LA12_399>='a' && LA12_399<='z') ) {return s41;}
- return s418;
+ int LA12_293 = input.LA(1);
+ if ( (LA12_293>='0' && LA12_293<='9')||(LA12_293>='A' && LA12_293<='Z')||LA12_293=='_'||(LA12_293>='a' && LA12_293<='z') ) {return s41;}
+ return s308;
}
};
- DFA.State s373 = new DFA.State() {
+ DFA.State s225 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_373 = input.LA(1);
- if ( LA12_373=='n' ) {return s399;}
+ int LA12_225 = input.LA(1);
+ if ( LA12_225=='e' ) {return s293;}
return s41;
}
};
- DFA.State s336 = new DFA.State() {
+ DFA.State s148 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_336 = input.LA(1);
- if ( LA12_336=='o' ) {return s373;}
+ int LA12_148 = input.LA(1);
+ if ( LA12_148=='s' ) {return s225;}
return s41;
}
};
- DFA.State s286 = new DFA.State() {
+ DFA.State s59 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_286 = input.LA(1);
- if ( LA12_286=='i' ) {return s336;}
+ int LA12_59 = input.LA(1);
+ if ( LA12_59=='l' ) {return s148;}
return s41;
}
};
- DFA.State s221 = new DFA.State() {
+ DFA.State s428 = new DFA.State() {{alt=6;}};
+ DFA.State s409 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_221 = input.LA(1);
- if ( LA12_221=='t' ) {return s286;}
- return s41;
+ int LA12_409 = input.LA(1);
+ if ( (LA12_409>='0' && LA12_409<='9')||(LA12_409>='A' && LA12_409<='Z')||LA12_409=='_'||(LA12_409>='a' && LA12_409<='z') ) {return s41;}
+ return s428;
}
};
- DFA.State s147 = new DFA.State() {
+ DFA.State s383 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_147 = input.LA(1);
- if ( LA12_147=='c' ) {return s221;}
+ int LA12_383 = input.LA(1);
+ if ( LA12_383=='n' ) {return s409;}
return s41;
}
};
- DFA.State s59 = new DFA.State() {
+ DFA.State s348 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_59 = input.LA(1);
- if ( LA12_59=='n' ) {return s147;}
+ int LA12_348 = input.LA(1);
+ if ( LA12_348=='o' ) {return s383;}
return s41;
}
};
- DFA.State s301 = new DFA.State() {{alt=48;}};
- DFA.State s289 = new DFA.State() {
+ DFA.State s296 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_289 = input.LA(1);
- if ( (LA12_289>='0' && LA12_289<='9')||(LA12_289>='A' && LA12_289<='Z')||LA12_289=='_'||(LA12_289>='a' && LA12_289<='z') ) {return s41;}
- return s301;
+ int LA12_296 = input.LA(1);
+ if ( LA12_296=='i' ) {return s348;}
+ return s41;
}
};
- DFA.State s224 = new DFA.State() {
+ DFA.State s228 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_224 = input.LA(1);
- if ( LA12_224=='e' ) {return s289;}
+ int LA12_228 = input.LA(1);
+ if ( LA12_228=='t' ) {return s296;}
return s41;
}
};
- DFA.State s150 = new DFA.State() {
+ DFA.State s151 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_150 = input.LA(1);
- if ( LA12_150=='s' ) {return s224;}
+ int LA12_151 = input.LA(1);
+ if ( LA12_151=='c' ) {return s228;}
return s41;
}
@@ -2463,7 +2495,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s60 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_60 = input.LA(1);
- if ( LA12_60=='l' ) {return s150;}
+ if ( LA12_60=='n' ) {return s151;}
return s41;
}
@@ -2471,10 +2503,10 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s6 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
- case 'u':
+ case 'a':
return s59;
- case 'a':
+ case 'u':
return s60;
default:
@@ -2508,27 +2540,27 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
- DFA.State s341 = new DFA.State() {{alt=12;}};
- DFA.State s292 = new DFA.State() {
+ DFA.State s351 = new DFA.State() {{alt=12;}};
+ DFA.State s299 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_292 = input.LA(1);
- if ( (LA12_292>='0' && LA12_292<='9')||(LA12_292>='A' && LA12_292<='Z')||LA12_292=='_'||(LA12_292>='a' && LA12_292<='z') ) {return s41;}
- return s341;
+ int LA12_299 = input.LA(1);
+ if ( (LA12_299>='0' && LA12_299<='9')||(LA12_299>='A' && LA12_299<='Z')||LA12_299=='_'||(LA12_299>='a' && LA12_299<='z') ) {return s41;}
+ return s351;
}
};
- DFA.State s227 = new DFA.State() {
+ DFA.State s231 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_227 = input.LA(1);
- if ( LA12_227=='y' ) {return s292;}
+ int LA12_231 = input.LA(1);
+ if ( LA12_231=='y' ) {return s299;}
return s41;
}
};
- DFA.State s153 = new DFA.State() {
+ DFA.State s154 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_153 = input.LA(1);
- if ( LA12_153=='r' ) {return s227;}
+ int LA12_154 = input.LA(1);
+ if ( LA12_154=='r' ) {return s231;}
return s41;
}
@@ -2536,7 +2568,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s66 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_66 = input.LA(1);
- if ( LA12_66=='e' ) {return s153;}
+ if ( LA12_66=='e' ) {return s154;}
return s41;
}
@@ -2549,19 +2581,19 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
- DFA.State s295 = new DFA.State() {{alt=14;}};
- DFA.State s230 = new DFA.State() {
+ DFA.State s302 = new DFA.State() {{alt=14;}};
+ DFA.State s234 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_230 = input.LA(1);
- if ( (LA12_230>='0' && LA12_230<='9')||(LA12_230>='A' && LA12_230<='Z')||LA12_230=='_'||(LA12_230>='a' && LA12_230<='z') ) {return s41;}
- return s295;
+ int LA12_234 = input.LA(1);
+ if ( (LA12_234>='0' && LA12_234<='9')||(LA12_234>='A' && LA12_234<='Z')||LA12_234=='_'||(LA12_234>='a' && LA12_234<='z') ) {return s41;}
+ return s302;
}
};
- DFA.State s156 = new DFA.State() {
+ DFA.State s157 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_156 = input.LA(1);
- if ( LA12_156=='e' ) {return s230;}
+ int LA12_157 = input.LA(1);
+ if ( LA12_157=='e' ) {return s234;}
return s41;
}
@@ -2569,7 +2601,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s69 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_69 = input.LA(1);
- if ( LA12_69=='l' ) {return s156;}
+ if ( LA12_69=='l' ) {return s157;}
return s41;
}
@@ -2582,19 +2614,19 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
- DFA.State s297 = new DFA.State() {{alt=15;}};
- DFA.State s233 = new DFA.State() {
+ DFA.State s304 = new DFA.State() {{alt=15;}};
+ DFA.State s237 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_233 = input.LA(1);
- if ( (LA12_233>='0' && LA12_233<='9')||(LA12_233>='A' && LA12_233<='Z')||LA12_233=='_'||(LA12_233>='a' && LA12_233<='z') ) {return s41;}
- return s297;
+ int LA12_237 = input.LA(1);
+ if ( (LA12_237>='0' && LA12_237<='9')||(LA12_237>='A' && LA12_237<='Z')||LA12_237=='_'||(LA12_237>='a' && LA12_237<='z') ) {return s41;}
+ return s304;
}
};
- DFA.State s159 = new DFA.State() {
+ DFA.State s160 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_159 = input.LA(1);
- if ( LA12_159=='n' ) {return s233;}
+ int LA12_160 = input.LA(1);
+ if ( LA12_160=='n' ) {return s237;}
return s41;
}
@@ -2602,7 +2634,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s72 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_72 = input.LA(1);
- if ( LA12_72=='e' ) {return s159;}
+ if ( LA12_72=='e' ) {return s160;}
return s41;
}
@@ -2616,19 +2648,19 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
DFA.State s15 = new DFA.State() {{alt=16;}};
- DFA.State s299 = new DFA.State() {{alt=17;}};
- DFA.State s236 = new DFA.State() {
+ DFA.State s306 = new DFA.State() {{alt=17;}};
+ DFA.State s240 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_236 = input.LA(1);
- if ( (LA12_236>='0' && LA12_236<='9')||(LA12_236>='A' && LA12_236<='Z')||LA12_236=='_'||(LA12_236>='a' && LA12_236<='z') ) {return s41;}
- return s299;
+ int LA12_240 = input.LA(1);
+ if ( (LA12_240>='0' && LA12_240<='9')||(LA12_240>='A' && LA12_240<='Z')||LA12_240=='_'||(LA12_240>='a' && LA12_240<='z') ) {return s41;}
+ return s306;
}
};
- DFA.State s162 = new DFA.State() {
+ DFA.State s163 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_162 = input.LA(1);
- if ( LA12_162=='n' ) {return s236;}
+ int LA12_163 = input.LA(1);
+ if ( LA12_163=='n' ) {return s240;}
return s41;
}
@@ -2636,23 +2668,23 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s75 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_75 = input.LA(1);
- if ( LA12_75=='e' ) {return s162;}
+ if ( LA12_75=='e' ) {return s163;}
return s41;
}
};
- DFA.State s239 = new DFA.State() {
+ DFA.State s243 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_239 = input.LA(1);
- if ( (LA12_239>='0' && LA12_239<='9')||(LA12_239>='A' && LA12_239<='Z')||LA12_239=='_'||(LA12_239>='a' && LA12_239<='z') ) {return s41;}
- return s301;
+ int LA12_243 = input.LA(1);
+ if ( (LA12_243>='0' && LA12_243<='9')||(LA12_243>='A' && LA12_243<='Z')||LA12_243=='_'||(LA12_243>='a' && LA12_243<='z') ) {return s41;}
+ return s308;
}
};
- DFA.State s165 = new DFA.State() {
+ DFA.State s166 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_165 = input.LA(1);
- if ( LA12_165=='e' ) {return s239;}
+ int LA12_166 = input.LA(1);
+ if ( LA12_166=='e' ) {return s243;}
return s41;
}
@@ -2660,7 +2692,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s76 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_76 = input.LA(1);
- if ( LA12_76=='u' ) {return s165;}
+ if ( LA12_76=='u' ) {return s166;}
return s41;
}
@@ -2679,133 +2711,158 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
}
};
- DFA.State s376 = new DFA.State() {{alt=22;}};
- DFA.State s343 = new DFA.State() {
+ DFA.State s246 = new DFA.State() {{alt=36;}};
+ DFA.State s169 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_343 = input.LA(1);
- if ( LA12_343=='-' ) {return s376;}
+ int LA12_169 = input.LA(1);
+ if ( (LA12_169>='0' && LA12_169<='9')||(LA12_169>='A' && LA12_169<='Z')||LA12_169=='_'||(LA12_169>='a' && LA12_169<='z') ) {return s41;}
+ return s246;
+
+ }
+ };
+ DFA.State s79 = new DFA.State() {
+ public DFA.State transition(IntStream input) throws RecognitionException {
+ int LA12_79 = input.LA(1);
+ if ( LA12_79=='d' ) {return s169;}
return s41;
}
};
- DFA.State s303 = new DFA.State() {
+ DFA.State s310 = new DFA.State() {{alt=21;}};
+ DFA.State s248 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_303 = input.LA(1);
- if ( LA12_303=='a' ) {return s343;}
+ int LA12_248 = input.LA(1);
+ if ( LA12_248=='-' ) {return s310;}
return s41;
}
};
- DFA.State s242 = new DFA.State() {
+ DFA.State s172 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_242 = input.LA(1);
- if ( LA12_242=='d' ) {return s303;}
+ int LA12_172 = input.LA(1);
+ if ( LA12_172=='o' ) {return s248;}
return s41;
}
};
- DFA.State s168 = new DFA.State() {
+ DFA.State s80 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_168 = input.LA(1);
- if ( LA12_168=='n' ) {return s242;}
+ int LA12_80 = input.LA(1);
+ if ( LA12_80=='t' ) {return s172;}
return s41;
}
};
- DFA.State s79 = new DFA.State() {
+ DFA.State s386 = new DFA.State() {{alt=23;}};
+ DFA.State s353 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_79 = input.LA(1);
- if ( LA12_79=='e' ) {return s168;}
+ int LA12_353 = input.LA(1);
+ if ( LA12_353=='-' ) {return s386;}
return s41;
}
};
- DFA.State s245 = new DFA.State() {{alt=35;}};
- DFA.State s171 = new DFA.State() {
+ DFA.State s313 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_171 = input.LA(1);
- if ( (LA12_171>='0' && LA12_171<='9')||(LA12_171>='A' && LA12_171<='Z')||LA12_171=='_'||(LA12_171>='a' && LA12_171<='z') ) {return s41;}
- return s245;
+ int LA12_313 = input.LA(1);
+ if ( LA12_313=='a' ) {return s353;}
+ return s41;
}
};
- DFA.State s80 = new DFA.State() {
+ DFA.State s251 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_80 = input.LA(1);
- if ( LA12_80=='d' ) {return s171;}
+ int LA12_251 = input.LA(1);
+ if ( LA12_251=='d' ) {return s313;}
return s41;
}
};
- DFA.State s432 = new DFA.State() {{alt=18;}};
- DFA.State s429 = new DFA.State() {
+ DFA.State s175 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_429 = input.LA(1);
- if ( (LA12_429>='0' && LA12_429<='9')||(LA12_429>='A' && LA12_429<='Z')||LA12_429=='_'||(LA12_429>='a' && LA12_429<='z') ) {return s41;}
- return s432;
+ int LA12_175 = input.LA(1);
+ if ( LA12_175=='n' ) {return s251;}
+ return s41;
}
};
- DFA.State s420 = new DFA.State() {
+ DFA.State s81 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_420 = input.LA(1);
- if ( LA12_420=='s' ) {return s429;}
+ int LA12_81 = input.LA(1);
+ if ( LA12_81=='e' ) {return s175;}
return s41;
}
};
- DFA.State s402 = new DFA.State() {
+ DFA.State s442 = new DFA.State() {{alt=18;}};
+ DFA.State s439 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_402 = input.LA(1);
- if ( LA12_402=='e' ) {return s420;}
+ int LA12_439 = input.LA(1);
+ if ( (LA12_439>='0' && LA12_439<='9')||(LA12_439>='A' && LA12_439<='Z')||LA12_439=='_'||(LA12_439>='a' && LA12_439<='z') ) {return s41;}
+ return s442;
+
+ }
+ };
+ DFA.State s430 = new DFA.State() {
+ public DFA.State transition(IntStream input) throws RecognitionException {
+ int LA12_430 = input.LA(1);
+ if ( LA12_430=='s' ) {return s439;}
return s41;
}
};
- DFA.State s379 = new DFA.State() {
+ DFA.State s412 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_379 = input.LA(1);
- if ( LA12_379=='t' ) {return s402;}
+ int LA12_412 = input.LA(1);
+ if ( LA12_412=='e' ) {return s430;}
return s41;
}
};
- DFA.State s346 = new DFA.State() {
+ DFA.State s389 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_346 = input.LA(1);
- if ( LA12_346=='u' ) {return s379;}
+ int LA12_389 = input.LA(1);
+ if ( LA12_389=='t' ) {return s412;}
return s41;
}
};
- DFA.State s306 = new DFA.State() {
+ DFA.State s356 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_306 = input.LA(1);
- if ( LA12_306=='b' ) {return s346;}
+ int LA12_356 = input.LA(1);
+ if ( LA12_356=='u' ) {return s389;}
return s41;
}
};
- DFA.State s247 = new DFA.State() {
+ DFA.State s316 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_247 = input.LA(1);
- if ( LA12_247=='i' ) {return s306;}
+ int LA12_316 = input.LA(1);
+ if ( LA12_316=='b' ) {return s356;}
return s41;
}
};
- DFA.State s174 = new DFA.State() {
+ DFA.State s254 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_174 = input.LA(1);
- if ( LA12_174=='r' ) {return s247;}
+ int LA12_254 = input.LA(1);
+ if ( LA12_254=='i' ) {return s316;}
return s41;
}
};
- DFA.State s81 = new DFA.State() {
+ DFA.State s178 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_81 = input.LA(1);
- if ( LA12_81=='t' ) {return s174;}
+ int LA12_178 = input.LA(1);
+ if ( LA12_178=='r' ) {return s254;}
+ return s41;
+
+ }
+ };
+ DFA.State s82 = new DFA.State() {
+ public DFA.State transition(IntStream input) throws RecognitionException {
+ int LA12_82 = input.LA(1);
+ if ( LA12_82=='t' ) {return s178;}
return s41;
}
@@ -2813,73 +2870,76 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s17 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
- case 'g':
+ case 'n':
return s79;
- case 'n':
+ case 'u':
return s80;
- case 't':
+ case 'g':
return s81;
+ case 't':
+ return s82;
+
default:
return s41;
}
}
};
- DFA.State s423 = new DFA.State() {{alt=19;}};
- DFA.State s405 = new DFA.State() {
+ DFA.State s433 = new DFA.State() {{alt=19;}};
+ DFA.State s415 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_405 = input.LA(1);
- if ( (LA12_405>='0' && LA12_405<='9')||(LA12_405>='A' && LA12_405<='Z')||LA12_405=='_'||(LA12_405>='a' && LA12_405<='z') ) {return s41;}
- return s423;
+ int LA12_415 = input.LA(1);
+ if ( (LA12_415>='0' && LA12_415<='9')||(LA12_415>='A' && LA12_415<='Z')||LA12_415=='_'||(LA12_415>='a' && LA12_415<='z') ) {return s41;}
+ return s433;
}
};
- DFA.State s382 = new DFA.State() {
+ DFA.State s392 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_382 = input.LA(1);
- if ( LA12_382=='e' ) {return s405;}
+ int LA12_392 = input.LA(1);
+ if ( LA12_392=='e' ) {return s415;}
return s41;
}
};
- DFA.State s349 = new DFA.State() {
+ DFA.State s359 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_349 = input.LA(1);
- if ( LA12_349=='c' ) {return s382;}
+ int LA12_359 = input.LA(1);
+ if ( LA12_359=='c' ) {return s392;}
return s41;
}
};
- DFA.State s309 = new DFA.State() {
+ DFA.State s319 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_309 = input.LA(1);
- if ( LA12_309=='n' ) {return s349;}
+ int LA12_319 = input.LA(1);
+ if ( LA12_319=='n' ) {return s359;}
return s41;
}
};
- DFA.State s250 = new DFA.State() {
+ DFA.State s257 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_250 = input.LA(1);
- if ( LA12_250=='e' ) {return s309;}
+ int LA12_257 = input.LA(1);
+ if ( LA12_257=='e' ) {return s319;}
return s41;
}
};
- DFA.State s177 = new DFA.State() {
+ DFA.State s181 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_177 = input.LA(1);
- if ( LA12_177=='i' ) {return s250;}
+ int LA12_181 = input.LA(1);
+ if ( LA12_181=='i' ) {return s257;}
return s41;
}
};
- DFA.State s84 = new DFA.State() {
+ DFA.State s85 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_84 = input.LA(1);
- if ( LA12_84=='l' ) {return s177;}
+ int LA12_85 = input.LA(1);
+ if ( LA12_85=='l' ) {return s181;}
return s41;
}
@@ -2887,29 +2947,29 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s18 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_18 = input.LA(1);
- if ( LA12_18=='a' ) {return s84;}
+ if ( LA12_18=='a' ) {return s85;}
return s41;
}
};
- DFA.State s180 = new DFA.State() {{alt=20;}};
- DFA.State s253 = new DFA.State() {{alt=38;}};
- DFA.State s181 = new DFA.State() {
+ DFA.State s260 = new DFA.State() {{alt=39;}};
+ DFA.State s184 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_181 = input.LA(1);
- if ( (LA12_181>='0' && LA12_181<='9')||(LA12_181>='A' && LA12_181<='Z')||LA12_181=='_'||(LA12_181>='a' && LA12_181<='z') ) {return s41;}
- return s253;
+ int LA12_184 = input.LA(1);
+ if ( (LA12_184>='0' && LA12_184<='9')||(LA12_184>='A' && LA12_184<='Z')||LA12_184=='_'||(LA12_184>='a' && LA12_184<='z') ) {return s41;}
+ return s260;
}
};
- DFA.State s87 = new DFA.State() {
+ DFA.State s185 = new DFA.State() {{alt=20;}};
+ DFA.State s88 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
- case '-':
- return s180;
-
case 't':
- return s181;
+ return s184;
+
+ case '-':
+ return s185;
default:
return s41;
@@ -2919,24 +2979,24 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s19 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_19 = input.LA(1);
- if ( LA12_19=='o' ) {return s87;}
+ if ( LA12_19=='o' ) {return s88;}
return s41;
}
};
- DFA.State s255 = new DFA.State() {{alt=21;}};
- DFA.State s184 = new DFA.State() {
+ DFA.State s262 = new DFA.State() {{alt=22;}};
+ DFA.State s188 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_184 = input.LA(1);
- if ( LA12_184=='-' ) {return s255;}
+ int LA12_188 = input.LA(1);
+ if ( LA12_188=='-' ) {return s262;}
return s41;
}
};
- DFA.State s90 = new DFA.State() {
+ DFA.State s91 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_90 = input.LA(1);
- if ( LA12_90=='r' ) {return s184;}
+ int LA12_91 = input.LA(1);
+ if ( LA12_91=='r' ) {return s188;}
return s41;
}
@@ -2944,64 +3004,64 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s20 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_20 = input.LA(1);
- if ( LA12_20=='o' ) {return s90;}
+ if ( LA12_20=='o' ) {return s91;}
return s41;
}
};
- DFA.State s425 = new DFA.State() {{alt=23;}};
- DFA.State s408 = new DFA.State() {
+ DFA.State s435 = new DFA.State() {{alt=24;}};
+ DFA.State s418 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_408 = input.LA(1);
- if ( (LA12_408>='0' && LA12_408<='9')||(LA12_408>='A' && LA12_408<='Z')||LA12_408=='_'||(LA12_408>='a' && LA12_408<='z') ) {return s41;}
- return s425;
+ int LA12_418 = input.LA(1);
+ if ( (LA12_418>='0' && LA12_418<='9')||(LA12_418>='A' && LA12_418<='Z')||LA12_418=='_'||(LA12_418>='a' && LA12_418<='z') ) {return s41;}
+ return s435;
}
};
- DFA.State s385 = new DFA.State() {
+ DFA.State s395 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_385 = input.LA(1);
- if ( LA12_385=='n' ) {return s408;}
+ int LA12_395 = input.LA(1);
+ if ( LA12_395=='n' ) {return s418;}
return s41;
}
};
- DFA.State s352 = new DFA.State() {
+ DFA.State s362 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_352 = input.LA(1);
- if ( LA12_352=='o' ) {return s385;}
+ int LA12_362 = input.LA(1);
+ if ( LA12_362=='o' ) {return s395;}
return s41;
}
};
- DFA.State s312 = new DFA.State() {
+ DFA.State s322 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_312 = input.LA(1);
- if ( LA12_312=='i' ) {return s352;}
+ int LA12_322 = input.LA(1);
+ if ( LA12_322=='i' ) {return s362;}
return s41;
}
};
- DFA.State s258 = new DFA.State() {
+ DFA.State s265 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_258 = input.LA(1);
- if ( LA12_258=='t' ) {return s312;}
+ int LA12_265 = input.LA(1);
+ if ( LA12_265=='t' ) {return s322;}
return s41;
}
};
- DFA.State s187 = new DFA.State() {
+ DFA.State s191 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_187 = input.LA(1);
- if ( LA12_187=='a' ) {return s258;}
+ int LA12_191 = input.LA(1);
+ if ( LA12_191=='a' ) {return s265;}
return s41;
}
};
- DFA.State s93 = new DFA.State() {
+ DFA.State s94 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_93 = input.LA(1);
- if ( LA12_93=='r' ) {return s187;}
+ int LA12_94 = input.LA(1);
+ if ( LA12_94=='r' ) {return s191;}
return s41;
}
@@ -3009,112 +3069,112 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s21 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_21 = input.LA(1);
- if ( LA12_21=='u' ) {return s93;}
+ if ( LA12_21=='u' ) {return s94;}
return s41;
}
};
- DFA.State s190 = new DFA.State() {{alt=24;}};
- DFA.State s96 = new DFA.State() {
+ DFA.State s194 = new DFA.State() {{alt=25;}};
+ DFA.State s97 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_96 = input.LA(1);
- if ( (LA12_96>='0' && LA12_96<='9')||(LA12_96>='A' && LA12_96<='Z')||LA12_96=='_'||(LA12_96>='a' && LA12_96<='z') ) {return s41;}
- return s190;
+ int LA12_97 = input.LA(1);
+ if ( (LA12_97>='0' && LA12_97<='9')||(LA12_97>='A' && LA12_97<='Z')||LA12_97=='_'||(LA12_97>='a' && LA12_97<='z') ) {return s41;}
+ return s194;
}
};
DFA.State s22 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_22 = input.LA(1);
- if ( LA12_22=='r' ) {return s96;}
+ if ( LA12_22=='r' ) {return s97;}
return s41;
}
};
- DFA.State s23 = new DFA.State() {{alt=25;}};
- DFA.State s99 = new DFA.State() {{alt=27;}};
- DFA.State s100 = new DFA.State() {{alt=26;}};
+ DFA.State s23 = new DFA.State() {{alt=26;}};
+ DFA.State s100 = new DFA.State() {{alt=28;}};
+ DFA.State s101 = new DFA.State() {{alt=27;}};
DFA.State s24 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_24 = input.LA(1);
- if ( LA12_24=='=' ) {return s99;}
- return s100;
+ if ( LA12_24=='=' ) {return s100;}
+ return s101;
}
};
- DFA.State s101 = new DFA.State() {{alt=29;}};
- DFA.State s102 = new DFA.State() {{alt=28;}};
+ DFA.State s102 = new DFA.State() {{alt=30;}};
+ DFA.State s103 = new DFA.State() {{alt=29;}};
DFA.State s25 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_25 = input.LA(1);
- if ( LA12_25=='=' ) {return s101;}
- return s102;
+ if ( LA12_25=='=' ) {return s102;}
+ return s103;
}
};
- DFA.State s103 = new DFA.State() {{alt=30;}};
- DFA.State s40 = new DFA.State() {{alt=42;}};
+ DFA.State s104 = new DFA.State() {{alt=31;}};
+ DFA.State s40 = new DFA.State() {{alt=43;}};
DFA.State s26 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_26 = input.LA(1);
- if ( LA12_26=='=' ) {return s103;}
+ if ( LA12_26=='=' ) {return s104;}
return s40;
}
};
- DFA.State s427 = new DFA.State() {{alt=31;}};
- DFA.State s411 = new DFA.State() {
+ DFA.State s437 = new DFA.State() {{alt=32;}};
+ DFA.State s421 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_411 = input.LA(1);
- if ( (LA12_411>='0' && LA12_411<='9')||(LA12_411>='A' && LA12_411<='Z')||LA12_411=='_'||(LA12_411>='a' && LA12_411<='z') ) {return s41;}
- return s427;
+ int LA12_421 = input.LA(1);
+ if ( (LA12_421>='0' && LA12_421<='9')||(LA12_421>='A' && LA12_421<='Z')||LA12_421=='_'||(LA12_421>='a' && LA12_421<='z') ) {return s41;}
+ return s437;
}
};
- DFA.State s388 = new DFA.State() {
+ DFA.State s398 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_388 = input.LA(1);
- if ( LA12_388=='s' ) {return s411;}
+ int LA12_398 = input.LA(1);
+ if ( LA12_398=='s' ) {return s421;}
return s41;
}
};
- DFA.State s355 = new DFA.State() {
+ DFA.State s365 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_355 = input.LA(1);
- if ( LA12_355=='n' ) {return s388;}
+ int LA12_365 = input.LA(1);
+ if ( LA12_365=='n' ) {return s398;}
return s41;
}
};
- DFA.State s315 = new DFA.State() {
+ DFA.State s325 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_315 = input.LA(1);
- if ( LA12_315=='i' ) {return s355;}
+ int LA12_325 = input.LA(1);
+ if ( LA12_325=='i' ) {return s365;}
return s41;
}
};
- DFA.State s261 = new DFA.State() {
+ DFA.State s268 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_261 = input.LA(1);
- if ( LA12_261=='a' ) {return s315;}
+ int LA12_268 = input.LA(1);
+ if ( LA12_268=='a' ) {return s325;}
return s41;
}
};
- DFA.State s192 = new DFA.State() {
+ DFA.State s196 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_192 = input.LA(1);
- if ( LA12_192=='t' ) {return s261;}
+ int LA12_196 = input.LA(1);
+ if ( LA12_196=='t' ) {return s268;}
return s41;
}
};
- DFA.State s105 = new DFA.State() {
+ DFA.State s106 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_105 = input.LA(1);
- if ( LA12_105=='n' ) {return s192;}
+ int LA12_106 = input.LA(1);
+ if ( LA12_106=='n' ) {return s196;}
return s41;
}
@@ -3122,56 +3182,56 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s27 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_27 = input.LA(1);
- if ( LA12_27=='o' ) {return s105;}
+ if ( LA12_27=='o' ) {return s106;}
return s41;
}
};
- DFA.State s414 = new DFA.State() {{alt=32;}};
- DFA.State s391 = new DFA.State() {
+ DFA.State s424 = new DFA.State() {{alt=33;}};
+ DFA.State s401 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_391 = input.LA(1);
- if ( (LA12_391>='0' && LA12_391<='9')||(LA12_391>='A' && LA12_391<='Z')||LA12_391=='_'||(LA12_391>='a' && LA12_391<='z') ) {return s41;}
- return s414;
+ int LA12_401 = input.LA(1);
+ if ( (LA12_401>='0' && LA12_401<='9')||(LA12_401>='A' && LA12_401<='Z')||LA12_401=='_'||(LA12_401>='a' && LA12_401<='z') ) {return s41;}
+ return s424;
}
};
- DFA.State s358 = new DFA.State() {
+ DFA.State s368 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_358 = input.LA(1);
- if ( LA12_358=='s' ) {return s391;}
+ int LA12_368 = input.LA(1);
+ if ( LA12_368=='s' ) {return s401;}
return s41;
}
};
- DFA.State s318 = new DFA.State() {
+ DFA.State s328 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_318 = input.LA(1);
- if ( LA12_318=='e' ) {return s358;}
+ int LA12_328 = input.LA(1);
+ if ( LA12_328=='e' ) {return s368;}
return s41;
}
};
- DFA.State s264 = new DFA.State() {
+ DFA.State s271 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_264 = input.LA(1);
- if ( LA12_264=='h' ) {return s318;}
+ int LA12_271 = input.LA(1);
+ if ( LA12_271=='h' ) {return s328;}
return s41;
}
};
- DFA.State s195 = new DFA.State() {
+ DFA.State s199 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_195 = input.LA(1);
- if ( LA12_195=='c' ) {return s264;}
+ int LA12_199 = input.LA(1);
+ if ( LA12_199=='c' ) {return s271;}
return s41;
}
};
- DFA.State s108 = new DFA.State() {
+ DFA.State s109 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_108 = input.LA(1);
- if ( LA12_108=='t' ) {return s195;}
+ int LA12_109 = input.LA(1);
+ if ( LA12_109=='t' ) {return s199;}
return s41;
}
@@ -3179,18 +3239,18 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s28 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_28 = input.LA(1);
- if ( LA12_28=='a' ) {return s108;}
+ if ( LA12_28=='a' ) {return s109;}
return s41;
}
};
- DFA.State s111 = new DFA.State() {{alt=33;}};
- DFA.State s113 = new DFA.State() {{alt=45;}};
+ DFA.State s112 = new DFA.State() {{alt=34;}};
+ DFA.State s114 = new DFA.State() {{alt=46;}};
DFA.State s29 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
case '>':
- return s111;
+ return s112;
case '0':
case '1':
@@ -3202,45 +3262,45 @@ public DFA.State transition(IntStream input) throws RecognitionException {
case '7':
case '8':
case '9':
- return s113;
+ return s114;
default:
return s40;
}
}
};
- DFA.State s114 = new DFA.State() {{alt=34;}};
+ DFA.State s115 = new DFA.State() {{alt=35;}};
DFA.State s30 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_30 = input.LA(1);
- if ( LA12_30=='|' ) {return s114;}
+ if ( LA12_30=='|' ) {return s115;}
return s40;
}
};
- DFA.State s116 = new DFA.State() {{alt=36;}};
+ DFA.State s117 = new DFA.State() {{alt=37;}};
DFA.State s31 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_31 = input.LA(1);
- if ( LA12_31=='&' ) {return s116;}
+ if ( LA12_31=='&' ) {return s117;}
return s40;
}
};
- DFA.State s32 = new DFA.State() {{alt=40;}};
- DFA.State s267 = new DFA.State() {{alt=41;}};
- DFA.State s198 = new DFA.State() {
+ DFA.State s32 = new DFA.State() {{alt=41;}};
+ DFA.State s274 = new DFA.State() {{alt=42;}};
+ DFA.State s202 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_198 = input.LA(1);
- if ( (LA12_198>='0' && LA12_198<='9')||(LA12_198>='A' && LA12_198<='Z')||LA12_198=='_'||(LA12_198>='a' && LA12_198<='z') ) {return s41;}
- return s267;
+ int LA12_202 = input.LA(1);
+ if ( (LA12_202>='0' && LA12_202<='9')||(LA12_202>='A' && LA12_202<='Z')||LA12_202=='_'||(LA12_202>='a' && LA12_202<='z') ) {return s41;}
+ return s274;
}
};
- DFA.State s118 = new DFA.State() {
+ DFA.State s119 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
- int LA12_118 = input.LA(1);
- if ( LA12_118=='e' ) {return s198;}
+ int LA12_119 = input.LA(1);
+ if ( LA12_119=='e' ) {return s202;}
return s41;
}
@@ -3248,7 +3308,7 @@ public DFA.State transition(IntStream input) throws RecognitionException {
DFA.State s33 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_33 = input.LA(1);
- if ( LA12_33=='s' ) {return s118;}
+ if ( LA12_33=='s' ) {return s119;}
return s41;
}
@@ -3261,14 +3321,14 @@ public DFA.State transition(IntStream input) throws RecognitionException {
}
};
- DFA.State s35 = new DFA.State() {{alt=43;}};
- DFA.State s36 = new DFA.State() {{alt=44;}};
- DFA.State s123 = new DFA.State() {{alt=46;}};
+ DFA.State s35 = new DFA.State() {{alt=44;}};
+ DFA.State s36 = new DFA.State() {{alt=45;}};
+ DFA.State s124 = new DFA.State() {{alt=47;}};
DFA.State s38 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
switch ( input.LA(1) ) {
case '.':
- return s123;
+ return s124;
case '0':
case '1':
@@ -3283,19 +3343,19 @@ public DFA.State transition(IntStream input) throws RecognitionException {
return s38;
default:
- return s113;
+ return s114;
}
}
};
- DFA.State s39 = new DFA.State() {{alt=47;}};
- DFA.State s42 = new DFA.State() {{alt=50;}};
- DFA.State s126 = new DFA.State() {{alt=51;}};
+ DFA.State s39 = new DFA.State() {{alt=48;}};
+ DFA.State s42 = new DFA.State() {{alt=51;}};
DFA.State s127 = new DFA.State() {{alt=52;}};
+ DFA.State s128 = new DFA.State() {{alt=53;}};
DFA.State s43 = new DFA.State() {
public DFA.State transition(IntStream input) throws RecognitionException {
int LA12_43 = input.LA(1);
- if ( LA12_43=='/' ) {return s126;}
- if ( LA12_43=='*' ) {return s127;}
+ if ( LA12_43=='/' ) {return s127;}
+ if ( LA12_43=='*' ) {return s128;}
NoViableAltException nvae =
new NoViableAltException("", 12, 43, input);
diff --git a/drools-compiler/src/main/resources/org/drools/lang/drl.g b/drools-compiler/src/main/resources/org/drools/lang/drl.g
index 0ef4783694f..0381d34d646 100644
--- a/drools-compiler/src/main/resources/org/drools/lang/drl.g
+++ b/drools-compiler/src/main/resources/org/drools/lang/drl.g
@@ -272,6 +272,7 @@ rule_attribute returns [AttributeDescr d]
| a=agenda_group { d = a; }
| a=duration { d = a; }
| a=xor_group { d = a; }
+ | a=auto_focus { d = a; }
;
@@ -311,6 +312,30 @@ no_loop returns [AttributeDescr d]
;
+auto_focus returns [AttributeDescr d]
+ @init {
+ d = null;
+ }
+ :
+ (
+ loc='auto-focus' opt_eol ';'? opt_eol
+ {
+ d = new AttributeDescr( "auto-focus", "true" );
+ d.setLocation( loc.getLine(), loc.getCharPositionInLine() );
+ }
+ )
+ |
+ (
+ loc='auto-focus' t=BOOL opt_eol ';'? opt_eol
+ {
+ d = new AttributeDescr( "auto-focus", t.getText() );
+ d.setLocation( loc.getLine(), loc.getCharPositionInLine() );
+ }
+
+ )
+
+ ;
+
xor_group returns [AttributeDescr d]
@init {
d = null;
diff --git a/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java b/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java
index c15dedbf4a1..dee0fbee4d6 100644
--- a/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java
+++ b/drools-compiler/src/test/java/org/drools/lang/RuleParserTest.java
@@ -100,6 +100,20 @@ public void testNoLoop() throws Exception {
}
+
+ public void testAutofocus() throws Exception {
+ RuleDescr rule = parseResource( "autofocus.drl" ).rule();
+
+ assertNotNull( rule );
+
+ assertEquals( "rule1", rule.getName() );
+ AttributeDescr att = (AttributeDescr) rule.getAttributes().get( 0 );
+ assertEquals("true", att.getValue());
+ assertEquals("auto-focus", att.getName());
+
+
+ }
+
//TODO: uncomment this when antlr bug resolved
public void XXXtestConsequenceWithDeclaration() throws Exception {
diff --git a/drools-compiler/src/test/resources/org/drools/lang/autofocus.drl b/drools-compiler/src/test/resources/org/drools/lang/autofocus.drl
new file mode 100644
index 00000000000..dd741274674
--- /dev/null
+++ b/drools-compiler/src/test/resources/org/drools/lang/autofocus.drl
@@ -0,0 +1,8 @@
+
+rule rule1
+ auto-focus true
+ when
+ not Cheese(type == "stilton")
+ then
+ funky();
+end
\ No newline at end of file
|
1f9fb52c7c71ad74b48797f1655ca5b7636e77c3
|
Valadoc
|
driver/0.18.x: Add support for vala-0.17.1+
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/configure.in b/configure.in
index 488792919c..38bb5f9b65 100644
--- a/configure.in
+++ b/configure.in
@@ -62,12 +62,18 @@ AC_SUBST(LIBGDKPIXBUF_LIBS)
## Drivers:
##
-PKG_CHECK_MODULES(LIBVALA_0_18_X, libvala-0.18 >= 0.17.0, have_libvala_0_18_x="yes", have_libvala_0_18_x="no")
+PKG_CHECK_MODULES(LIBVALA_0_18_X, libvala-0.18 >= 0.17.1, have_libvala_0_18_x="yes", have_libvala_0_18_x="no")
AM_CONDITIONAL(HAVE_LIBVALA_0_18_X, test "$have_libvala_0_18_x" = "yes")
AC_SUBST(LIBVALA_0_18_X_CFLAGS)
AC_SUBST(LIBVALA_0_18_X_LIBS)
+PKG_CHECK_MODULES(LIBVALA_0_17_0, libvala-0.18 = 0.17.0, have_libvala_0_17_0="yes", have_libvala_0_17_0="no")
+AM_CONDITIONAL(HAVE_LIBVALA_0_17_0, test "$have_libvala_0_17_0" = "yes")
+AC_SUBST(LIBVALA_0_17_0_CFLAGS)
+AC_SUBST(LIBVALA_0_17_0_LIBS)
+
+
PKG_CHECK_MODULES(LIBVALA_0_16_X, libvala-0.16 >= 0.15.1, have_libvala_0_16_x="yes", have_libvala_0_16_x="no")
AM_CONDITIONAL(HAVE_LIBVALA_0_16_X, test "$have_libvala_0_16_x" = "yes")
AC_SUBST(LIBVALA_0_16_X_CFLAGS)
diff --git a/src/driver/0.18.x/Makefile.am b/src/driver/0.18.x/Makefile.am
index c8ee3fd0c4..9958cf36c8 100644
--- a/src/driver/0.18.x/Makefile.am
+++ b/src/driver/0.18.x/Makefile.am
@@ -5,6 +5,11 @@ NULL =
VERSIONED_VAPI_DIR=`pkg-config libvala-0.18 --variable vapidir`
+if HAVE_LIBVALA_0_17_0
+VALA_FLAGS = -D VALA_0_17_0
+endif
+
+
AM_CFLAGS = -g \
-DPACKAGE_ICONDIR=\"$(datadir)/valadoc/icons/\" \
@@ -12,6 +17,8 @@ AM_CFLAGS = -g \
$(GLIB_CFLAGS) \
$(LIBGEE_CFLAGS) \
$(LIBVALA_0_18_X_CFLAGS) \
+ $(LIBVALA_0_17_1_CFLAGS) \
+ $(LIBVALA_0_17_0_CFLAGS) \
$(NULL)
@@ -54,6 +61,8 @@ libdriver_la_LIBADD = \
../../libvaladoc/libvaladoc.la \
$(GLIB_LIBS) \
$(LIBVALA_0_18_X_LIBS) \
+ $(LIBVALA_0_17_1_LIBS) \
+ $(LIBVALA_0_17_0_LIBS) \
$(LIBGEE_LIBS) \
$(NULL)
diff --git a/src/driver/0.18.x/treebuilder.vala b/src/driver/0.18.x/treebuilder.vala
index 3a1fb0385b..dcfae0bd06 100644
--- a/src/driver/0.18.x/treebuilder.vala
+++ b/src/driver/0.18.x/treebuilder.vala
@@ -83,9 +83,17 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
if (c.source_reference.file == vns.source_reference.file) {
Vala.SourceReference pos = c.source_reference;
if (c is Vala.GirComment) {
+#if VALA_0_17_0
comment = new GirSourceComment (c.content, file, pos.first_line, pos.first_column, pos.last_line, pos.last_column);
+#else
+ comment = new GirSourceComment (c.content, file, pos.begin.line, pos.begin.column, pos.end.line, pos.end.column);
+#endif
} else {
+#if VALA_0_17_0
comment = new SourceComment (c.content, file, pos.first_line, pos.first_column, pos.last_line, pos.last_column);
+#else
+ comment = new SourceComment (c.content, file, pos.begin.line, pos.begin.column, pos.end.line, pos.end.column);
+#endif
}
break;
}
@@ -295,22 +303,38 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
Vala.SourceReference pos = comment.source_reference;
SourceFile file = files.get (pos.file);
if (comment is Vala.GirComment) {
+#if VALA_0_17_0
var tmp = new GirSourceComment (comment.content, file, pos.first_line, pos.first_column, pos.last_line, pos.last_column);
+#else
+ var tmp = new GirSourceComment (comment.content, file, pos.begin.line, pos.begin.column, pos.end.line, pos.end.column);
+#endif
if (((Vala.GirComment) comment).return_content != null) {
Vala.SourceReference return_pos = ((Vala.GirComment) comment).return_content.source_reference;
+#if VALA_0_17_0
tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content, file, return_pos.first_line, return_pos.first_column, return_pos.last_line, return_pos.last_column);
+#else
+ tmp.return_comment = new SourceComment (((Vala.GirComment) comment).return_content.content, file, return_pos.begin.line, return_pos.begin.column, return_pos.end.line, return_pos.end.column);
+#endif
}
Vala.MapIterator<string, Vala.Comment> it = ((Vala.GirComment) comment).parameter_iterator ();
while (it.next ()) {
Vala.Comment vala_param = it.get_value ();
Vala.SourceReference param_pos = vala_param.source_reference;
+#if VALA_0_17_0
var param_comment = new SourceComment (vala_param.content, file, param_pos.first_line, param_pos.first_column, param_pos.last_line, param_pos.last_column);
+#else
+ var param_comment = new SourceComment (vala_param.content, file, param_pos.begin.line, param_pos.begin.column, param_pos.end.line, param_pos.end.column);
+#endif
tmp.add_parameter_content (it.get_key (), param_comment);
}
return tmp;
} else {
+#if VALA_0_17_0
return new SourceComment (comment.content, file, pos.first_line, pos.first_column, pos.last_line, pos.last_column);
+#else
+ return new SourceComment (comment.content, file, pos.begin.line, pos.begin.column, pos.end.line, pos.end.column);
+#endif
}
}
diff --git a/src/driver/Makefile.am b/src/driver/Makefile.am
index ada5a150ed..34f992dfef 100644
--- a/src/driver/Makefile.am
+++ b/src/driver/Makefile.am
@@ -34,6 +34,10 @@ if HAVE_LIBVALA_0_16_X
DRIVER_0_16_X_DIR = 0.16.x
endif
+if HAVE_LIBVALA_0_17_0
+DRIVER_0_18_X_DIR = 0.18.x
+endif
+
if HAVE_LIBVALA_0_18_X
DRIVER_0_18_X_DIR = 0.18.x
endif
|
c12028b5b932403ea2ce77a45ad699a013b8d488
|
hbase
|
HBASE-2057 Cluster won't stop--git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@894111 13f79535-47bb-0310-9956-ffa450edef68-
|
c
|
https://github.com/apache/hbase
|
diff --git a/src/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java b/src/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java
index 49f783dfc87b..fccf46d93896 100644
--- a/src/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java
+++ b/src/java/org/apache/hadoop/hbase/master/ZKMasterAddressWatcher.java
@@ -110,6 +110,7 @@ boolean writeAddressToZooKeeper(
}
if(this.zookeeper.writeMasterAddress(address)) {
this.zookeeper.setClusterState(true);
+ this.zookeeper.setClusterStateWatch(this);
// Watch our own node
this.zookeeper.readMasterAddress(this);
return true;
|
0d1908fbb2a1e5d68b1b38b0feaa1f1a40e76d5b
|
orientdb
|
Fixed a bug on browsing clusters in transaction- as issue https://github.com/tinkerpop/blueprints/issues/312--
|
c
|
https://github.com/orientechnologies/orientdb
|
diff --git a/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorCluster.java b/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorCluster.java
index eee78457d84..43e1c1231f8 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorCluster.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorCluster.java
@@ -43,7 +43,7 @@ public ORecordIteratorCluster(final ODatabaseRecord iDatabase, final ODatabaseRe
totalAvailableRecords = database.countClusterElements(current.clusterId);
- txEntries = iDatabase.getTransaction().getRecordEntriesByClusterIds(new int[] { iClusterId });
+ txEntries = iDatabase.getTransaction().getNewRecordEntriesByClusterIds(new int[] { iClusterId });
if (txEntries != null)
// ADJUST TOTAL ELEMENT BASED ON CURRENT TRANSACTION'S ENTRIES
diff --git a/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorClusters.java b/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorClusters.java
index aea639f5116..c8695a7a50d 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorClusters.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/iterator/ORecordIteratorClusters.java
@@ -367,7 +367,7 @@ protected void config() {
totalAvailableRecords = database.countClusterElements(clusterIds);
- txEntries = database.getTransaction().getRecordEntriesByClusterIds(clusterIds);
+ txEntries = database.getTransaction().getNewRecordEntriesByClusterIds(clusterIds);
if (txEntries != null)
// ADJUST TOTAL ELEMENT BASED ON CURRENT TRANSACTION'S ENTRIES
diff --git a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransaction.java b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransaction.java
index 2e80f344c9e..7bc9a7e4bd4 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransaction.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransaction.java
@@ -63,7 +63,7 @@ public void saveRecord(ORecordInternal<?> iContent, String iClusterName, OPERATI
public List<ORecordOperation> getRecordEntriesByClass(String iClassName);
- public List<ORecordOperation> getRecordEntriesByClusterIds(int[] iIds);
+ public List<ORecordOperation> getNewRecordEntriesByClusterIds(int[] iIds);
public ORecordInternal<?> getRecord(ORID iRid);
diff --git a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionNoTx.java b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionNoTx.java
index 08b6f936ec4..c54ddc43dc8 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionNoTx.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionNoTx.java
@@ -117,7 +117,7 @@ public List<ORecordOperation> getRecordEntriesByClass(String iClassName) {
return null;
}
- public List<ORecordOperation> getRecordEntriesByClusterIds(int[] iIds) {
+ public List<ORecordOperation> getNewRecordEntriesByClusterIds(int[] iIds) {
return null;
}
diff --git a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionRealAbstract.java b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionRealAbstract.java
index 047a11ddf76..2994820da20 100644
--- a/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionRealAbstract.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/tx/OTransactionRealAbstract.java
@@ -161,19 +161,21 @@ public List<ORecordOperation> getRecordEntriesByClass(final String iClassName) {
/**
* Called by cluster iterator.
*/
- public List<ORecordOperation> getRecordEntriesByClusterIds(final int[] iIds) {
+ public List<ORecordOperation> getNewRecordEntriesByClusterIds(final int[] iIds) {
final List<ORecordOperation> result = new ArrayList<ORecordOperation>();
if (iIds == null)
// RETURN ALL THE RECORDS
for (ORecordOperation entry : recordEntries.values()) {
- result.add(entry);
+ if (entry.type == ORecordOperation.CREATED)
+ result.add(entry);
}
else
// FILTER RECORDS BY ID
for (ORecordOperation entry : recordEntries.values()) {
for (int id : iIds) {
- if (entry.getRecord() != null && entry.getRecord().getIdentity().getClusterId() == id) {
+ if (entry.getRecord() != null && entry.getRecord().getIdentity().getClusterId() == id
+ && entry.type == ORecordOperation.CREATED) {
result.add(entry);
break;
}
|
49afb44009133c40ece7c9d514364b9e779a8efe
|
Mylyn Reviews
|
Moved "tbr" to subfolder
|
p
|
https://github.com/eclipse-mylyn/org.eclipse.mylyn.reviews
|
diff --git a/org.eclipse.mylyn.reviews-site/.project b/org.eclipse.mylyn.reviews-site/.project
deleted file mode 100644
index e7305348..00000000
--- a/org.eclipse.mylyn.reviews-site/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.mylyn.reviews-site</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.UpdateSiteBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.UpdateSiteNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.mylyn.reviews-site/site.xml b/org.eclipse.mylyn.reviews-site/site.xml
deleted file mode 100644
index 5ca060f2..00000000
--- a/org.eclipse.mylyn.reviews-site/site.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<site>
- <feature url="features/org.eclipse.mylyn.reviews_0.0.1.jar" id="org.eclipse.mylyn.reviews" version="0.0.1">
- <category name="mylyn.reviews"/>
- </feature>
- <category-def name="mylyn.reviews" label="Mylyn Reviews (Incubation)"/>
-</site>
diff --git a/org.eclipse.mylyn.reviews.core/.classpath b/org.eclipse.mylyn.reviews.core/.classpath
deleted file mode 100644
index 121e527a..00000000
--- a/org.eclipse.mylyn.reviews.core/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.mylyn.reviews.core/.project b/org.eclipse.mylyn.reviews.core/.project
deleted file mode 100644
index 7b0cd529..00000000
--- a/org.eclipse.mylyn.reviews.core/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.mylyn.reviews.core</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.mylyn.reviews.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.reviews.core/META-INF/MANIFEST.MF
deleted file mode 100644
index b93a9fc9..00000000
--- a/org.eclipse.mylyn.reviews.core/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,18 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Mylyn Reviews Core (Incubation)
-Bundle-SymbolicName: org.eclipse.mylyn.reviews.core;singleton:=true
-Bundle-Version: 0.0.1
-Bundle-Activator: org.eclipse.mylyn.reviews.core.Activator
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.emf.edit;bundle-version="2.5.0",
- org.eclipse.team.core;bundle-version="3.5.0",
- org.eclipse.core.resources;bundle-version="3.5.1",
- org.eclipse.mylyn.tasks.core;bundle-version="3.3.0",
- org.eclipse.compare;bundle-version="3.5.0"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.eclipse.mylyn.reviews.core,
- org.eclipse.mylyn.reviews.core.model.review,
- org.eclipse.mylyn.reviews.core.model.review.impl,
- org.eclipse.mylyn.reviews.core.model.review.util
diff --git a/org.eclipse.mylyn.reviews.core/about.html b/org.eclipse.mylyn.reviews.core/about.html
deleted file mode 100644
index c258ef55..00000000
--- a/org.eclipse.mylyn.reviews.core/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 5, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/org.eclipse.mylyn.reviews.core/build.properties b/org.eclipse.mylyn.reviews.core/build.properties
deleted file mode 100644
index 3022405d..00000000
--- a/org.eclipse.mylyn.reviews.core/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
-jre.compilation.profile = J2SE-1.5
diff --git a/org.eclipse.mylyn.reviews.core/model/review.ecore b/org.eclipse.mylyn.reviews.core/model/review.ecore
deleted file mode 100644
index f2d227e6..00000000
--- a/org.eclipse.mylyn.reviews.core/model/review.ecore
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ecore:EPackage xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="review"
- nsURI="org.eclipse.mylyn.reviews" nsPrefix="">
- <eClassifiers xsi:type="ecore:EClass" name="Review">
- <eStructuralFeatures xsi:type="ecore:EReference" name="result" eType="#//ReviewResult"/>
- <eStructuralFeatures xsi:type="ecore:EReference" name="scope" upperBound="-1"
- eType="#//ScopeItem"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="ReviewResult">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="text" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="rating" eType="#//Rating"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="reviewer" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EClass" name="Patch" eSuperTypes="#//ScopeItem">
- <eOperations name="parse" upperBound="-1" eType="#//IFilePatch2"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="contents" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="creationDate" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EDate"/>
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="fileName" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EEnum" name="Rating">
- <eLiterals name="NONE"/>
- <eLiterals name="PASSED"/>
- <eLiterals name="WARNING"/>
- <eLiterals name="FAILED"/>
- </eClassifiers>
- <eClassifiers xsi:type="ecore:EDataType" name="IFilePatch2" instanceClassName="org.eclipse.compare.patch.IFilePatch2"/>
- <eClassifiers xsi:type="ecore:EDataType" name="IProgressMonitor" instanceClassName="org.eclipse.core.runtime.IProgressMonitor"/>
- <eClassifiers xsi:type="ecore:EClass" name="ScopeItem">
- <eStructuralFeatures xsi:type="ecore:EAttribute" name="author" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- </eClassifiers>
-</ecore:EPackage>
diff --git a/org.eclipse.mylyn.reviews.core/model/review.genmodel b/org.eclipse.mylyn.reviews.core/model/review.genmodel
deleted file mode 100644
index c3b7f79e..00000000
--- a/org.eclipse.mylyn.reviews.core/model/review.genmodel
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<genmodel:GenModel xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:genmodel="http://www.eclipse.org/emf/2002/GenModel" modelDirectory="/org.eclipse.mylyn.reviews.core/src"
- modelPluginID="org.eclipse.mylyn.reviews.core" modelName="Review" importerID="org.eclipse.emf.importer.ecore"
- complianceLevel="5.0" copyrightFields="false">
- <foreignModel>review.ecore</foreignModel>
- <genPackages prefix="Review" basePackage="org.eclipse.mylyn.reviews.core.model"
- disposableProviderFactory="true" ecorePackage="review.ecore#/">
- <genEnums typeSafeEnumCompatible="false" ecoreEnum="review.ecore#//Rating">
- <genEnumLiterals ecoreEnumLiteral="review.ecore#//Rating/NONE"/>
- <genEnumLiterals ecoreEnumLiteral="review.ecore#//Rating/PASSED"/>
- <genEnumLiterals ecoreEnumLiteral="review.ecore#//Rating/WARNING"/>
- <genEnumLiterals ecoreEnumLiteral="review.ecore#//Rating/FAILED"/>
- </genEnums>
- <genDataTypes ecoreDataType="review.ecore#//IFilePatch2"/>
- <genDataTypes ecoreDataType="review.ecore#//IProgressMonitor"/>
- <genClasses ecoreClass="review.ecore#//Review">
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference review.ecore#//Review/result"/>
- <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference review.ecore#//Review/scope"/>
- </genClasses>
- <genClasses ecoreClass="review.ecore#//ReviewResult">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute review.ecore#//ReviewResult/text"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute review.ecore#//ReviewResult/rating"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute review.ecore#//ReviewResult/reviewer"/>
- </genClasses>
- <genClasses ecoreClass="review.ecore#//Patch">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute review.ecore#//Patch/contents"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute review.ecore#//Patch/creationDate"/>
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute review.ecore#//Patch/fileName"/>
- <genOperations ecoreOperation="review.ecore#//Patch/parse"/>
- </genClasses>
- <genClasses ecoreClass="review.ecore#//ScopeItem">
- <genFeatures createChild="false" ecoreFeature="ecore:EAttribute review.ecore#//ScopeItem/author"/>
- </genClasses>
- </genPackages>
-</genmodel:GenModel>
diff --git a/org.eclipse.mylyn.reviews.core/plugin.properties b/org.eclipse.mylyn.reviews.core/plugin.properties
deleted file mode 100644
index 4041a812..00000000
--- a/org.eclipse.mylyn.reviews.core/plugin.properties
+++ /dev/null
@@ -1,42 +0,0 @@
-###############################################################################
-# Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
-###############################################################################
-
-pluginName = Review Edit Support
-providerName = www.example.org
-
-_UI_CreateChild_text = {0}
-_UI_CreateChild_text2 = {1} {0}
-_UI_CreateChild_text3 = {1}
-_UI_CreateChild_tooltip = Create New {0} Under {1} Feature
-_UI_CreateChild_description = Create a new child of type {0} for the {1} feature of the selected {2}.
-_UI_CreateSibling_description = Create a new sibling of type {0} for the selected {2}, under the {1} feature of their parent.
-
-_UI_PropertyDescriptor_description = The {0} of the {1}
-
-_UI_User_type = User
-_UI_Assignment_type = Assignment
-_UI_Period_type = Period
-_UI_Review_type = Review
-_UI_Unknown_type = Object
-
-_UI_Unknown_datatype= Value
-
-_UI_User_name_feature = Name
-_UI_Assignment_author_feature = Author
-_UI_Assignment_reviewer_feature = Reviewer
-_UI_Assignment_period_feature = Period
-_UI_Period_startDate_feature = Start Date
-_UI_Period_assignments_feature = Assignments
-_UI_Review_users_feature = Users
-_UI_Review_periods_feature = Periods
-_UI_Unknown_feature = Unspecified
-
-_UI_Review_content_type = Review File
diff --git a/org.eclipse.mylyn.reviews.core/plugin.xml b/org.eclipse.mylyn.reviews.core/plugin.xml
deleted file mode 100644
index 703ee688..00000000
--- a/org.eclipse.mylyn.reviews.core/plugin.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?><!--
- Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- -->
-
-<plugin>
-</plugin>
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/Activator.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/Activator.java
deleted file mode 100644
index 16999003..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/Activator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.core;
-
-import org.eclipse.core.runtime.Plugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- * @author Kilian Matt
- */
-public class Activator extends Plugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.mylyn.reviews.core"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/GitPatchPathFindingStrategy.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/GitPatchPathFindingStrategy.java
deleted file mode 100644
index 4875e3ea..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/GitPatchPathFindingStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.core;
-
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import org.eclipse.compare.patch.ReaderCreator;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * @author Kilian Matt
- */
-public class GitPatchPathFindingStrategy implements ITargetPathStrategy {
-
- public ReaderCreator get(IPath path) {
- final IFile file = org.eclipse.core.resources.ResourcesPlugin
- .getWorkspace().getRoot().getFile(path.removeFirstSegments(1));
- return new ReaderCreator() {
- @Override
- public Reader createReader() throws CoreException {
- return new InputStreamReader(file.getContents());
- }
- };
- }
-
- public boolean matches(IPath targetPath) {
- final IFile file = org.eclipse.core.resources.ResourcesPlugin
- .getWorkspace().getRoot().getFile(targetPath.removeFirstSegments(1));
-
- return file.exists();
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ITargetPathStrategy.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ITargetPathStrategy.java
deleted file mode 100644
index 78f355cc..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ITargetPathStrategy.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.core;
-
-import org.eclipse.compare.patch.ReaderCreator;
-import org.eclipse.core.runtime.IPath;
-
-/*
- * @author Kilian Matt
- */
-public interface ITargetPathStrategy {
- boolean matches(IPath path);
-
- ReaderCreator get(IPath path);
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewConstants.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewConstants.java
deleted file mode 100644
index 704be905..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewConstants.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.core;
-
-/**
- * @author Kilian Matt
- */
-public class ReviewConstants {
-
- public static final String REVIEW_DATA_CONTAINER = "review-data.zip";
-
- public static final String REVIEW_DATA_FILE = "reviews-data.xml";
-
- public static final String ATTR_CACHED_REVIEW = "review";
-
- public static final String ATTR_REVIEW_FLAG = "isReview";
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewData.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewData.java
deleted file mode 100644
index bcf8c548..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewData.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.mylyn.reviews.core;
-
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-public class ReviewData {
- private boolean outgoing;
- private Review review;
- private ITask task;
- private boolean dirty;
-
- public ReviewData(ITask task, Review review) {
- this.task=task;
- this.review = review;
- }
-
- public boolean isOutgoing() {
- return outgoing;
- }
-
- public void setOutgoing() {
- this.outgoing = true;
- }
-
- public void setOutgoing(boolean outgoing) {
- this.outgoing = outgoing;
- }
-
- public ITask getTask() {
- return task;
- }
-
- public Review getReview() {
- return review;
- }
-
- public void setDirty(boolean isDirty) {
- this.dirty=isDirty;
- }
-
- public void setDirty() {
- setDirty(true);
- }
- public boolean isDirty() {
- return this.dirty;
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewDataManager.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewDataManager.java
deleted file mode 100644
index 13ec95fd..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewDataManager.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.eclipse.mylyn.reviews.core;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.tasks.core.IRepositoryModel;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;
-
-public class ReviewDataManager {
- private Map<ITask, ReviewData> cached = new HashMap<ITask, ReviewData>();
- private ReviewDataStore store;
- private ITaskDataManager taskDataManager;
- private IRepositoryModel repositoryModel;
-
- public ReviewDataManager(ReviewDataStore store,
- ITaskDataManager taskDataManager, IRepositoryModel repositoryModel) {
- this.store = store;
- this.taskDataManager = taskDataManager;
- this.repositoryModel = repositoryModel;
-
- }
-
- public void storeOutgoingTask(ITask task, Review review) {
- ReviewData reviewData = new ReviewData(task, review);
- reviewData.setOutgoing();
- cached.put(task, reviewData);
- store.storeReviewData(task.getRepositoryUrl(), task.getTaskId(),
- review, "review");
- }
-
- public ReviewData getReviewData(ITask task) {
- if (task == null)
- return null;
- ReviewData reviewData = cached.get(task);
- if (reviewData == null) {
- reviewData = loadFromDiskAddCache(task);
- }
- if (reviewData == null) {
- reviewData = loadFromTask(task);
- }
- return reviewData;
- }
-
- private ReviewData loadFromTask(ITask task) {
- try {
- List<Review> reviews = ReviewsUtil.getReviewAttachmentFromTask(
- taskDataManager, repositoryModel, task);
- storeTask(task, reviews.get(reviews.size() - 1));
-
- return getReviewData(task);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- return null;
- }
-
- private ReviewData loadFromDiskAddCache(ITask task) {
- List<Review> reviews = store.loadReviewData(task.getRepositoryUrl(),
- task.getTaskId());
- if (reviews.size() > 0) {
- Review review = reviews.get(0);
- storeTask(task, review);
- return getReviewData(task);
- }
- return null;
- }
-
- public void storeTask(ITask task, Review review) {
- final ReviewData reviewData = new ReviewData(task, review);
- review.eAdapters().add(new AdapterImpl() {
- public void notifyChanged(Notification notification) {
- System.err.println("notification "+notification);
- reviewData.setDirty(true);
- }
-
- });
- cached.put(task, reviewData);
- store.storeReviewData(task.getRepositoryUrl(), task.getTaskId(),
- review, "review");
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewDataStore.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewDataStore.java
deleted file mode 100644
index f24ad5a6..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewDataStore.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.mylyn.reviews.core;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.net.URLEncoder;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-
-public class ReviewDataStore {
-
- private String storeRootDir;
-
- public ReviewDataStore(String storeRootDir) {
- this.storeRootDir = storeRootDir;
- }
-
- public void storeReviewData(String repositoryUrl, String taskId,
- Review review, String id) {
- try {
-
- File file = getFile(repositoryUrl, taskId);
- createDirectoriesIfNecessary(file);
- if (!file.exists()) {
- file.createNewFile();
- ZipOutputStream outputStream = new ZipOutputStream(
- new FileOutputStream(file));
- ResourceSet resourceSet = new ResourceSetImpl();
-
- Resource resource = resourceSet.createResource(URI
- .createFileURI("")); //$NON-NLS-1$
-
- resource.getContents().add(review);
- resource.getContents().add(review.getScope().get(0));
- if (review.getResult() != null)
- resource.getContents().add(review.getResult());
-
- outputStream.putNextEntry(new ZipEntry(id));
- resource.save(outputStream, null);
- outputStream.closeEntry();
- outputStream.close();
- } else {
- // TODO append
-
- }
- } catch (Exception e) {
- // TODO: handle exception
- e.printStackTrace();
- }
- }
-
- private void createDirectoriesIfNecessary(File file) {
- File parent = file.getParentFile();
- if(!parent.exists()) {
- parent.mkdirs();
- }
- }
-
- public List<Review> loadReviewData(String repositoryUrl, String taskId) {
- List<Review> reviews = new ArrayList<Review>();
- try {
-
- File file = getFile(repositoryUrl, taskId);
- if(!file.exists()) {
- return reviews;
- }
- ZipInputStream inputStream = new ZipInputStream(
- new FileInputStream(file));
- inputStream.getNextEntry();
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.getPackageRegistry().put(ReviewPackage.eNS_URI,
- ReviewPackage.eINSTANCE);
- Resource resource = resourceSet.createResource(URI.createURI(""));
- resource.load(inputStream, null);
- for (EObject item : resource.getContents()) {
- if (item instanceof Review) {
- Review review = (Review) item;
- reviews.add(review);
- }
- }
- } catch (Exception e) {
- // TODO: handle exception
- e.printStackTrace();
- }
- return reviews;
- }
-
- private File getFile(String repositoryUrl, String taskId) {
- File path = new File(storeRootDir + File.separator + "reviews"
- + File.separator + URLEncoder.encode(repositoryUrl)
- + File.separator);
- return new File(path, taskId);
- }
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewSubTask.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewSubTask.java
deleted file mode 100644
index db2ba150..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewSubTask.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.core;
-
-import java.util.Date;
-
-import org.eclipse.mylyn.reviews.core.model.review.Rating;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-/**
- * @author Kilian Matt
- */
-public class ReviewSubTask {
-
- private String comment;
- private ITask task;
- private Date creationDate;
-
- public ReviewSubTask(String patchFile, Date creationDate, String author,
- String reviewer, Rating result, String comment, ITask task) {
- super();
- this.patchFile = patchFile;
- this.creationDate = new Date(creationDate.getTime());
- this.author = author;
- this.reviewer = reviewer;
- this.result = result;
- this.comment = comment;
- this.task = task;
- }
-
- private String patchFile;
- private String author;
- private String reviewer;
- private Rating result;
-
- public String getPatchFile() {
- return patchFile;
- }
-
- public Date getCreationDate() {
- return creationDate;
- }
-
- public String getPatchDescription() {
- return String.format("%s %s", patchFile, creationDate);
- }
-
- public String getAuthor() {
- return author;
- }
-
- public String getReviewer() {
- return reviewer;
- }
-
- public Rating getResult() {
- return result;
- }
-
- public String getComment() {
- return comment;
- }
-
- public ITask getTask() {
- return task;
- }
-
- @Override
- public String toString() {
- return "Review Subtask " + patchFile + " by " + author + " revd by "
- + reviewer + " rated as " + result;
- }
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewsUtil.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewsUtil.java
deleted file mode 100644
index 2497d432..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/ReviewsUtil.java
+++ /dev/null
@@ -1,236 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.core;
-
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.zip.ZipInputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryModel;
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.Rating;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewFactory;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewResult;
-import org.eclipse.mylyn.reviews.core.model.review.ScopeItem;
-import org.eclipse.mylyn.tasks.core.IRepositoryModel;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataManager;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-
-/**
- * @author Kilian Matt
- */
-public class ReviewsUtil {
-
- public static List<ReviewSubTask> getReviewSubTasksFor(
- ITaskContainer taskContainer, ITaskDataManager taskDataManager,
- IRepositoryModel repositoryModel, IProgressMonitor monitor) {
- List<ReviewSubTask> resultList = new ArrayList<ReviewSubTask>();
- try {
- for (ITask subTask : taskContainer.getChildren()) {
- if (!ReviewsUtil.hasReviewMarker(subTask)) {
- TaskData taskData = taskDataManager.getTaskData(subTask);
- if (getReviewAttachments(repositoryModel, taskData).size() > 0) {
- ReviewsUtil.markAsReview(subTask);
- }
- }
-
- if (ReviewsUtil.isMarkedAsReview(subTask)) {//.getSummary().startsWith("Review")) { //$NON-NLS-1$
- // change to review data manager
- for (Review review : getReviewAttachmentFromTask(
- taskDataManager, repositoryModel, subTask)) {
- // TODO change to latest etc
- ReviewResult result = review.getResult();
- if (result == null) {
- result = ReviewFactory.eINSTANCE
- .createReviewResult();
- result.setRating(Rating.NONE);
- result.setText("");
- }
- resultList.add(new ReviewSubTask(getPatchFile(review
- .getScope()), getPatchCreationDate(review
- .getScope()),
- getAuthorString(review.getScope()), subTask
- .getOwner(), result.getRating(), result
- .getText(), subTask));
-
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return resultList;
-
- }
-
- private static String getPatchFile(EList<ScopeItem> scope) {
- if (scope.size() == 1 && scope.get(0) instanceof Patch) {
- return ((Patch) scope.get(0)).getFileName();
- } else {
- return "";
- }
- }
-
- private static Date getPatchCreationDate(EList<ScopeItem> scope) {
- if (scope.size() == 1 && scope.get(0) instanceof Patch) {
- return ((Patch) scope.get(0)).getCreationDate();
- } else {
- return null;
- }
- }
-
- private static String getAuthorString(EList<ScopeItem> scope) {
- if (scope.size() == 0) {
- return "none";
- } else if (scope.size() == 1) {
- return scope.get(0).getAuthor();
- } else if (scope.size() < 3) {
- StringBuilder sb = new StringBuilder();
- for (ScopeItem item : scope) {
- sb.append(item.getAuthor());
- sb.append(", ");
- }
- return sb.substring(0, sb.length() - 2);
- } else {
- return "Multiple Authors";
- }
- }
-
- static List<Review> parseAttachments(TaskAttribute attribute,
- IProgressMonitor monitor) {
- List<Review> reviewList = new ArrayList<Review>();
- try {
- URL url = new URL(attribute.getMappedAttribute(
- TaskAttribute.ATTACHMENT_URL).getValue());
-
- ZipInputStream stream = new ZipInputStream(url.openStream());
- while (!stream.getNextEntry().getName()
- .equals(ReviewConstants.REVIEW_DATA_FILE)) {
- }
-
- ResourceSet resourceSet = new ResourceSetImpl();
- resourceSet.getPackageRegistry().put(ReviewPackage.eNS_URI,
- ReviewPackage.eINSTANCE);
- Resource resource = resourceSet.createResource(URI.createURI(""));
- resource.load(stream, null);
- for (EObject item : resource.getContents()) {
- if (item instanceof Review) {
- Review review = (Review) item;
- reviewList.add(review);
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- return reviewList;
- }
-
- public static List<Review> getReviewAttachmentFromTask(
- ITaskDataManager taskDataManager, IRepositoryModel repositoryModel,
- ITask task) throws CoreException {
-
- List<Review> reviews = new ArrayList<Review>();
- TaskData taskData = taskDataManager.getTaskData(task);
- if (taskData != null) {
- List<TaskAttribute> attributesByType = taskData
- .getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT);
- ITaskAttachment lastReview = null;
-
- for (TaskAttribute attribute : attributesByType) {
- // TODO move RepositoryModel.createTaskAttachment to interface?
- ITaskAttachment taskAttachment = ((RepositoryModel) repositoryModel)
- .createTaskAttachment(attribute);
- if (taskAttachment != null
- && taskAttachment.getFileName().equals(
- ReviewConstants.REVIEW_DATA_CONTAINER)) {
-
- if (lastReview == null
- || lastReview.getCreationDate().before(
- taskAttachment.getCreationDate())) {
- lastReview = taskAttachment;
- }
- }
-
- }
-
- if (lastReview != null) {
- reviews.addAll(parseAttachments(lastReview.getTaskAttribute(),
- new NullProgressMonitor()));
- }
-
- }
- return reviews;
- }
-
- public static List<TaskAttribute> getReviewAttachments(
- IRepositoryModel repositoryModel, TaskData taskData) {
-
- List<TaskAttribute> matchingAttributes = new ArrayList<TaskAttribute>();
- List<TaskAttribute> attributesByType = taskData.getAttributeMapper()
- .getAttributesByType(taskData, TaskAttribute.TYPE_ATTACHMENT);
- for (TaskAttribute attribute : attributesByType) {
- // TODO move RepositoryModel.createTaskAttachment to interface?
- ITaskAttachment taskAttachment = ((RepositoryModel) repositoryModel)
- .createTaskAttachment(attribute);
- if (taskAttachment != null
- && taskAttachment.getFileName().equals(
- ReviewConstants.REVIEW_DATA_CONTAINER)) {
- matchingAttributes.add(attribute);
- }
- }
- return matchingAttributes;
- }
-
- private static List<ITargetPathStrategy> strategies;
- static {
- strategies = new ArrayList<ITargetPathStrategy>();
- strategies.add(new SimplePathFindingStrategy());
- strategies.add(new GitPatchPathFindingStrategy());
- }
-
- public static List<? extends ITargetPathStrategy> getPathFindingStrategies() {
- return strategies;
- }
-
- public static boolean isMarkedAsReview(ITask task) {
- boolean isReview = Boolean.parseBoolean(task
- .getAttribute(ReviewConstants.ATTR_REVIEW_FLAG));
- return isReview;
- }
-
- public static void markAsReview(ITask task) {
- task.setAttribute(ReviewConstants.ATTR_REVIEW_FLAG,
- Boolean.TRUE.toString());
- }
-
- public static boolean hasReviewMarker(ITask task) {
- return task.getAttribute(ReviewConstants.ATTR_REVIEW_FLAG) != null;
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/SimplePathFindingStrategy.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/SimplePathFindingStrategy.java
deleted file mode 100644
index db3b871e..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/SimplePathFindingStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.core;
-
-import java.io.InputStreamReader;
-import java.io.Reader;
-
-import org.eclipse.compare.patch.ReaderCreator;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * @author Kilian Matt
- */
-public class SimplePathFindingStrategy implements ITargetPathStrategy {
-
- public ReaderCreator get(IPath path) {
- final IFile file = org.eclipse.core.resources.ResourcesPlugin
- .getWorkspace().getRoot().getFile(path);
- return new ReaderCreator() {
- @Override
- public Reader createReader() throws CoreException {
- return new InputStreamReader(file.getContents());
- }
- };
- }
-
- public boolean matches(IPath targetPath) {
- final IFile file = org.eclipse.core.resources.ResourcesPlugin
- .getWorkspace().getRoot().getFile(targetPath);
-
- return file.exists();
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Patch.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Patch.java
deleted file mode 100644
index 7521cb9f..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Patch.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review;
-
-import java.util.Date;
-
-import org.eclipse.compare.patch.IFilePatch2;
-
-import org.eclipse.emf.common.util.EList;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Patch</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getContents <em>Contents</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getCreationDate <em>Creation Date</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getFileName <em>File Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getPatch()
- * @model
- * @generated
- */
-public interface Patch extends ScopeItem {
- /**
- * Returns the value of the '<em><b>Contents</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Contents</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Contents</em>' attribute.
- * @see #setContents(String)
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getPatch_Contents()
- * @model
- * @generated
- */
- String getContents();
-
- /**
- * Sets the value of the '{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getContents <em>Contents</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Contents</em>' attribute.
- * @see #getContents()
- * @generated
- */
- void setContents(String value);
-
- /**
- * Returns the value of the '<em><b>Creation Date</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Creation Date</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Creation Date</em>' attribute.
- * @see #setCreationDate(Date)
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getPatch_CreationDate()
- * @model
- * @generated
- */
- Date getCreationDate();
-
- /**
- * Sets the value of the '{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getCreationDate <em>Creation Date</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Creation Date</em>' attribute.
- * @see #getCreationDate()
- * @generated
- */
- void setCreationDate(Date value);
-
- /**
- * Returns the value of the '<em><b>File Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>File Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>File Name</em>' attribute.
- * @see #setFileName(String)
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getPatch_FileName()
- * @model
- * @generated
- */
- String getFileName();
-
- /**
- * Sets the value of the '{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getFileName <em>File Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>File Name</em>' attribute.
- * @see #getFileName()
- * @generated
- */
- void setFileName(String value);
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @model dataType="org.eclipse.mylyn.reviews.core.model.review.IFilePatch2"
- * @generated
- */
- EList<IFilePatch2> parse();
-
-} // Patch
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Rating.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Rating.java
deleted file mode 100644
index c4a04335..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Rating.java
+++ /dev/null
@@ -1,267 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.emf.common.util.Enumerator;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the literals of the enumeration '<em><b>Rating</b></em>',
- * and utility methods for working with them.
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getRating()
- * @model
- * @generated
- */
-public enum Rating implements Enumerator {
- /**
- * The '<em><b>NONE</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #NONE_VALUE
- * @generated
- * @ordered
- */
- NONE(0, "NONE", "NONE"),
-
- /**
- * The '<em><b>PASSED</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #PASSED_VALUE
- * @generated
- * @ordered
- */
- PASSED(0, "PASSED", "PASSED"),
-
- /**
- * The '<em><b>WARNING</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #WARNING_VALUE
- * @generated
- * @ordered
- */
- WARNING(0, "WARNING", "WARNING"),
-
- /**
- * The '<em><b>FAILED</b></em>' literal object.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #FAILED_VALUE
- * @generated
- * @ordered
- */
- FAILED(0, "FAILED", "FAILED");
-
- /**
- * The '<em><b>NONE</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>NONE</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #NONE
- * @model
- * @generated
- * @ordered
- */
- public static final int NONE_VALUE = 0;
-
- /**
- * The '<em><b>PASSED</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>PASSED</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #PASSED
- * @model
- * @generated
- * @ordered
- */
- public static final int PASSED_VALUE = 0;
-
- /**
- * The '<em><b>WARNING</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>WARNING</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #WARNING
- * @model
- * @generated
- * @ordered
- */
- public static final int WARNING_VALUE = 0;
-
- /**
- * The '<em><b>FAILED</b></em>' literal value.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of '<em><b>FAILED</b></em>' literal object isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @see #FAILED
- * @model
- * @generated
- * @ordered
- */
- public static final int FAILED_VALUE = 0;
-
- /**
- * An array of all the '<em><b>Rating</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static final Rating[] VALUES_ARRAY =
- new Rating[] {
- NONE,
- PASSED,
- WARNING,
- FAILED,
- };
-
- /**
- * A public read-only list of all the '<em><b>Rating</b></em>' enumerators.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final List<Rating> VALUES = Collections.unmodifiableList(Arrays.asList(VALUES_ARRAY));
-
- /**
- * Returns the '<em><b>Rating</b></em>' literal with the specified literal value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static Rating get(String literal) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- Rating result = VALUES_ARRAY[i];
- if (result.toString().equals(literal)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Rating</b></em>' literal with the specified name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static Rating getByName(String name) {
- for (int i = 0; i < VALUES_ARRAY.length; ++i) {
- Rating result = VALUES_ARRAY[i];
- if (result.getName().equals(name)) {
- return result;
- }
- }
- return null;
- }
-
- /**
- * Returns the '<em><b>Rating</b></em>' literal with the specified integer value.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static Rating get(int value) {
- switch (value) {
- case NONE_VALUE: return NONE;
- }
- return null;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final int value;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String name;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private final String literal;
-
- /**
- * Only this class can construct instances.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private Rating(int value, String name, String literal) {
- this.value = value;
- this.name = name;
- this.literal = literal;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public int getValue() {
- return value;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getName() {
- return name;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getLiteral() {
- return literal;
- }
-
- /**
- * Returns the literal value of the enumerator, which is its string representation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- return literal;
- }
-
-} //Rating
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Review.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Review.java
deleted file mode 100644
index 5d3bf277..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/Review.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Review</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.Review#getResult <em>Result</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.Review#getScope <em>Scope</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getReview()
- * @model
- * @generated
- */
-public interface Review extends EObject {
- /**
- * Returns the value of the '<em><b>Result</b></em>' reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Result</em>' reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Result</em>' reference.
- * @see #setResult(ReviewResult)
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getReview_Result()
- * @model
- * @generated
- */
- ReviewResult getResult();
-
- /**
- * Sets the value of the '{@link org.eclipse.mylyn.reviews.core.model.review.Review#getResult <em>Result</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Result</em>' reference.
- * @see #getResult()
- * @generated
- */
- void setResult(ReviewResult value);
-
- /**
- * Returns the value of the '<em><b>Scope</b></em>' reference list.
- * The list contents are of type {@link org.eclipse.mylyn.reviews.core.model.review.ScopeItem}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Scope</em>' reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Scope</em>' reference list.
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getReview_Scope()
- * @model
- * @generated
- */
- EList<ScopeItem> getScope();
-
-} // Review
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewFactory.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewFactory.java
deleted file mode 100644
index 288649cd..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewFactory.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review;
-
-import org.eclipse.emf.ecore.EFactory;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Factory</b> for the model.
- * It provides a create method for each non-abstract class of the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage
- * @generated
- */
-public interface ReviewFactory extends EFactory {
- /**
- * The singleton instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- ReviewFactory eINSTANCE = org.eclipse.mylyn.reviews.core.model.review.impl.ReviewFactoryImpl.init();
-
- /**
- * Returns a new object of class '<em>Review</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Review</em>'.
- * @generated
- */
- Review createReview();
-
- /**
- * Returns a new object of class '<em>Result</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Result</em>'.
- * @generated
- */
- ReviewResult createReviewResult();
-
- /**
- * Returns a new object of class '<em>Patch</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Patch</em>'.
- * @generated
- */
- Patch createPatch();
-
- /**
- * Returns a new object of class '<em>Scope Item</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return a new object of class '<em>Scope Item</em>'.
- * @generated
- */
- ScopeItem createScopeItem();
-
- /**
- * Returns the package supported by this factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the package supported by this factory.
- * @generated
- */
- ReviewPackage getReviewPackage();
-
-} //ReviewFactory
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewPackage.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewPackage.java
deleted file mode 100644
index 20ed8ed5..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewPackage.java
+++ /dev/null
@@ -1,602 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Package</b> for the model.
- * It contains accessors for the meta objects to represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewFactory
- * @model kind="package"
- * @generated
- */
-public interface ReviewPackage extends EPackage {
- /**
- * The package name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNAME = "review";
-
- /**
- * The package namespace URI.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_URI = "org.eclipse.mylyn.reviews";
-
- /**
- * The package namespace name.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- String eNS_PREFIX = "";
-
- /**
- * The singleton instance of the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- ReviewPackage eINSTANCE = org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl.init();
-
- /**
- * The meta object id for the '{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewImpl <em>Review</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewImpl
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getReview()
- * @generated
- */
- int REVIEW = 0;
-
- /**
- * The feature id for the '<em><b>Result</b></em>' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int REVIEW__RESULT = 0;
-
- /**
- * The feature id for the '<em><b>Scope</b></em>' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int REVIEW__SCOPE = 1;
-
- /**
- * The number of structural features of the '<em>Review</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int REVIEW_FEATURE_COUNT = 2;
-
- /**
- * The meta object id for the '{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewResultImpl <em>Result</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewResultImpl
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getReviewResult()
- * @generated
- */
- int REVIEW_RESULT = 1;
-
- /**
- * The feature id for the '<em><b>Text</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int REVIEW_RESULT__TEXT = 0;
-
- /**
- * The feature id for the '<em><b>Rating</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int REVIEW_RESULT__RATING = 1;
-
- /**
- * The feature id for the '<em><b>Reviewer</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int REVIEW_RESULT__REVIEWER = 2;
-
- /**
- * The number of structural features of the '<em>Result</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int REVIEW_RESULT_FEATURE_COUNT = 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.mylyn.reviews.core.model.review.impl.ScopeItemImpl <em>Scope Item</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ScopeItemImpl
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getScopeItem()
- * @generated
- */
- int SCOPE_ITEM = 3;
-
- /**
- * The feature id for the '<em><b>Author</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int SCOPE_ITEM__AUTHOR = 0;
-
- /**
- * The number of structural features of the '<em>Scope Item</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int SCOPE_ITEM_FEATURE_COUNT = 1;
-
- /**
- * The meta object id for the '{@link org.eclipse.mylyn.reviews.core.model.review.impl.PatchImpl <em>Patch</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.PatchImpl
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getPatch()
- * @generated
- */
- int PATCH = 2;
-
- /**
- * The feature id for the '<em><b>Author</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PATCH__AUTHOR = SCOPE_ITEM__AUTHOR;
-
- /**
- * The feature id for the '<em><b>Contents</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PATCH__CONTENTS = SCOPE_ITEM_FEATURE_COUNT + 0;
-
- /**
- * The feature id for the '<em><b>Creation Date</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PATCH__CREATION_DATE = SCOPE_ITEM_FEATURE_COUNT + 1;
-
- /**
- * The feature id for the '<em><b>File Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PATCH__FILE_NAME = SCOPE_ITEM_FEATURE_COUNT + 2;
-
- /**
- * The number of structural features of the '<em>Patch</em>' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @ordered
- */
- int PATCH_FEATURE_COUNT = SCOPE_ITEM_FEATURE_COUNT + 3;
-
- /**
- * The meta object id for the '{@link org.eclipse.mylyn.reviews.core.model.review.Rating <em>Rating</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.Rating
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getRating()
- * @generated
- */
- int RATING = 4;
-
- /**
- * The meta object id for the '<em>IFile Patch2</em>' data type.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.compare.patch.IFilePatch2
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getIFilePatch2()
- * @generated
- */
- int IFILE_PATCH2 = 5;
-
- /**
- * The meta object id for the '<em>IProgress Monitor</em>' data type.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.core.runtime.IProgressMonitor
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getIProgressMonitor()
- * @generated
- */
- int IPROGRESS_MONITOR = 6;
-
-
- /**
- * Returns the meta object for class '{@link org.eclipse.mylyn.reviews.core.model.review.Review <em>Review</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Review</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.Review
- * @generated
- */
- EClass getReview();
-
- /**
- * Returns the meta object for the reference '{@link org.eclipse.mylyn.reviews.core.model.review.Review#getResult <em>Result</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference '<em>Result</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.Review#getResult()
- * @see #getReview()
- * @generated
- */
- EReference getReview_Result();
-
- /**
- * Returns the meta object for the reference list '{@link org.eclipse.mylyn.reviews.core.model.review.Review#getScope <em>Scope</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the reference list '<em>Scope</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.Review#getScope()
- * @see #getReview()
- * @generated
- */
- EReference getReview_Scope();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult <em>Result</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Result</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewResult
- * @generated
- */
- EClass getReviewResult();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getText <em>Text</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Text</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getText()
- * @see #getReviewResult()
- * @generated
- */
- EAttribute getReviewResult_Text();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getRating <em>Rating</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Rating</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getRating()
- * @see #getReviewResult()
- * @generated
- */
- EAttribute getReviewResult_Rating();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getReviewer <em>Reviewer</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Reviewer</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getReviewer()
- * @see #getReviewResult()
- * @generated
- */
- EAttribute getReviewResult_Reviewer();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.mylyn.reviews.core.model.review.Patch <em>Patch</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Patch</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.Patch
- * @generated
- */
- EClass getPatch();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getContents <em>Contents</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Contents</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.Patch#getContents()
- * @see #getPatch()
- * @generated
- */
- EAttribute getPatch_Contents();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getCreationDate <em>Creation Date</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Creation Date</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.Patch#getCreationDate()
- * @see #getPatch()
- * @generated
- */
- EAttribute getPatch_CreationDate();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.mylyn.reviews.core.model.review.Patch#getFileName <em>File Name</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>File Name</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.Patch#getFileName()
- * @see #getPatch()
- * @generated
- */
- EAttribute getPatch_FileName();
-
- /**
- * Returns the meta object for class '{@link org.eclipse.mylyn.reviews.core.model.review.ScopeItem <em>Scope Item</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for class '<em>Scope Item</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.ScopeItem
- * @generated
- */
- EClass getScopeItem();
-
- /**
- * Returns the meta object for the attribute '{@link org.eclipse.mylyn.reviews.core.model.review.ScopeItem#getAuthor <em>Author</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for the attribute '<em>Author</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.ScopeItem#getAuthor()
- * @see #getScopeItem()
- * @generated
- */
- EAttribute getScopeItem_Author();
-
- /**
- * Returns the meta object for enum '{@link org.eclipse.mylyn.reviews.core.model.review.Rating <em>Rating</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for enum '<em>Rating</em>'.
- * @see org.eclipse.mylyn.reviews.core.model.review.Rating
- * @generated
- */
- EEnum getRating();
-
- /**
- * Returns the meta object for data type '{@link org.eclipse.compare.patch.IFilePatch2 <em>IFile Patch2</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for data type '<em>IFile Patch2</em>'.
- * @see org.eclipse.compare.patch.IFilePatch2
- * @model instanceClass="org.eclipse.compare.patch.IFilePatch2"
- * @generated
- */
- EDataType getIFilePatch2();
-
- /**
- * Returns the meta object for data type '{@link org.eclipse.core.runtime.IProgressMonitor <em>IProgress Monitor</em>}'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the meta object for data type '<em>IProgress Monitor</em>'.
- * @see org.eclipse.core.runtime.IProgressMonitor
- * @model instanceClass="org.eclipse.core.runtime.IProgressMonitor"
- * @generated
- */
- EDataType getIProgressMonitor();
-
- /**
- * Returns the factory that creates the instances of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @return the factory that creates the instances of the model.
- * @generated
- */
- ReviewFactory getReviewFactory();
-
- /**
- * <!-- begin-user-doc -->
- * Defines literals for the meta objects that represent
- * <ul>
- * <li>each class,</li>
- * <li>each feature of each class,</li>
- * <li>each enum,</li>
- * <li>and each data type</li>
- * </ul>
- * <!-- end-user-doc -->
- * @generated
- */
- interface Literals {
- /**
- * The meta object literal for the '{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewImpl <em>Review</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewImpl
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getReview()
- * @generated
- */
- EClass REVIEW = eINSTANCE.getReview();
-
- /**
- * The meta object literal for the '<em><b>Result</b></em>' reference feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference REVIEW__RESULT = eINSTANCE.getReview_Result();
-
- /**
- * The meta object literal for the '<em><b>Scope</b></em>' reference list feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EReference REVIEW__SCOPE = eINSTANCE.getReview_Scope();
-
- /**
- * The meta object literal for the '{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewResultImpl <em>Result</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewResultImpl
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getReviewResult()
- * @generated
- */
- EClass REVIEW_RESULT = eINSTANCE.getReviewResult();
-
- /**
- * The meta object literal for the '<em><b>Text</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute REVIEW_RESULT__TEXT = eINSTANCE.getReviewResult_Text();
-
- /**
- * The meta object literal for the '<em><b>Rating</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute REVIEW_RESULT__RATING = eINSTANCE.getReviewResult_Rating();
-
- /**
- * The meta object literal for the '<em><b>Reviewer</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute REVIEW_RESULT__REVIEWER = eINSTANCE.getReviewResult_Reviewer();
-
- /**
- * The meta object literal for the '{@link org.eclipse.mylyn.reviews.core.model.review.impl.PatchImpl <em>Patch</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.PatchImpl
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getPatch()
- * @generated
- */
- EClass PATCH = eINSTANCE.getPatch();
-
- /**
- * The meta object literal for the '<em><b>Contents</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute PATCH__CONTENTS = eINSTANCE.getPatch_Contents();
-
- /**
- * The meta object literal for the '<em><b>Creation Date</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute PATCH__CREATION_DATE = eINSTANCE.getPatch_CreationDate();
-
- /**
- * The meta object literal for the '<em><b>File Name</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute PATCH__FILE_NAME = eINSTANCE.getPatch_FileName();
-
- /**
- * The meta object literal for the '{@link org.eclipse.mylyn.reviews.core.model.review.impl.ScopeItemImpl <em>Scope Item</em>}' class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ScopeItemImpl
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getScopeItem()
- * @generated
- */
- EClass SCOPE_ITEM = eINSTANCE.getScopeItem();
-
- /**
- * The meta object literal for the '<em><b>Author</b></em>' attribute feature.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- EAttribute SCOPE_ITEM__AUTHOR = eINSTANCE.getScopeItem_Author();
-
- /**
- * The meta object literal for the '{@link org.eclipse.mylyn.reviews.core.model.review.Rating <em>Rating</em>}' enum.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.Rating
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getRating()
- * @generated
- */
- EEnum RATING = eINSTANCE.getRating();
-
- /**
- * The meta object literal for the '<em>IFile Patch2</em>' data type.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.compare.patch.IFilePatch2
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getIFilePatch2()
- * @generated
- */
- EDataType IFILE_PATCH2 = eINSTANCE.getIFilePatch2();
-
- /**
- * The meta object literal for the '<em>IProgress Monitor</em>' data type.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.core.runtime.IProgressMonitor
- * @see org.eclipse.mylyn.reviews.core.model.review.impl.ReviewPackageImpl#getIProgressMonitor()
- * @generated
- */
- EDataType IPROGRESS_MONITOR = eINSTANCE.getIProgressMonitor();
-
- }
-
-} //ReviewPackage
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewResult.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewResult.java
deleted file mode 100644
index 59c089de..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ReviewResult.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Result</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getText <em>Text</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getRating <em>Rating</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getReviewer <em>Reviewer</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getReviewResult()
- * @model
- * @generated
- */
-public interface ReviewResult extends EObject {
- /**
- * Returns the value of the '<em><b>Text</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Text</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Text</em>' attribute.
- * @see #setText(String)
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getReviewResult_Text()
- * @model
- * @generated
- */
- String getText();
-
- /**
- * Sets the value of the '{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getText <em>Text</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Text</em>' attribute.
- * @see #getText()
- * @generated
- */
- void setText(String value);
-
- /**
- * Returns the value of the '<em><b>Rating</b></em>' attribute.
- * The literals are from the enumeration {@link org.eclipse.mylyn.reviews.core.model.review.Rating}.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Rating</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Rating</em>' attribute.
- * @see org.eclipse.mylyn.reviews.core.model.review.Rating
- * @see #setRating(Rating)
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getReviewResult_Rating()
- * @model
- * @generated
- */
- Rating getRating();
-
- /**
- * Sets the value of the '{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getRating <em>Rating</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Rating</em>' attribute.
- * @see org.eclipse.mylyn.reviews.core.model.review.Rating
- * @see #getRating()
- * @generated
- */
- void setRating(Rating value);
-
- /**
- * Returns the value of the '<em><b>Reviewer</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Reviewer</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Reviewer</em>' attribute.
- * @see #setReviewer(String)
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getReviewResult_Reviewer()
- * @model
- * @generated
- */
- String getReviewer();
-
- /**
- * Sets the value of the '{@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult#getReviewer <em>Reviewer</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Reviewer</em>' attribute.
- * @see #getReviewer()
- * @generated
- */
- void setReviewer(String value);
-
-} // ReviewResult
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ScopeItem.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ScopeItem.java
deleted file mode 100644
index 252a01a1..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/ScopeItem.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Scope Item</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.ScopeItem#getAuthor <em>Author</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getScopeItem()
- * @model
- * @generated
- */
-public interface ScopeItem extends EObject {
- /**
- * Returns the value of the '<em><b>Author</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Author</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Author</em>' attribute.
- * @see #setAuthor(String)
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#getScopeItem_Author()
- * @model
- * @generated
- */
- String getAuthor();
-
- /**
- * Sets the value of the '{@link org.eclipse.mylyn.reviews.core.model.review.ScopeItem#getAuthor <em>Author</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Author</em>' attribute.
- * @see #getAuthor()
- * @generated
- */
- void setAuthor(String value);
-
-} // ScopeItem
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/PatchImpl.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/PatchImpl.java
deleted file mode 100644
index 15f58c54..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/PatchImpl.java
+++ /dev/null
@@ -1,299 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.Date;
-
-import org.eclipse.compare.patch.IFilePatch2;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.compare.patch.PatchParser;
-import org.eclipse.compare.patch.ReaderCreator;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.BasicEList;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-
-/**
- * <!-- begin-user-doc --> An implementation of the model object '
- * <em><b>Patch</b></em>'. <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.PatchImpl#getContents <em>Contents</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.PatchImpl#getCreationDate <em>Creation Date</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.PatchImpl#getFileName <em>File Name</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class PatchImpl extends ScopeItemImpl implements Patch {
- /**
- * The default value of the '{@link #getContents() <em>Contents</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getContents()
- * @generated
- * @ordered
- */
- protected static final String CONTENTS_EDEFAULT = null;
- /**
- * The cached value of the '{@link #getContents() <em>Contents</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getContents()
- * @generated
- * @ordered
- */
- protected String contents = CONTENTS_EDEFAULT;
- /**
- * The default value of the '{@link #getCreationDate() <em>Creation Date</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCreationDate()
- * @generated
- * @ordered
- */
- protected static final Date CREATION_DATE_EDEFAULT = null;
- /**
- * The cached value of the '{@link #getCreationDate() <em>Creation Date</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getCreationDate()
- * @generated
- * @ordered
- */
- protected Date creationDate = CREATION_DATE_EDEFAULT;
- /**
- * The default value of the '{@link #getFileName() <em>File Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFileName()
- * @generated
- * @ordered
- */
- protected static final String FILE_NAME_EDEFAULT = null;
- /**
- * The cached value of the '{@link #getFileName() <em>File Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getFileName()
- * @generated
- * @ordered
- */
- protected String fileName = FILE_NAME_EDEFAULT;
-
- /*
- * owner* <!-- begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected PatchImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return ReviewPackage.Literals.PATCH;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public String getContents() {
- return contents;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public void setContents(String newContents) {
- String oldContents = contents;
- contents = newContents;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.PATCH__CONTENTS, oldContents, contents));
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public Date getCreationDate() {
- return creationDate;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public void setCreationDate(Date newCreationDate) {
- Date oldCreationDate = creationDate;
- creationDate = newCreationDate;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.PATCH__CREATION_DATE, oldCreationDate, creationDate));
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public String getFileName() {
- return fileName;
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- public void setFileName(String newFileName) {
- String oldFileName = fileName;
- fileName = newFileName;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.PATCH__FILE_NAME, oldFileName, fileName));
- }
-
- /**
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- */
- public EList<IFilePatch2> parse() {
- try {
- IFilePatch2[] patches = PatchParser.parsePatch(new ReaderCreator() {
- @Override
- public Reader createReader() throws CoreException {
- return new InputStreamReader(new ByteArrayInputStream(
- getContents().getBytes()));
- }
- });
-
- EList<IFilePatch2> list = new BasicEList<IFilePatch2>();
-
- for (IFilePatch2 patch : patches) {
- list.add(patch);
- }
- return list;
- } catch (Exception ex) {
- // TODO
- ex.printStackTrace();
- throw new RuntimeException(ex);
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case ReviewPackage.PATCH__CONTENTS:
- return getContents();
- case ReviewPackage.PATCH__CREATION_DATE:
- return getCreationDate();
- case ReviewPackage.PATCH__FILE_NAME:
- return getFileName();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case ReviewPackage.PATCH__CONTENTS:
- setContents((String)newValue);
- return;
- case ReviewPackage.PATCH__CREATION_DATE:
- setCreationDate((Date)newValue);
- return;
- case ReviewPackage.PATCH__FILE_NAME:
- setFileName((String)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case ReviewPackage.PATCH__CONTENTS:
- setContents(CONTENTS_EDEFAULT);
- return;
- case ReviewPackage.PATCH__CREATION_DATE:
- setCreationDate(CREATION_DATE_EDEFAULT);
- return;
- case ReviewPackage.PATCH__FILE_NAME:
- setFileName(FILE_NAME_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case ReviewPackage.PATCH__CONTENTS:
- return CONTENTS_EDEFAULT == null ? contents != null : !CONTENTS_EDEFAULT.equals(contents);
- case ReviewPackage.PATCH__CREATION_DATE:
- return CREATION_DATE_EDEFAULT == null ? creationDate != null : !CREATION_DATE_EDEFAULT.equals(creationDate);
- case ReviewPackage.PATCH__FILE_NAME:
- return FILE_NAME_EDEFAULT == null ? fileName != null : !FILE_NAME_EDEFAULT.equals(fileName);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (contents: ");
- result.append(contents);
- result.append(", creationDate: ");
- result.append(creationDate);
- result.append(", fileName: ");
- result.append(fileName);
- result.append(')');
- return result.toString();
- }
-
-} // PatchImpl
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewFactoryImpl.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewFactoryImpl.java
deleted file mode 100644
index 0ef56ca2..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewFactoryImpl.java
+++ /dev/null
@@ -1,235 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review.impl;
-
-import org.eclipse.compare.patch.IFilePatch2;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-
-import org.eclipse.emf.ecore.impl.EFactoryImpl;
-
-import org.eclipse.emf.ecore.plugin.EcorePlugin;
-
-import org.eclipse.mylyn.reviews.core.model.review.*;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Factory</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class ReviewFactoryImpl extends EFactoryImpl implements ReviewFactory {
- /**
- * Creates the default factory implementation.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static ReviewFactory init() {
- try {
- ReviewFactory theReviewFactory = (ReviewFactory)EPackage.Registry.INSTANCE.getEFactory("org.eclipse.mylyn.reviews");
- if (theReviewFactory != null) {
- return theReviewFactory;
- }
- }
- catch (Exception exception) {
- EcorePlugin.INSTANCE.log(exception);
- }
- return new ReviewFactoryImpl();
- }
-
- /**
- * Creates an instance of the factory.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ReviewFactoryImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public EObject create(EClass eClass) {
- switch (eClass.getClassifierID()) {
- case ReviewPackage.REVIEW: return createReview();
- case ReviewPackage.REVIEW_RESULT: return createReviewResult();
- case ReviewPackage.PATCH: return createPatch();
- case ReviewPackage.SCOPE_ITEM: return createScopeItem();
- default:
- throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object createFromString(EDataType eDataType, String initialValue) {
- switch (eDataType.getClassifierID()) {
- case ReviewPackage.RATING:
- return createRatingFromString(eDataType, initialValue);
- case ReviewPackage.IFILE_PATCH2:
- return createIFilePatch2FromString(eDataType, initialValue);
- case ReviewPackage.IPROGRESS_MONITOR:
- return createIProgressMonitorFromString(eDataType, initialValue);
- default:
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String convertToString(EDataType eDataType, Object instanceValue) {
- switch (eDataType.getClassifierID()) {
- case ReviewPackage.RATING:
- return convertRatingToString(eDataType, instanceValue);
- case ReviewPackage.IFILE_PATCH2:
- return convertIFilePatch2ToString(eDataType, instanceValue);
- case ReviewPackage.IPROGRESS_MONITOR:
- return convertIProgressMonitorToString(eDataType, instanceValue);
- default:
- throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Review createReview() {
- ReviewImpl review = new ReviewImpl();
- return review;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ReviewResult createReviewResult() {
- ReviewResultImpl reviewResult = new ReviewResultImpl();
- return reviewResult;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Patch createPatch() {
- PatchImpl patch = new PatchImpl();
- return patch;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ScopeItem createScopeItem() {
- ScopeItemImpl scopeItem = new ScopeItemImpl();
- return scopeItem;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Rating createRatingFromString(EDataType eDataType, String initialValue) {
- Rating result = Rating.get(initialValue);
- if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertRatingToString(EDataType eDataType, Object instanceValue) {
- return instanceValue == null ? null : instanceValue.toString();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public IFilePatch2 createIFilePatch2FromString(EDataType eDataType, String initialValue) {
- return (IFilePatch2)super.createFromString(eDataType, initialValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertIFilePatch2ToString(EDataType eDataType, Object instanceValue) {
- return super.convertToString(eDataType, instanceValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public IProgressMonitor createIProgressMonitorFromString(EDataType eDataType, String initialValue) {
- return (IProgressMonitor)super.createFromString(eDataType, initialValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String convertIProgressMonitorToString(EDataType eDataType, Object instanceValue) {
- return super.convertToString(eDataType, instanceValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ReviewPackage getReviewPackage() {
- return (ReviewPackage)getEPackage();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @deprecated
- * @generated
- */
- @Deprecated
- public static ReviewPackage getPackage() {
- return ReviewPackage.eINSTANCE;
- }
-
-} //ReviewFactoryImpl
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewImpl.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewImpl.java
deleted file mode 100644
index 4cebc515..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewImpl.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review.impl;
-
-import java.util.Collection;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-
-import org.eclipse.emf.ecore.EClass;
-
-import org.eclipse.emf.ecore.InternalEObject;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.emf.ecore.util.EObjectResolvingEList;
-
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewResult;
-import org.eclipse.mylyn.reviews.core.model.review.ScopeItem;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Review</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewImpl#getResult <em>Result</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewImpl#getScope <em>Scope</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class ReviewImpl extends EObjectImpl implements Review {
- /**
- * The cached value of the '{@link #getResult() <em>Result</em>}' reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getResult()
- * @generated
- * @ordered
- */
- protected ReviewResult result;
- /**
- * The cached value of the '{@link #getScope() <em>Scope</em>}' reference list.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getScope()
- * @generated
- * @ordered
- */
- protected EList<ScopeItem> scope;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected ReviewImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return ReviewPackage.Literals.REVIEW;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ReviewResult getResult() {
- if (result != null && result.eIsProxy()) {
- InternalEObject oldResult = (InternalEObject)result;
- result = (ReviewResult)eResolveProxy(oldResult);
- if (result != oldResult) {
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReviewPackage.REVIEW__RESULT, oldResult, result));
- }
- }
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ReviewResult basicGetResult() {
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setResult(ReviewResult newResult) {
- ReviewResult oldResult = result;
- result = newResult;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.REVIEW__RESULT, oldResult, result));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- public EList<ScopeItem> getScope() {
- if (scope == null) {
- scope = new EObjectResolvingEList<ScopeItem>(ScopeItem.class, this, ReviewPackage.REVIEW__SCOPE);
- }
- return scope;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case ReviewPackage.REVIEW__RESULT:
- if (resolve) return getResult();
- return basicGetResult();
- case ReviewPackage.REVIEW__SCOPE:
- return getScope();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @SuppressWarnings("unchecked")
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case ReviewPackage.REVIEW__RESULT:
- setResult((ReviewResult)newValue);
- return;
- case ReviewPackage.REVIEW__SCOPE:
- getScope().clear();
- getScope().addAll((Collection<? extends ScopeItem>)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case ReviewPackage.REVIEW__RESULT:
- setResult((ReviewResult)null);
- return;
- case ReviewPackage.REVIEW__SCOPE:
- getScope().clear();
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case ReviewPackage.REVIEW__RESULT:
- return result != null;
- case ReviewPackage.REVIEW__SCOPE:
- return scope != null && !scope.isEmpty();
- }
- return super.eIsSet(featureID);
- }
-
-} //ReviewImpl
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewPackageImpl.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewPackageImpl.java
deleted file mode 100644
index 0b2e5332..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewPackageImpl.java
+++ /dev/null
@@ -1,413 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review.impl;
-
-import org.eclipse.compare.patch.IFilePatch2;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.Rating;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewFactory;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewResult;
-import org.eclipse.mylyn.reviews.core.model.review.ScopeItem;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Package</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class ReviewPackageImpl extends EPackageImpl implements ReviewPackage {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass reviewEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass reviewResultEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass patchEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass scopeItemEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EEnum ratingEEnum = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType iFilePatch2EDataType = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType iProgressMonitorEDataType = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private ReviewPackageImpl() {
- super(eNS_URI, ReviewFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- *
- * <p>This method is used to initialize {@link ReviewPackage#eINSTANCE} when that field is accessed.
- * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static ReviewPackage init() {
- if (isInited) return (ReviewPackage)EPackage.Registry.INSTANCE.getEPackage(ReviewPackage.eNS_URI);
-
- // Obtain or create and register package
- ReviewPackageImpl theReviewPackage = (ReviewPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ReviewPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ReviewPackageImpl());
-
- isInited = true;
-
- // Create package meta-data objects
- theReviewPackage.createPackageContents();
-
- // Initialize created meta-data
- theReviewPackage.initializePackageContents();
-
- // Mark meta-data to indicate it can't be changed
- theReviewPackage.freeze();
-
-
- // Update the registry and return the package
- EPackage.Registry.INSTANCE.put(ReviewPackage.eNS_URI, theReviewPackage);
- return theReviewPackage;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getReview() {
- return reviewEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getReview_Result() {
- return (EReference)reviewEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getReview_Scope() {
- return (EReference)reviewEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getReviewResult() {
- return reviewResultEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getReviewResult_Text() {
- return (EAttribute)reviewResultEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getReviewResult_Rating() {
- return (EAttribute)reviewResultEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getReviewResult_Reviewer() {
- return (EAttribute)reviewResultEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getPatch() {
- return patchEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getPatch_Contents() {
- return (EAttribute)patchEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getPatch_CreationDate() {
- return (EAttribute)patchEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getPatch_FileName() {
- return (EAttribute)patchEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getScopeItem() {
- return scopeItemEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getScopeItem_Author() {
- return (EAttribute)scopeItemEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EEnum getRating() {
- return ratingEEnum;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EDataType getIFilePatch2() {
- return iFilePatch2EDataType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EDataType getIProgressMonitor() {
- return iProgressMonitorEDataType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ReviewFactory getReviewFactory() {
- return (ReviewFactory)getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated) return;
- isCreated = true;
-
- // Create classes and their features
- reviewEClass = createEClass(REVIEW);
- createEReference(reviewEClass, REVIEW__RESULT);
- createEReference(reviewEClass, REVIEW__SCOPE);
-
- reviewResultEClass = createEClass(REVIEW_RESULT);
- createEAttribute(reviewResultEClass, REVIEW_RESULT__TEXT);
- createEAttribute(reviewResultEClass, REVIEW_RESULT__RATING);
- createEAttribute(reviewResultEClass, REVIEW_RESULT__REVIEWER);
-
- patchEClass = createEClass(PATCH);
- createEAttribute(patchEClass, PATCH__CONTENTS);
- createEAttribute(patchEClass, PATCH__CREATION_DATE);
- createEAttribute(patchEClass, PATCH__FILE_NAME);
-
- scopeItemEClass = createEClass(SCOPE_ITEM);
- createEAttribute(scopeItemEClass, SCOPE_ITEM__AUTHOR);
-
- // Create enums
- ratingEEnum = createEEnum(RATING);
-
- // Create data types
- iFilePatch2EDataType = createEDataType(IFILE_PATCH2);
- iProgressMonitorEDataType = createEDataType(IPROGRESS_MONITOR);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized) return;
- isInitialized = true;
-
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
-
- // Create type parameters
-
- // Set bounds for type parameters
-
- // Add supertypes to classes
- patchEClass.getESuperTypes().add(this.getScopeItem());
-
- // Initialize classes and features; add operations and parameters
- initEClass(reviewEClass, Review.class, "Review", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getReview_Result(), this.getReviewResult(), null, "result", null, 0, 1, Review.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEReference(getReview_Scope(), this.getScopeItem(), null, "scope", null, 0, -1, Review.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(reviewResultEClass, ReviewResult.class, "ReviewResult", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getReviewResult_Text(), ecorePackage.getEString(), "text", null, 0, 1, ReviewResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getReviewResult_Rating(), this.getRating(), "rating", null, 0, 1, ReviewResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getReviewResult_Reviewer(), ecorePackage.getEString(), "reviewer", null, 0, 1, ReviewResult.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(patchEClass, Patch.class, "Patch", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getPatch_Contents(), ecorePackage.getEString(), "contents", null, 0, 1, Patch.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPatch_CreationDate(), ecorePackage.getEDate(), "creationDate", null, 0, 1, Patch.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getPatch_FileName(), ecorePackage.getEString(), "fileName", null, 0, 1, Patch.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- addEOperation(patchEClass, this.getIFilePatch2(), "parse", 0, -1, IS_UNIQUE, IS_ORDERED);
-
- initEClass(scopeItemEClass, ScopeItem.class, "ScopeItem", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getScopeItem_Author(), ecorePackage.getEString(), "author", null, 0, 1, ScopeItem.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- // Initialize enums and add enum literals
- initEEnum(ratingEEnum, Rating.class, "Rating");
- addEEnumLiteral(ratingEEnum, Rating.NONE);
- addEEnumLiteral(ratingEEnum, Rating.PASSED);
- addEEnumLiteral(ratingEEnum, Rating.WARNING);
- addEEnumLiteral(ratingEEnum, Rating.FAILED);
-
- // Initialize data types
- initEDataType(iFilePatch2EDataType, IFilePatch2.class, "IFilePatch2", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
- initEDataType(iProgressMonitorEDataType, IProgressMonitor.class, "IProgressMonitor", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
-
- // Create resource
- createResource(eNS_URI);
- }
-
-} //ReviewPackageImpl
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewResultImpl.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewResultImpl.java
deleted file mode 100644
index 1619866d..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ReviewResultImpl.java
+++ /dev/null
@@ -1,272 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.mylyn.reviews.core.model.review.Rating;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewResult;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Result</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewResultImpl#getText <em>Text</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewResultImpl#getRating <em>Rating</em>}</li>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.ReviewResultImpl#getReviewer <em>Reviewer</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class ReviewResultImpl extends EObjectImpl implements ReviewResult {
- /**
- * The default value of the '{@link #getText() <em>Text</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getText()
- * @generated
- * @ordered
- */
- protected static final String TEXT_EDEFAULT = null;
- /**
- * The cached value of the '{@link #getText() <em>Text</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getText()
- * @generated
- * @ordered
- */
- protected String text = TEXT_EDEFAULT;
- /**
- * The default value of the '{@link #getRating() <em>Rating</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getRating()
- * @generated
- * @ordered
- */
- protected static final Rating RATING_EDEFAULT = Rating.NONE;
- /**
- * The cached value of the '{@link #getRating() <em>Rating</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getRating()
- * @generated
- * @ordered
- */
- protected Rating rating = RATING_EDEFAULT;
- /**
- * The default value of the '{@link #getReviewer() <em>Reviewer</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getReviewer()
- * @generated
- * @ordered
- */
- protected static final String REVIEWER_EDEFAULT = null;
- /**
- * The cached value of the '{@link #getReviewer() <em>Reviewer</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getReviewer()
- * @generated
- * @ordered
- */
- protected String reviewer = REVIEWER_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected ReviewResultImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return ReviewPackage.Literals.REVIEW_RESULT;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getText() {
- return text;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setText(String newText) {
- String oldText = text;
- text = newText;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.REVIEW_RESULT__TEXT, oldText, text));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public Rating getRating() {
- return rating;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setRating(Rating newRating) {
- Rating oldRating = rating;
- rating = newRating == null ? RATING_EDEFAULT : newRating;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.REVIEW_RESULT__RATING, oldRating, rating));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getReviewer() {
- return reviewer;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setReviewer(String newReviewer) {
- String oldReviewer = reviewer;
- reviewer = newReviewer;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.REVIEW_RESULT__REVIEWER, oldReviewer, reviewer));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case ReviewPackage.REVIEW_RESULT__TEXT:
- return getText();
- case ReviewPackage.REVIEW_RESULT__RATING:
- return getRating();
- case ReviewPackage.REVIEW_RESULT__REVIEWER:
- return getReviewer();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case ReviewPackage.REVIEW_RESULT__TEXT:
- setText((String)newValue);
- return;
- case ReviewPackage.REVIEW_RESULT__RATING:
- setRating((Rating)newValue);
- return;
- case ReviewPackage.REVIEW_RESULT__REVIEWER:
- setReviewer((String)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case ReviewPackage.REVIEW_RESULT__TEXT:
- setText(TEXT_EDEFAULT);
- return;
- case ReviewPackage.REVIEW_RESULT__RATING:
- setRating(RATING_EDEFAULT);
- return;
- case ReviewPackage.REVIEW_RESULT__REVIEWER:
- setReviewer(REVIEWER_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case ReviewPackage.REVIEW_RESULT__TEXT:
- return TEXT_EDEFAULT == null ? text != null : !TEXT_EDEFAULT.equals(text);
- case ReviewPackage.REVIEW_RESULT__RATING:
- return rating != RATING_EDEFAULT;
- case ReviewPackage.REVIEW_RESULT__REVIEWER:
- return REVIEWER_EDEFAULT == null ? reviewer != null : !REVIEWER_EDEFAULT.equals(reviewer);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (text: ");
- result.append(text);
- result.append(", rating: ");
- result.append(rating);
- result.append(", reviewer: ");
- result.append(reviewer);
- result.append(')');
- return result.toString();
- }
-
-} //ReviewResultImpl
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ScopeItemImpl.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ScopeItemImpl.java
deleted file mode 100644
index cad5f6f7..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/impl/ScopeItemImpl.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review.impl;
-
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.ENotificationImpl;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-import org.eclipse.mylyn.reviews.core.model.review.ScopeItem;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model object '<em><b>Scope Item</b></em>'.
- * <!-- end-user-doc -->
- * <p>
- * The following features are implemented:
- * <ul>
- * <li>{@link org.eclipse.mylyn.reviews.core.model.review.impl.ScopeItemImpl#getAuthor <em>Author</em>}</li>
- * </ul>
- * </p>
- *
- * @generated
- */
-public class ScopeItemImpl extends EObjectImpl implements ScopeItem {
- /**
- * The default value of the '{@link #getAuthor() <em>Author</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAuthor()
- * @generated
- * @ordered
- */
- protected static final String AUTHOR_EDEFAULT = null;
- /**
- * The cached value of the '{@link #getAuthor() <em>Author</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #getAuthor()
- * @generated
- * @ordered
- */
- protected String author = AUTHOR_EDEFAULT;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected ScopeItemImpl() {
- super();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EClass eStaticClass() {
- return ReviewPackage.Literals.SCOPE_ITEM;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public String getAuthor() {
- return author;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void setAuthor(String newAuthor) {
- String oldAuthor = author;
- author = newAuthor;
- if (eNotificationRequired())
- eNotify(new ENotificationImpl(this, Notification.SET, ReviewPackage.SCOPE_ITEM__AUTHOR, oldAuthor, author));
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public Object eGet(int featureID, boolean resolve, boolean coreType) {
- switch (featureID) {
- case ReviewPackage.SCOPE_ITEM__AUTHOR:
- return getAuthor();
- }
- return super.eGet(featureID, resolve, coreType);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eSet(int featureID, Object newValue) {
- switch (featureID) {
- case ReviewPackage.SCOPE_ITEM__AUTHOR:
- setAuthor((String)newValue);
- return;
- }
- super.eSet(featureID, newValue);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public void eUnset(int featureID) {
- switch (featureID) {
- case ReviewPackage.SCOPE_ITEM__AUTHOR:
- setAuthor(AUTHOR_EDEFAULT);
- return;
- }
- super.eUnset(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public boolean eIsSet(int featureID) {
- switch (featureID) {
- case ReviewPackage.SCOPE_ITEM__AUTHOR:
- return AUTHOR_EDEFAULT == null ? author != null : !AUTHOR_EDEFAULT.equals(author);
- }
- return super.eIsSet(featureID);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public String toString() {
- if (eIsProxy()) return super.toString();
-
- StringBuffer result = new StringBuffer(super.toString());
- result.append(" (author: ");
- result.append(author);
- result.append(')');
- return result.toString();
- }
-
-} //ScopeItemImpl
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/util/ReviewAdapterFactory.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/util/ReviewAdapterFactory.java
deleted file mode 100644
index 73e096eb..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/util/ReviewAdapterFactory.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review.util;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.mylyn.reviews.core.model.review.*;
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewResult;
-import org.eclipse.mylyn.reviews.core.model.review.ScopeItem;
-
-/**
- * <!-- begin-user-doc --> The <b>Adapter Factory</b> for the model. It provides
- * an adapter <code>createXXX</code> method for each class of the model. <!--
- * end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage
- * @generated
- */
-public class ReviewAdapterFactory extends AdapterFactoryImpl {
- /**
- * The cached model package.
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- protected static ReviewPackage modelPackage;
-
- /**
- * Creates an instance of the adapter factory.
- * <!-- begin-user-doc --> <!--
- * end-user-doc -->
- * @generated
- */
- public ReviewAdapterFactory() {
- if (modelPackage == null) {
- modelPackage = ReviewPackage.eINSTANCE;
- }
- }
-
- /**
- * Returns whether this factory is applicable for the type of the object.
- * <!-- begin-user-doc --> This implementation returns <code>true</code> if
- * the object is either the model's package or is an instance object of the
- * model. <!-- end-user-doc -->
- * @return whether this factory is applicable for the type of the object.
- * @generated
- */
- @Override
- public boolean isFactoryForType(Object object) {
- if (object == modelPackage) {
- return true;
- }
- if (object instanceof EObject) {
- return ((EObject)object).eClass().getEPackage() == modelPackage;
- }
- return false;
- }
-
- /**
- * The switch that delegates to the <code>createXXX</code> methods. <!--
- * begin-user-doc --> <!-- end-user-doc -->
- *
- * @generated
- */
- protected ReviewSwitch<Adapter> modelSwitch = new ReviewSwitch<Adapter>() {
- @Override
- public Adapter caseReview(Review object) {
- return createReviewAdapter();
- }
- @Override
- public Adapter caseReviewResult(ReviewResult object) {
- return createReviewResultAdapter();
- }
- @Override
- public Adapter casePatch(Patch object) {
- return createPatchAdapter();
- }
- @Override
- public Adapter caseScopeItem(ScopeItem object) {
- return createScopeItemAdapter();
- }
- @Override
- public Adapter defaultCase(EObject object) {
- return createEObjectAdapter();
- }
- };
-
- /**
- * Creates an adapter for the <code>target</code>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param target the object to adapt.
- * @return the adapter for the <code>target</code>.
- * @generated
- */
- @Override
- public Adapter createAdapter(Notifier target) {
- return modelSwitch.doSwitch((EObject)target);
- }
-
- /**
- * Creates a new adapter for an object of class '
- * {@link org.eclipse.mylyn.reviews.core.model.review.Review
- * <em>Review</em>}'. <!-- begin-user-doc --> This default implementation
- * returns null so that we can easily ignore cases; it's useful to ignore a
- * case when inheritance will catch all the cases anyway. <!-- end-user-doc
- * -->
- *
- * @return the new adapter.
- * @see org.eclipse.mylyn.reviews.core.model.review.Review
- * @generated
- */
- public Adapter createReviewAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '
- * {@link org.eclipse.mylyn.reviews.core.model.review.ReviewResult
- * <em>Result</em>}'. <!-- begin-user-doc --> This default implementation
- * returns null so that we can easily ignore cases; it's useful to ignore a
- * case when inheritance will catch all the cases anyway. <!-- end-user-doc
- * -->
- *
- * @return the new adapter.
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewResult
- * @generated
- */
- public Adapter createReviewResultAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.mylyn.reviews.core.model.review.Patch <em>Patch</em>}'.
- * <!-- begin-user-doc --> This default implementation returns null so
- * that we can easily ignore cases; it's useful to ignore a case when
- * inheritance will catch all the cases anyway. <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.mylyn.reviews.core.model.review.Patch
- * @generated
- */
- public Adapter createPatchAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for an object of class '{@link org.eclipse.mylyn.reviews.core.model.review.ScopeItem <em>Scope Item</em>}'.
- * <!-- begin-user-doc --> This default
- * implementation returns null so that we can easily ignore cases; it's
- * useful to ignore a case when inheritance will catch all the cases anyway.
- * <!-- end-user-doc -->
- * @return the new adapter.
- * @see org.eclipse.mylyn.reviews.core.model.review.ScopeItem
- * @generated
- */
- public Adapter createScopeItemAdapter() {
- return null;
- }
-
- /**
- * Creates a new adapter for the default case.
- * <!-- begin-user-doc --> This
- * default implementation returns null. <!-- end-user-doc -->
- * @return the new adapter.
- * @generated
- */
- public Adapter createEObjectAdapter() {
- return null;
- }
-
-} // ReviewAdapterFactory
diff --git a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/util/ReviewSwitch.java b/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/util/ReviewSwitch.java
deleted file mode 100644
index 3ab3388d..00000000
--- a/org.eclipse.mylyn.reviews.core/src/org/eclipse/mylyn/reviews/core/model/review/util/ReviewSwitch.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- */
-package org.eclipse.mylyn.reviews.core.model.review.util;
-
-import java.util.List;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.mylyn.reviews.core.model.review.*;
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewPackage;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewResult;
-import org.eclipse.mylyn.reviews.core.model.review.ScopeItem;
-
-/**
- * <!-- begin-user-doc --> The <b>Switch</b> for the model's inheritance
- * hierarchy. It supports the call {@link #doSwitch(EObject) doSwitch(object)}
- * to invoke the <code>caseXXX</code> method for each class of the model,
- * starting with the actual class of the object and proceeding up the
- * inheritance hierarchy until a non-null result is returned, which is the
- * result of the switch. <!-- end-user-doc -->
- * @see org.eclipse.mylyn.reviews.core.model.review.ReviewPackage
- * @generated
- */
-public class ReviewSwitch<T> {
- /**
- * The cached model package
- * <!-- begin-user-doc --> <!-- end-user-doc -->
- * @generated
- */
- protected static ReviewPackage modelPackage;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc --> <!--
- * end-user-doc -->
- * @generated
- */
- public ReviewSwitch() {
- if (modelPackage == null) {
- modelPackage = ReviewPackage.eINSTANCE;
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc --> <!--
- * end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- public T doSwitch(EObject theEObject) {
- return doSwitch(theEObject.eClass(), theEObject);
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc --> <!--
- * end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(EClass theEClass, EObject theEObject) {
- if (theEClass.eContainer() == modelPackage) {
- return doSwitch(theEClass.getClassifierID(), theEObject);
- }
- else {
- List<EClass> eSuperTypes = theEClass.getESuperTypes();
- return
- eSuperTypes.isEmpty() ?
- defaultCase(theEObject) :
- doSwitch(eSuperTypes.get(0), theEObject);
- }
- }
-
- /**
- * Calls <code>caseXXX</code> for each class of the model until one returns a non null result; it yields that result.
- * <!-- begin-user-doc --> <!--
- * end-user-doc -->
- * @return the first non-null result returned by a <code>caseXXX</code> call.
- * @generated
- */
- protected T doSwitch(int classifierID, EObject theEObject) {
- switch (classifierID) {
- case ReviewPackage.REVIEW: {
- Review review = (Review)theEObject;
- T result = caseReview(review);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case ReviewPackage.REVIEW_RESULT: {
- ReviewResult reviewResult = (ReviewResult)theEObject;
- T result = caseReviewResult(reviewResult);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case ReviewPackage.PATCH: {
- Patch patch = (Patch)theEObject;
- T result = casePatch(patch);
- if (result == null) result = caseScopeItem(patch);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- case ReviewPackage.SCOPE_ITEM: {
- ScopeItem scopeItem = (ScopeItem)theEObject;
- T result = caseScopeItem(scopeItem);
- if (result == null) result = defaultCase(theEObject);
- return result;
- }
- default: return defaultCase(theEObject);
- }
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Review</em>'.
- * <!-- begin-user-doc --> This implementation returns
- * null; returning a non-null result will terminate the switch. <!--
- * end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Review</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseReview(Review object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Result</em>'.
- * <!-- begin-user-doc --> This implementation returns
- * null; returning a non-null result will terminate the switch. <!--
- * end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Result</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseReviewResult(ReviewResult object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Patch</em>'.
- * <!-- begin-user-doc --> This implementation returns
- * null; returning a non-null result will terminate the switch. <!--
- * end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Patch</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T casePatch(Patch object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>Scope Item</em>'.
- * <!-- begin-user-doc --> This implementation returns
- * null; returning a non-null result will terminate the switch. <!--
- * end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>Scope Item</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject) doSwitch(EObject)
- * @generated
- */
- public T caseScopeItem(ScopeItem object) {
- return null;
- }
-
- /**
- * Returns the result of interpreting the object as an instance of '<em>EObject</em>'.
- * <!-- begin-user-doc --> This implementation returns
- * null; returning a non-null result will terminate the switch, but this is
- * the last case anyway. <!-- end-user-doc -->
- * @param object the target of the switch.
- * @return the result of interpreting the object as an instance of '<em>EObject</em>'.
- * @see #doSwitch(org.eclipse.emf.ecore.EObject)
- * @generated
- */
- public T defaultCase(EObject object) {
- return null;
- }
-
-} // ReviewSwitch
diff --git a/org.eclipse.mylyn.reviews.ui/.classpath b/org.eclipse.mylyn.reviews.ui/.classpath
deleted file mode 100644
index ad32c83a..00000000
--- a/org.eclipse.mylyn.reviews.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/org.eclipse.mylyn.reviews.ui/.project b/org.eclipse.mylyn.reviews.ui/.project
deleted file mode 100644
index 8d039bc9..00000000
--- a/org.eclipse.mylyn.reviews.ui/.project
+++ /dev/null
@@ -1,34 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.mylyn.reviews.ui</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.mylyn.reviews.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.reviews.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index cf178a13..00000000
--- a/org.eclipse.mylyn.reviews.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,20 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: Mylyn Reviews UI (Incubation)
-Bundle-SymbolicName: org.eclipse.mylyn.reviews.ui;singleton:=true
-Bundle-Version: 0.0.1
-Bundle-Activator: org.eclipse.mylyn.reviews.ui.ReviewsUiPlugin
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.mylyn.tasks.ui;bundle-version="3.5.0",
- org.eclipse.ui.forms;bundle-version="3.4.1",
- org.eclipse.mylyn.tasks.core;bundle-version="3.3.0",
- org.eclipse.compare;bundle-version="3.5.0",
- org.eclipse.mylyn.reviews.core;bundle-version="0.0.1",
- org.eclipse.emf.ecore.change;bundle-version="2.5.0",
- org.eclipse.mylyn.bugzilla.ui;bundle-version="3.4.0",
- org.eclipse.core.resources;bundle-version="3.6.0"
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
-Export-Package: org.eclipse.mylyn.reviews.ui,
- org.eclipse.mylyn.reviews.ui.editors
diff --git a/org.eclipse.mylyn.reviews.ui/about.html b/org.eclipse.mylyn.reviews.ui/about.html
deleted file mode 100644
index d677c21a..00000000
--- a/org.eclipse.mylyn.reviews.ui/about.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 1, 2010</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, "Program" will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party ("Redistributor") and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
-
-
- <h3>Third Party Content</h3>
- <p>The Content includes items that have been sourced from third parties as set out below. If you
- did not receive this Content directly from the Eclipse Foundation, the following is provided
- for informational purposes only, and you should look to the Redistributor's license for
- terms and conditions of use.</p>
- <p>
- <br/><br/>
-
- <strong>Silk icon set 1.3</strong>
- <br/><br/>
-
- <p>The plug-in includes one Icon from the Silk Icon Set made by Mark James.
- This icon is licensed under the <a href="http://creativecommons.org/licenses/by/2.5/">Creative Commons Attribution 2.5 License</a> (<a href="about_files/CreativeCommons-Attribution2.5-Legalcode.html">local copy</a>).
- The original icons are available from <a href="http://www.famfamfam.com/lab/icons/silk/">http://www.famfamfam.com/lab/icons/silk/</a>.
- The following files are included:</p>
-
- <pre>
- icons/review_none.png: renamed from delete.png
- </pre>
-
-
- </p>
-
-
-</body>
-</html>
-
-
-
-
-
-</body>
-</html>
diff --git a/org.eclipse.mylyn.reviews.ui/about_files/CreativeCommons-Attribution2.5-Legalcode.html b/org.eclipse.mylyn.reviews.ui/about_files/CreativeCommons-Attribution2.5-Legalcode.html
deleted file mode 100644
index 7a9185d7..00000000
--- a/org.eclipse.mylyn.reviews.ui/about_files/CreativeCommons-Attribution2.5-Legalcode.html
+++ /dev/null
@@ -1,203 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd">
-<html>
-<head>
-<title>Creative Commons Legal Code</title>
-<link rel="stylesheet" type="text/css" href="http://creativecommons.org/includes/deeds.css" />
-<style type="text/css">
-
-li {
-margin-bottom:12px;
-}
-
-</style>
-</head>
-
-<body>
-
-<p align="center"><a href="http://creativecommons.org/">Creative Commons</a></p>
-
-
-
-<div id="deed">
-<div align="center"><img src="http://creativecommons.org/images/deed/logo_code.gif" alt="Creative Commons Legal Code" width="280" height="79" vspace="14" border="0" /></div>
-
-
-<p align="center"><b>Attribution 2.5</b></p>
-
-
-<div class="text">
-
-
-<div class="fineprint" style="background:none;">
-CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE LEGAL
-SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN
-ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS INFORMATION ON
-AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES REGARDING THE
-INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
-ITS USE.</div>
-
-
-
-
-<p><em>License</em> </p>
-
-<p>THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. </p>
-
-<p>BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS. </p>
-
-
-<p><strong>1. Definitions</strong> </p>
-
-<ol type="a">
-<li>
-<strong>"Collective Work"</strong> means a work, such as a periodical issue, anthology or encyclopedia, in which the Work in its entirety in unmodified form, along with a number of other contributions, constituting separate and independent works in themselves, are assembled into a collective whole. A work that constitutes a Collective Work will not be considered a Derivative Work (as defined below) for the purposes of this License.
-</li>
-
-<li>
-<strong>"Derivative Work"</strong> means a work based upon the Work or upon the Work and other pre-existing works, such as a translation, musical arrangement, dramatization, fictionalization, motion picture version, sound recording, art reproduction, abridgment, condensation, or any other form in which the Work may be recast, transformed, or adapted, except that a work that constitutes a Collective Work will not be considered a Derivative Work for the purpose of this License. For the avoidance of doubt, where the Work is a musical composition or sound recording, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered a Derivative Work for the purpose of this License.</li>
-
-<li>
-<strong>"Licensor"</strong> means the individual or entity that offers the Work under the terms of this License.
-</li>
-
-<li>
-<strong>"Original Author"</strong> means the individual or entity who created the Work.
-</li>
-
-<li>
-<strong>"Work"</strong> means the copyrightable work of authorship offered under the terms of this License.
-</li>
-
-<li>
-<strong>"You"</strong> means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
-</li>
-</ol>
-
-<p><strong>2. Fair Use Rights.</strong> Nothing in this license is intended to reduce, limit, or restrict any rights arising from fair use, first sale or other limitations on the exclusive rights of the copyright owner under copyright law or other applicable laws. </p>
-
-
-<p><strong>3. License Grant.</strong> Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below: </p>
-
-
-<ol type="a">
-<li>
-to reproduce the Work, to incorporate the Work into one or more Collective Works, and to reproduce the Work as incorporated in the Collective Works;
-</li>
-
-<li>
-to create and reproduce Derivative Works;
-</li>
-
-<li>
-to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission the Work including as incorporated in Collective Works;
-
-</li>
-
-<li>
-to distribute copies or phonorecords of, display publicly, perform publicly, and perform publicly by means of a digital audio transmission Derivative Works.
-</li>
-
-<li><p>For the avoidance of doubt, where the work is a musical composition:</p>
-
-<ol type="i">
-<li><strong>Performance Royalties Under Blanket Licenses</strong>. Licensor waives the exclusive right to collect, whether individually or via a performance rights society (e.g. ASCAP, BMI, SESAC), royalties for the public performance or public digital performance (e.g. webcast) of the Work.</li>
-
-<li><strong>Mechanical Rights and Statutory Royalties</strong>. Licensor waives the exclusive right to collect, whether individually or via a music rights agency or designated agent (e.g. Harry Fox Agency), royalties for any phonorecord You create from the Work ("cover version") and distribute, subject to the compulsory license created by 17 USC Section 115 of the US Copyright Act (or the equivalent in other jurisdictions).</li></ol></li>
-
-<li><strong>Webcasting Rights and Statutory Royalties</strong>. For the avoidance of doubt, where the Work is a sound recording, Licensor waives the exclusive right to collect, whether individually or via a performance-rights society (e.g. SoundExchange), royalties for the public digital performance (e.g. webcast) of the Work, subject to the compulsory license created by 17 USC Section 114 of the US Copyright Act (or the equivalent in other jurisdictions).</li>
-
-</ol>
-
-
-<p>The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. All rights not expressly granted by Licensor are hereby reserved.</p>
-
-<p><strong>4. Restrictions.</strong>The license granted in Section 3 above is expressly made subject to and limited by the following restrictions: </p>
-
-
-<ol type="a">
-<li>
-You may distribute, publicly display, publicly perform, or publicly digitally perform the Work only under the terms of this License, and You must include a copy of, or the Uniform Resource Identifier for, this License with every copy or phonorecord of the Work You distribute, publicly display, publicly perform, or publicly digitally perform. You may not offer or impose any terms on the Work that alter or restrict the terms of this License or the recipients' exercise of the rights granted hereunder. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties. You may not distribute, publicly display, publicly perform, or publicly digitally perform the Work with any technological measures that control access or use of the Work in a manner inconsistent with the terms of this License Agreement. The above applies to the Work as incorporated in a Collective Work, but this does not require the Collective Work apart from the Work itself to be made subject to the terms of this License. If You create a Collective Work, upon notice from any Licensor You must, to the extent practicable, remove from the Collective Work any credit as required by clause 4(b), as requested. If You create a Derivative Work, upon notice from any Licensor You must, to the extent practicable, remove from the Derivative Work any credit as required by clause 4(b), as requested.
-</li>
-
-
-<li>
-If you distribute, publicly display, publicly perform, or publicly digitally perform the Work or any Derivative Works or Collective Works, You must keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or (ii) if the Original Author and/or Licensor designate another party or parties (e.g. a sponsor institute, publishing entity, journal) for attribution in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; the title of the Work if supplied; to the extent reasonably practicable, the Uniform Resource Identifier, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and in the case of a Derivative Work, a credit identifying the use of the Work in the Derivative Work (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). Such credit may be implemented in any reasonable manner; provided, however, that in the case of a Derivative Work or Collective Work, at a minimum such credit will appear where any other comparable authorship credit appears and in a manner at least as prominent as such other comparable authorship credit.
-</li>
-
-</ol>
-
-
-
-
-
-
-<p><strong>5. Representations, Warranties and Disclaimer</strong></p>
-
-<p>UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.</p>
-
-
-<p><strong>6. Limitation on Liability.</strong> EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. </p>
-
-<p><strong>7. Termination</strong> </p>
-
-<ol type="a">
-
-<li>
-This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Derivative Works or Collective Works from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
-</li>
-
-<li>
-Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
-</li>
-</ol>
-
-<p><strong>8. Miscellaneous</strong> </p>
-
-<ol type="a">
-
-<li>
-Each time You distribute or publicly digitally perform the Work or a Collective Work, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
-</li>
-
-<li>
-Each time You distribute or publicly digitally perform a Derivative Work, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
-</li>
-
-<li>
-If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
-</li>
-
-<li>
-No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
-</li>
-
-<li>
-This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
-</li>
-</ol>
-
-
-<!-- BREAKOUT FOR CC NOTICE. NOT A PART OF THE LICENSE -->
-<div class="fineprint" >
-
-
-<p>Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor. </p>
-
-
-<p>Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, neither party will use the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time.</p>
-
-
-<p>Creative Commons may be contacted at <a href="http://creativecommons.org">http://creativecommons.org/</a>.</p>
-
-
-</div>
-<!-- END CC NOTICE -->
-
-
-</div>
-
-
-<div align="right" style="margin-bottom: 10px;"><a href="./" class="fulltext">« Back to Commons Deed</a></div>
-
-</div>
-</body></html>
diff --git a/org.eclipse.mylyn.reviews.ui/build.properties b/org.eclipse.mylyn.reviews.ui/build.properties
deleted file mode 100644
index fa2ca109..00000000
--- a/org.eclipse.mylyn.reviews.ui/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml
-p2.gathering=true
-p2.compress=true
-jre.compilation.profile = J2SE-1.5
diff --git a/org.eclipse.mylyn.reviews.ui/icons/addition.gif b/org.eclipse.mylyn.reviews.ui/icons/addition.gif
deleted file mode 100644
index 05a9f5a6..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/addition.gif and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/maximize.png b/org.eclipse.mylyn.reviews.ui/icons/maximize.png
deleted file mode 100644
index f300b7c6..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/maximize.png and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/obstructed.gif b/org.eclipse.mylyn.reviews.ui/icons/obstructed.gif
deleted file mode 100644
index 3f43a29d..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/obstructed.gif and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/review_failed.png b/org.eclipse.mylyn.reviews.ui/icons/review_failed.png
deleted file mode 100644
index 08f24936..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/review_failed.png and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/review_none.png b/org.eclipse.mylyn.reviews.ui/icons/review_none.png
deleted file mode 100644
index 6fcec88c..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/review_none.png and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/review_passed.png b/org.eclipse.mylyn.reviews.ui/icons/review_passed.png
deleted file mode 100644
index 89c8129a..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/review_passed.png and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/review_warning.png b/org.eclipse.mylyn.reviews.ui/icons/review_warning.png
deleted file mode 100644
index 0473c8e8..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/review_warning.png and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/reviews16.gif b/org.eclipse.mylyn.reviews.ui/icons/reviews16.gif
deleted file mode 100644
index d054f8d5..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/reviews16.gif and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/reviews24.gif b/org.eclipse.mylyn.reviews.ui/icons/reviews24.gif
deleted file mode 100644
index 819460a2..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/reviews24.gif and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/icons/reviews32.gif b/org.eclipse.mylyn.reviews.ui/icons/reviews32.gif
deleted file mode 100644
index 41307e3a..00000000
Binary files a/org.eclipse.mylyn.reviews.ui/icons/reviews32.gif and /dev/null differ
diff --git a/org.eclipse.mylyn.reviews.ui/plugin.xml b/org.eclipse.mylyn.reviews.ui/plugin.xml
deleted file mode 100644
index 61482a16..00000000
--- a/org.eclipse.mylyn.reviews.ui/plugin.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?><!--
- Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- -->
-
-<plugin>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- class="org.eclipse.mylyn.reviews.ui.editors.ReviewEditor"
- icon="icons/reviews32.gif"
- id="org.eclipse.mylyn.reviews.ui.editors.ReviewEditor"
- name="Mylyn Reviews Editor">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="false"
- id="org.eclipse.mylyn.reviews.ui.objectContribution1"
- objectClass="org.eclipse.mylyn.tasks.core.ITaskAttachment">
- <action
- class="org.eclipse.mylyn.reviews.ui.CreateReviewAction"
- enablesFor="*"
- id="org.eclipse.mylyn.reviews.ui.create_review_from_attachment"
- label="Create Review from Attachment"
- tooltip="Create a new review from this attachment">
- </action>
- </objectContribution>
- </extension>
- <extension
- point="org.eclipse.mylyn.tasks.ui.taskEditorPageContribution">
- <partAdvisor
- class="org.eclipse.mylyn.reviews.ui.editors.ReviewTaskEditorPartAdvisor"
- id="org.eclipse.mylyn.reviews.ui.reviewPart">
- </partAdvisor>
- <partAdvisor
- class="org.eclipse.mylyn.reviews.ui.editors.ReviewSummaryPartConfigurer"
- id="org.eclipse.mylyn.reviews.ui.reviewSummaryPart">
- </partAdvisor>
- </extension>
-
-</plugin>
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CompareItem.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CompareItem.java
deleted file mode 100644
index 9c50c24c..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CompareItem.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import java.io.InputStream;
-
-import org.eclipse.compare.IStreamContentAccessor;
-import org.eclipse.compare.ITypedElement;
-import org.eclipse.compare.patch.IFilePatchResult;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.graphics.Image;
-
-// TODO move to core?
-/*
- * @author Kilian Matt
- */
-public class CompareItem implements IStreamContentAccessor, ITypedElement {
- public enum Kind {
- ORIGINAL, PATCHED
- };
-
- private IFilePatchResult result;
- private Kind kind;
- private String filename;
-
- public CompareItem(IFilePatchResult result, Kind kind, String filename) {
- this.result = result;
- this.kind = kind;
- this.filename = filename;
- if(result == null || filename==null)
- throw new NullPointerException();
- }
-
- public InputStream getContents() throws CoreException {
- return kind == Kind.ORIGINAL ? result.getOriginalContents() : result
- .getPatchedContents();
- }
-
- public Image getImage() {
- return null;
- }
-
- public String getName() {
- return filename;
- }
-
- public String getType() {
- return ITypedElement.TEXT_TYPE;
- }
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CreateReviewAction.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CreateReviewAction.java
deleted file mode 100644
index 242ceda5..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CreateReviewAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.mylyn.reviews.ui;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.reviews.core.ReviewConstants;
-import org.eclipse.mylyn.reviews.core.ReviewsUtil;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewFactory;
-import org.eclipse.mylyn.reviews.core.model.review.ScopeItem;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.core.data.TaskMapper;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.ui.IActionDelegate;
-
-public class CreateReviewAction extends Action implements IActionDelegate {
-
- private ITaskAttachment attachment;
-
- public void run(IAction action) {
- if (attachment != null) {
- try {
- ITaskDataWorkingCopy taskDataState = TasksUiPlugin
- .getTaskDataManager().getWorkingCopy(
- attachment.getTask());
- TaskDataModel model = new TaskDataModel(
- attachment.getTaskRepository(), attachment.getTask(),
- taskDataState);
-
- performFinish(model, new PatchCreator(attachment.getTaskAttribute()).create());
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- }
-
- }
-
- public void selectionChanged(IAction action, ISelection selection) {
- action.setEnabled(false);
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- if (structuredSelection.size() == 1) {
- attachment = (ITaskAttachment) structuredSelection
- .getFirstElement();
- if (attachment.isPatch()) {
- action.setEnabled(true);
- }
- }
- }
- }
-
-
- public boolean performFinish(TaskDataModel model,ScopeItem scope) {
- String reviewer=model.getTaskRepository().getUserName();
- try {
- Review review = ReviewFactory.eINSTANCE.createReview();
- review.getScope().add(scope);
- TaskRepository taskRepository=model.getTaskRepository();
- ITask newTask = TasksUiUtil.createOutgoingNewTask(taskRepository.getConnectorKind(), taskRepository.getRepositoryUrl());
-
- ReviewsUtil.markAsReview(newTask);
- TaskMapper initializationData=new TaskMapper(model.getTaskData());
- TaskData taskData = TasksUiInternal.createTaskData(taskRepository, initializationData, null,
- new NullProgressMonitor());
- AbstractRepositoryConnector connector=TasksUiPlugin.getConnector(taskRepository.getConnectorKind());
- connector.getTaskDataHandler().initializeSubTaskData(
- taskRepository, taskData, model.getTaskData(),
- new NullProgressMonitor());
-
-
- taskData.getRoot().getMappedAttribute(TaskAttribute.SUMMARY).setValue("Review of " + model.getTask().getSummary());
- taskData.getRoot().getMappedAttribute(TaskAttribute.USER_ASSIGNED).setValue(reviewer);
- taskData.getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION).setValue("Review of " + model.getTask().getSummary() );
-
- ReviewsUiPlugin.getDataManager().storeOutgoingTask(newTask, review);
-
-
- TasksUiInternal.createAndOpenNewTask(newTask, taskData);
- } catch (CoreException e1) {
- throw new RuntimeException(e1);
- }
-
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CreateTask.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CreateTask.java
deleted file mode 100644
index fda72779..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/CreateTask.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import java.io.ByteArrayOutputStream;
-import java.util.TreeSet;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.mylyn.internal.tasks.ui.editors.TaskMigrator;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.reviews.core.ReviewConstants;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskAttributeMapper;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.core.sync.SubmitJob;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-
-/*
- * @author Kilian Matt
- */
-public class CreateTask extends Job {
-
- private TaskDataModel model;
- private Review review;
- private TaskRepository taskRepository;
- private AbstractRepositoryConnector connector;
- private String reviewer;
-
- public CreateTask(TaskDataModel model, Review review, String reviewer) {
- super(Messages.CreateTask_Title);
- this.model = model;
- this.review = review;
-
- this.taskRepository = model.getTaskRepository();
-
- this.connector = TasksUi.getRepositoryConnector(taskRepository
- .getConnectorKind());
- this.reviewer = reviewer;
- }
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- try {
-
- final ITask newLocalTask = TasksUiUtil.createOutgoingNewTask(
- taskRepository.getConnectorKind(),
- taskRepository.getRepositoryUrl());
-
- TaskAttributeMapper mapper = connector.getTaskDataHandler()
- .getAttributeMapper(taskRepository);
-
- final TaskData data = new TaskData(mapper,
- taskRepository.getConnectorKind(),
- taskRepository.getRepositoryUrl(), ""); //$NON-NLS-1$
-
- connector.getTaskDataHandler().initializeSubTaskData(
- taskRepository, data, model.getTaskData(),
- new NullProgressMonitor());
-
- if (reviewer != null && reviewer.isEmpty()) {
- createAttribute(data,TaskAttribute.USER_ASSIGNED,reviewer);
- }
-
- createAttribute(data,TaskAttribute.SUMMARY,
- "Review of " + model.getTask().getTaskKey() + " " + model.getTask().getSummary()); //$NON-NLS-1$ //$NON-NLS-2$
-
- createAttribute(data,TaskAttribute.COMPONENT,
- model.getTaskData()
- .getRoot()
- .getMappedAttribute(TaskAttribute.COMPONENT)
- .getValue());
- createAttribute(data,TaskAttribute.STATUS, "NEW"); //$NON-NLS-1$
- createAttribute(data,TaskAttribute.VERSION,
- model.getTaskData().getRoot()
- .getMappedAttribute(TaskAttribute.VERSION)
- .getValue());
- createAttribute(data,TaskAttribute.PRODUCT,
- model.getTaskData().getRoot()
- .getMappedAttribute(TaskAttribute.PRODUCT)
- .getValue());
-
- final byte[] attachmentBytes = createAttachment(model, review);
-
- final SubmitJob submitJob = TasksUiInternal.getJobFactory()
- .createSubmitTaskJob(connector, taskRepository,
- newLocalTask, data, new TreeSet<TaskAttribute>());
- submitJob.schedule();
- submitJob.join();
-
- if (submitJob.getStatus() == null) {
- ITask newRepoTask = submitJob.getTask();
-
- TaskMigrator migrator = new TaskMigrator(newLocalTask);
- migrator.setDelete(true);
- migrator.execute(newRepoTask);
-
- TaskAttribute attachmentAttribute = data.getAttributeMapper()
- .createTaskAttachment(data);
- try {
- ReviewCommentTaskAttachmentSource attachment = new ReviewCommentTaskAttachmentSource(
- attachmentBytes);
-
- monitor.subTask(Messages.CreateTask_UploadingAttachment);
- connector.getTaskAttachmentHandler().postContent(
- taskRepository, newRepoTask, attachment,
- "review result", //$NON-NLS-1$
- attachmentAttribute, monitor);
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
- return new ReviewStatus(Messages.CreateTask_Success,
- newRepoTask);
- }
- return new Status(IStatus.WARNING, ReviewsUiPlugin.PLUGIN_ID, "");
- } catch (Exception e) {
- return new Status(IStatus.ERROR, ReviewsUiPlugin.PLUGIN_ID,
- e.getMessage());
- }
- }
- private TaskAttribute createAttribute( TaskData taskData, String mappedAttributeName, String value) {
- TaskAttribute attribute = taskData.getRoot().createMappedAttribute(mappedAttributeName);
- attribute.setValue(value);
- return attribute;
- }
-
- private byte[] createAttachment(TaskDataModel model, Review review) {
- try {
- ResourceSet resourceSet = new ResourceSetImpl();
-
- Resource resource = resourceSet.createResource(URI
- .createFileURI("")); //$NON-NLS-1$
-
- resource.getContents().add(review);
- resource.getContents().add(review.getScope().get(0));
- if(review.getResult()!=null)
- resource.getContents().add(review.getResult());
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- ZipOutputStream outputStream = new ZipOutputStream(
- byteArrayOutputStream);
- outputStream.putNextEntry(new ZipEntry(
- ReviewConstants.REVIEW_DATA_FILE));
- resource.save(outputStream, null);
- outputStream.closeEntry();
- outputStream.close();
- return byteArrayOutputStream.toByteArray();
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
-
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/IPatchCreator.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/IPatchCreator.java
deleted file mode 100644
index 390692ed..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/IPatchCreator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import java.util.Date;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-
-/*
- * @author Kilian Matt
- */
-public interface IPatchCreator {
-
- public abstract Patch create() throws CoreException;
-
- public abstract String getFileName();
-
- public abstract String getAuthor();
-
- public abstract Date getCreationDate();
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/Images.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/Images.java
deleted file mode 100644
index f6cae175..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/Images.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christoph Mayerhofer (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import java.net.URL;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Image helper class which contains all application images.
- *
- * @author Christoph Mayerhofer
- */
-public class Images {
-
- protected final static ImageRegistry PLUGIN_REGISTRY = ReviewsUiPlugin
- .getDefault().getImageRegistry();
-
- // icons path
- public final static String ICONS_PATH = "icons/"; //$NON-NLS-1$
-
- public static final ImageDescriptor SMALL_ICON = create(ICONS_PATH,
- "reviews16.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor ICON = create(ICONS_PATH,
- "reviews24.gif"); //$NON-NLS-1$
- public static final ImageDescriptor BIG_ICON = create(ICONS_PATH,
- "reviews32.gif"); //$NON-NLS-1$
-
- public static final ImageDescriptor REVIEW_RESULT_FAILED = create(
- ICONS_PATH, "review_failed.png"); //$NON-NLS-1$
- public static final ImageDescriptor REVIEW_RESULT_WARNING = create(
- ICONS_PATH, "review_warning.png"); //$NON-NLS-1$
- public static final ImageDescriptor REVIEW_RESULT_PASSED = create(
- ICONS_PATH, "review_passed.png"); //$NON-NLS-1$
- public static final ImageDescriptor REVIEW_RESULT_NONE = create(ICONS_PATH,
- "review_none.png"); //$NON-NLS-1$
- public static final ImageDescriptor OVERLAY_ADDITION = create(ICONS_PATH,
- "addition.gif"); //$NON-NLS-1$
- public static final ImageDescriptor OVERLAY_OBSTRUCTED = create(ICONS_PATH,
- "obstructed.gif"); //$NON-NLS-1$
- public static final ImageDescriptor MAXIMIZE = create(ICONS_PATH,
- "maximize.png"); //$NON-NLS-1$
-
- protected static ImageDescriptor create(String prefix, String name) {
- return ImageDescriptor.createFromURL(makeIconURL(prefix, name));
- }
-
- /**
- * Get the image for the specified key from the registry.
- *
- * @param key
- * The key for the image.
- * @return The image, or <code>null</code> if none.
- */
- public static Image get(String key) {
- return PLUGIN_REGISTRY.get(key);
- }
-
- private static URL makeIconURL(String prefix, String name) {
- String path = "$nl$/" + prefix + name; //$NON-NLS-1$
- return FileLocator.find(ReviewsUiPlugin.getDefault().getBundle(),
- new Path(path), null);
- }
-
- /**
- * Puts the image with the specified key to the image registry.
- *
- * @param key
- * The key for the image.
- * @param desc
- * The ImageDescriptor for which the image is created.
- * @return The image which has been added to the registry.
- */
- public static Image manage(String key, ImageDescriptor desc) {
- Image image = desc.createImage();
- PLUGIN_REGISTRY.put(key, image);
- return image;
- }
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/Messages.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/Messages.java
deleted file mode 100644
index 56a075c8..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/Messages.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import org.eclipse.osgi.util.NLS;
-
-/*
- * @author Kilian Matt
- */
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.reviews.ui.messages"; //$NON-NLS-1$
- public static String CreateTask_Success;
- public static String CreateTask_Title;
- public static String CreateTask_UploadingAttachment;
- public static String PatchCreator_ReaderCreationFailed;
- public static String ReviewCommentTaskAttachmentSource_Description;
- public static String ReviewTaskEditorPageFactory_PageTitle;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/PatchCreator.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/PatchCreator.java
deleted file mode 100644
index 5fc79751..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/PatchCreator.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.util.Date;
-import java.util.logging.Logger;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryModel;
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewFactory;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/**
- * @author Kilian Matt
- */
-public class PatchCreator implements IPatchCreator {
-
- private static final Logger log = Logger.getAnonymousLogger();
- private TaskAttribute attribute;
-
- public PatchCreator(TaskAttribute attribute) {
- this.attribute = attribute;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.mylyn.reviews.ui.IPatchCreator#create()
- */
- public Patch create() throws CoreException {
- try {
- ITaskAttachment taskAttachment = getTaskAttachment();
- URL url = new URL(attribute.getMappedAttribute(
- TaskAttribute.ATTACHMENT_URL).getValue());
- Patch patch = ReviewFactory.eINSTANCE.createPatch();
- patch.setAuthor(taskAttachment.getAuthor().getName());
- patch.setCreationDate(taskAttachment.getCreationDate());
- patch.setContents(readContents(url));
- patch.setFileName(taskAttachment.getFileName());
- return patch;
- } catch (Exception e) {
- e.printStackTrace();
- log.warning(e.toString());
- throw new CoreException(new Status(IStatus.ERROR,
- ReviewsUiPlugin.PLUGIN_ID,
- Messages.PatchCreator_ReaderCreationFailed, e));
- }
- }
-
- private ITaskAttachment taskAttachment;
-
- private ITaskAttachment getTaskAttachment() {
- if (taskAttachment == null) {
- // TODO move RepositoryModel.createTaskAttachment to interface?
- taskAttachment = ((RepositoryModel) TasksUi.getRepositoryModel())
- .createTaskAttachment(attribute);
- // new TaskAttachment(repository, task, attribute);
- // attributeMapper.updateTaskAttachment(taskAttachment, attribute);
- }
- return taskAttachment;
- }
-
- private String readContents(URL url) throws IOException {
- InputStream stream = null;
- try {
- stream = url.openStream();
- InputStreamReader reader = new InputStreamReader(stream);
- char[] buffer = new char[256];
- int readChars = 0;
- StringBuilder sb = new StringBuilder();
- while ((readChars = reader.read(buffer)) > 0) {
- sb.append(buffer, 0, readChars);
- }
- return sb.toString();
- } finally {
- if (stream != null)
- try {
- stream.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- }
-
- @Override
- public String toString() {
- return attribute.getMappedAttribute(TaskAttribute.ATTACHMENT_FILENAME)
- .getValue();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.mylyn.reviews.ui.IPatchCreator#getFileName()
- */
- public String getFileName() {
- return getTaskAttachment().getFileName();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.mylyn.reviews.ui.IPatchCreator#getAuthor()
- */
- public String getAuthor() {
- return getTaskAttachment().getAuthor().getName();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.mylyn.reviews.ui.IPatchCreator#getCreationDate()
- */
- public Date getCreationDate() {
- return getTaskAttachment().getCreationDate();
- }
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewCommentTaskAttachmentSource.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewCommentTaskAttachmentSource.java
deleted file mode 100644
index d3fdbe0f..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewCommentTaskAttachmentSource.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.mylyn.reviews.core.ReviewConstants;
-import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
-
-/*
- * @author Kilian Matt
- */
-public class ReviewCommentTaskAttachmentSource extends
- AbstractTaskAttachmentSource {
-
- private byte[] source;
-
- public ReviewCommentTaskAttachmentSource(byte[] source) {
- this.source = source;
- }
-
- @Override
- public InputStream createInputStream(IProgressMonitor monitor)
- throws CoreException {
- return new ByteArrayInputStream(source);
- }
-
- @Override
- public String getContentType() {
- return "application/octet-stream"; //$NON-NLS-1$
- }
-
- @Override
- public String getDescription() {
- return Messages.ReviewCommentTaskAttachmentSource_Description;
- }
-
- @Override
- public long getLength() {
- return source.length;
- }
-
- @Override
- public String getName() {
- return ReviewConstants.REVIEW_DATA_CONTAINER;
- }
-
- @Override
- public boolean isLocal() {
- return true;
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewDiffModel.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewDiffModel.java
deleted file mode 100644
index 7626eeb5..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewDiffModel.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import java.io.CharArrayReader;
-import java.io.Reader;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.patch.IFilePatch2;
-import org.eclipse.compare.patch.IFilePatchResult;
-import org.eclipse.compare.patch.IHunk;
-import org.eclipse.compare.patch.PatchConfiguration;
-import org.eclipse.compare.patch.ReaderCreator;
-import org.eclipse.compare.structuremergeviewer.DiffNode;
-import org.eclipse.compare.structuremergeviewer.Differencer;
-import org.eclipse.compare.structuremergeviewer.ICompareInput;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.mylyn.reviews.core.ITargetPathStrategy;
-import org.eclipse.mylyn.reviews.core.ReviewsUtil;
-
-/**
- * @author Kilian Matt
- */
-public class ReviewDiffModel {
-
- private IFilePatch2 patch;
- private PatchConfiguration configuration;
- private ICompareInput compareInput;
- private IFilePatchResult compareEditorInput = null;
-
- public ReviewDiffModel(IFilePatch2 currentPatch,
- PatchConfiguration configuration) {
- patch = currentPatch;
- this.configuration = configuration;
- }
-
- @Override
- public String toString() {
- return getFileName();
- }
-
- public String getFileName() {
- String string = patch.getTargetPath(configuration).lastSegment();
- return string;
- }
-
- public ICompareInput getCompareInput() {
- if (compareInput == null) {
- IFilePatchResult patchResult = getCompareEditorInput();
- ICompareInput ci = new DiffNode(Differencer.CHANGE, null,
- new CompareItem(patchResult, CompareItem.Kind.ORIGINAL,
- toString()), new CompareItem(patchResult,
- CompareItem.Kind.PATCHED, toString()));
- compareInput = ci;
- }
- return compareInput;
-
- }
-
- public IFilePatchResult getCompareEditorInput() {
- if (compareEditorInput == null) {
- IPath targetPath = patch.getTargetPath(configuration);
-
- for (ITargetPathStrategy strategy : ReviewsUtil
- .getPathFindingStrategies()) {
-
- if (strategy.matches(targetPath)) {
- CompareConfiguration config = new CompareConfiguration();
- config.setRightEditable(false);
- config.setLeftEditable(false);
-
- ReaderCreator rc = strategy.get(targetPath);
- NullProgressMonitor monitor = new NullProgressMonitor();
- IFilePatchResult result = patch.apply(rc, configuration,
- monitor);
-
- return compareEditorInput = result;
- }
- }
- if (patchAddsFile()) {
- ReaderCreator rc = new ReaderCreator() {
-
- @Override
- public Reader createReader() throws CoreException {
- return new CharArrayReader(new char[0]);
- }
- };
- NullProgressMonitor monitor = new NullProgressMonitor();
- compareEditorInput = patch.apply(rc, configuration, monitor);
- }
- }
- return compareEditorInput;
- }
-
- private boolean patchAddsFile() {
- for (IHunk hunk : patch.getHunks()) {
- for (String line : hunk.getUnifiedLines()) {
- if (!line.startsWith("+")) {
- return false;
- }
- }
- }
- return true;
- }
-
- public boolean sourceFileExists() {
- IPath targetPath = patch.getTargetPath(configuration);
-
- for (ITargetPathStrategy strategy : ReviewsUtil
- .getPathFindingStrategies()) {
-
- if (strategy.matches(targetPath)) {
- return true;
- }
- }
- return false;
- }
- public boolean canReview() {
- return sourceFileExists() || patchAddsFile();
- }
-
- public boolean isNewFile() {
- return patchAddsFile();
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewStatus.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewStatus.java
deleted file mode 100644
index e2f5c433..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewStatus.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.mylyn.reviews.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.mylyn.tasks.core.ITask;
-
-public class ReviewStatus extends Status {
- private ITask task;
-
- public ReviewStatus(String message, ITask task) {
- super(IStatus.OK, ReviewsUiPlugin.PLUGIN_ID, message);
- this.task = task;
- }
-
- public ITask getTask() {
- return task;
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewsUiPlugin.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewsUiPlugin.java
deleted file mode 100644
index 64343541..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/ReviewsUiPlugin.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.reviews.core.ReviewDataManager;
-import org.eclipse.mylyn.reviews.core.ReviewDataStore;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- *
- * @author Kilian Matt
- */
-public class ReviewsUiPlugin extends AbstractUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.mylyn.reviews.ui"; //$NON-NLS-1$
-
- // The shared instance
- private static ReviewsUiPlugin plugin;
-
- private static ReviewDataManager reviewDataManager;
-
- /**
- * The constructor
- */
- public ReviewsUiPlugin() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
-
- String DIRECTORY_METADATA = ".metadata"; //$NON-NLS-1$
-
- String NAME_DATA_DIR = ".mylyn"; //$NON-NLS-1$
- String storeDir = ResourcesPlugin.getWorkspace().getRoot()
- .getLocation().toString()
- + '/' + DIRECTORY_METADATA + '/' + NAME_DATA_DIR;
- ReviewDataStore store = new ReviewDataStore(storeDir);
- reviewDataManager = new ReviewDataManager(store,
- TasksUiPlugin.getTaskDataManager(),
- TasksUiPlugin.getRepositoryModel());
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
- * )
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static ReviewsUiPlugin getDefault() {
- return plugin;
- }
-
- public static ReviewDataManager getDataManager() {
- return reviewDataManager;
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/Messages.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/Messages.java
deleted file mode 100644
index 288a7ee0..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/Messages.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import org.eclipse.osgi.util.NLS;
-
-/*
- * @author Kilian Matt
- */
-public class Messages extends NLS {
- private static final String BUNDLE_NAME = "org.eclipse.mylyn.reviews.ui.editors.messages"; //$NON-NLS-1$
- public static String CreateReviewTaskEditorPageFactory_Reviews;
- public static String CreateReviewTaskEditorPart_Patches;
- public static String CreateReviewTaskEditorPart_Create_Review;
- public static String CreateReviewTaskEditorPart_Header_Author;
- public static String CreateReviewTaskEditorPart_Header_Date;
- public static String CreateReviewTaskEditorPart_Header_Filename;
- public static String EditorSupport_Original;
- public static String EditorSupport_Patched;
- public static String NewReviewTaskEditorInput_ReviewPrefix;
- public static String NewReviewTaskEditorInput_Tooltip;
- public static String ReviewEditor_Assigned_to;
- public static String ReviewEditor_Comment;
- public static String ReviewEditor_Create_delegated_Review;
- public static String ReviewEditor_Diff;
- public static String ReviewEditor_Files;
- public static String ReviewEditor_New_Patch_based_Review;
- public static String ReviewEditor_Rating;
- public static String ReviewEditor_Review;
- public static String ReviewEditor_Submit;
- public static String ReviewSummaryTaskEditorPart_Header_Author;
- public static String ReviewSummaryTaskEditorPart_Header_Comment;
- public static String ReviewSummaryTaskEditorPart_Header_Scope;
- public static String ReviewSummaryTaskEditorPart_Header_Result;
- public static String ReviewSummaryTaskEditorPart_Header_Reviewer;
- public static String ReviewSummaryTaskEditorPart_Header_ReviewId;
- public static String ReviewSummaryTaskEditorPart_Partname;
- public static String ReviewTaskEditorInput_New_Review;
- public static String TaskEditorPatchReviewPart_Diff;
- public static String TaskEditorPatchReviewPart_Files;
- public static String TaskEditorPatchReviewPart_Name;
- public static String TaskEditorPatchReviewPart_Patches;
- public static String TaskEditorPatchReviewPart_Rating;
- public static String TaskEditorPatchReviewPart_Review;
- public static String UpdateReviewTask_Title;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/NewReviewTaskEditorInput.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/NewReviewTaskEditorInput.java
deleted file mode 100644
index 9356bf7c..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/NewReviewTaskEditorInput.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewFactory;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-
-/*
- * @author Kilian Matt
- */
-public class NewReviewTaskEditorInput extends ReviewTaskEditorInput {
-
- private TaskDataModel model;
-
- public NewReviewTaskEditorInput(TaskDataModel model, Patch patch) {
- super(ReviewFactory.eINSTANCE.createReview());
- this.model = model;
- getReview().getScope().add(patch);
- }
-
- @Override
- public String getName() {
- return Messages.NewReviewTaskEditorInput_ReviewPrefix + model.getTask().getTaskKey() + " " //$NON-NLS-2$
- + model.getTask().toString();
- }
-
- public TaskDataModel getModel() {
- return model;
- }
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSubmitHandler.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSubmitHandler.java
deleted file mode 100644
index f037b64a..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSubmitHandler.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui.editors;
-
-/*
- * @author Kilian Matt
- */
-public interface ReviewSubmitHandler {
-
- void doSubmit(ReviewTaskEditorInput editorInput);
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSummaryPartConfigurer.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSummaryPartConfigurer.java
deleted file mode 100644
index bd1127c1..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSummaryPartConfigurer.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.mylyn.internal.tasks.core.RepositoryModel;
-import org.eclipse.mylyn.tasks.core.IRepositoryModel;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskAttachment;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.mylyn.tasks.ui.editors.ITaskEditorPartDescriptorAdvisor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor;
-
-public class ReviewSummaryPartConfigurer implements
- ITaskEditorPartDescriptorAdvisor {
-
- public boolean canCustomize(ITask task) {
- try {
-
- // TODO change to detecting review sub tasks!
-
- TaskData taskData = TasksUi.getTaskDataManager().getTaskData(task);
- IRepositoryModel repositoryModel = TasksUi.getRepositoryModel();
- if (taskData != null) {
- List<TaskAttribute> attributesByType = taskData
- .getAttributeMapper().getAttributesByType(taskData,
- TaskAttribute.TYPE_ATTACHMENT);
- for (TaskAttribute attribute : attributesByType) {
- // TODO move RepositoryModel.createTaskAttachment to
- // interface?
- ITaskAttachment taskAttachment = ((RepositoryModel) repositoryModel)
- .createTaskAttachment(attribute);
- if (taskAttachment.isPatch())
- return true;
-
- }
- }
- } catch (Exception e) {
- throw new RuntimeException(e);
- }
- return false;
- }
-
- public Set<String> getBlockingIds(ITask task) {
- return Collections.emptySet();
- }
-
- public Set<String> getBlockingPaths(ITask task) {
- return Collections.emptySet();
- }
-
- public Set<TaskEditorPartDescriptor> getPartContributions(ITask task) {
- Set<TaskEditorPartDescriptor> descriptors = new HashSet<TaskEditorPartDescriptor>();
- descriptors.add(new TaskEditorPartDescriptor(
- ReviewSummaryTaskEditorPart.ID_PART_REVIEWSUMMARY) {
-
- @Override
- public AbstractTaskEditorPart createPart() {
- return new ReviewSummaryTaskEditorPart();
- }
- });
- return descriptors;
- }
-
- public void afterSubmit(ITask task) {
- }
-
- public void prepareSubmit(ITask task) {
- }
-
- public void taskMigration(ITask oldTask, ITask newTask) {
- }
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSummaryTaskEditorPart.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSummaryTaskEditorPart.java
deleted file mode 100644
index 48900dd4..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewSummaryTaskEditorPart.java
+++ /dev/null
@@ -1,220 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylyn.reviews.core.ReviewSubTask;
-import org.eclipse.mylyn.reviews.core.ReviewsUtil;
-import org.eclipse.mylyn.reviews.core.model.review.Rating;
-import org.eclipse.mylyn.reviews.ui.Images;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskContainer;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.forms.widgets.ExpandableComposite;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/*
- * @author Kilian Matt
- */
-public class ReviewSummaryTaskEditorPart extends AbstractTaskEditorPart {
-
- public static final String ID_PART_REVIEWSUMMARY = "org.eclipse.mylyn.reviews.ui.editors.parts.reviewsummary"; //$NON-NLS-1$
- private Section summarySection;
-
- public ReviewSummaryTaskEditorPart() {
- setPartName(Messages.ReviewSummaryTaskEditorPart_Partname);
- }
-
- @Override
- public void createControl(final Composite parent, FormToolkit toolkit) {
- summarySection = createSection(parent, toolkit,
- ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE
- | ExpandableComposite.EXPANDED);
- summarySection.setLayout(new FillLayout(SWT.HORIZONTAL));
- summarySection.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true,
- true));
- // summarySection.setText(Messages.ReviewSummaryTaskEditorPart_Partname);
- Composite reviewResultsComposite = toolkit
- .createComposite(summarySection);
- toolkit.paintBordersFor(reviewResultsComposite);
- reviewResultsComposite.setLayout(new GridLayout(1, false));
-
- TableViewer reviewResults = createResultsTableViewer(
- reviewResultsComposite, toolkit);
- reviewResults.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
-
- summarySection.setClient(reviewResultsComposite);
- }
-
- private TableViewerColumn createColumn(TableViewer parent,
- String columnTitle) {
- TableViewerColumn column = new TableViewerColumn(parent, SWT.LEFT);
- column.getColumn().setText(columnTitle);
- column.getColumn().setWidth(100);
- column.getColumn().setResizable(true);
- return column;
- }
-
- private TableViewer createResultsTableViewer(
- Composite reviewResultsComposite, FormToolkit toolkit) {
- Table table = toolkit.createTable(reviewResultsComposite, SWT.SINGLE
- | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- table.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
-
- TableViewer reviewResults = new TableViewer(table);
- createColumn(reviewResults,
- Messages.ReviewSummaryTaskEditorPart_Header_ReviewId);
- createColumn(reviewResults,
- Messages.ReviewSummaryTaskEditorPart_Header_Scope);
- createColumn(reviewResults,
- Messages.ReviewSummaryTaskEditorPart_Header_Author);
- createColumn(reviewResults,
- Messages.ReviewSummaryTaskEditorPart_Header_Reviewer);
- createColumn(reviewResults,
- Messages.ReviewSummaryTaskEditorPart_Header_Result);
-
- createColumn(reviewResults,
- Messages.ReviewSummaryTaskEditorPart_Header_Comment);
-
- reviewResults.setContentProvider(new IStructuredContentProvider() {
-
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof ITaskContainer) {
- ITaskContainer taskContainer = (ITaskContainer) inputElement;
- List<ReviewSubTask> reviewSubTasks = ReviewsUtil
- .getReviewSubTasksFor(taskContainer,
- TasksUi.getTaskDataManager(),
- TasksUi.getRepositoryModel(),
- new NullProgressMonitor());
- int passedCount = 0;
- int warningCount = 0;
- int failedCount = 0;
- int noResultCount = 0;
- for (ReviewSubTask subtask : reviewSubTasks) {
- switch (subtask.getResult()) {
- case PASSED:
- passedCount++;
- break;
- case WARNING:
- warningCount++;
- break;
- case FAILED:
- failedCount++;
- break;
- case NONE:
- noResultCount++;
- break;
-
- }
- }
-
- summarySection.setText(String
- .format("Review Summary (PASSED: %s / WARNING: %s / FAILED: %s / ?: %s)",
- passedCount, warningCount, failedCount,
- noResultCount));
- return reviewSubTasks
- .toArray(new ReviewSubTask[reviewSubTasks.size()]);
- }
- return null;
- }
- });
-
- reviewResults.setLabelProvider(new TableLabelProvider() {
- private static final int COLUMN_ID = 0;
- private static final int COLUMN_PATCHFILE = 1;
- private static final int COLUMN_AUTHOR = 2;
- private static final int COLUMN_REVIEWER = 3;
- private static final int COLUMN_RESULT = 4;
- private static final int COLUMN_COMMENT = 5;
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == COLUMN_RESULT) {
- ReviewSubTask subtask = (ReviewSubTask) element;
- switch (subtask.getResult()) {
- case FAILED:
- return Images.REVIEW_RESULT_FAILED.createImage();
- case WARNING:
- return Images.REVIEW_RESULT_WARNING.createImage();
- case PASSED:
- return Images.REVIEW_RESULT_PASSED.createImage();
- case NONE:
- return Images.REVIEW_RESULT_NONE.createImage();
-
- }
- }
- return null;
- }
-
- public String getColumnText(Object element, int columnIndex) {
-
- ReviewSubTask subtask = (ReviewSubTask) element;
- switch (columnIndex) {
- case COLUMN_ID:
- return subtask.getTask().getTaskId();
- case COLUMN_PATCHFILE:
- return subtask.getPatchDescription();
- case COLUMN_AUTHOR:
- return subtask.getAuthor();
- case COLUMN_REVIEWER:
- return subtask.getReviewer();
- case COLUMN_RESULT:
- return subtask.getResult().getName();
- case COLUMN_COMMENT:
- return subtask.getComment();
- default:
- return null;
- }
- }
-
- });
- reviewResults.setInput(getModel().getTask());
- reviewResults.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- if (!event.getSelection().isEmpty()) {
- ITask task = ((ReviewSubTask) ((IStructuredSelection) event
- .getSelection()).getFirstElement()).getTask();
- TasksUiUtil.openTask(task);
- }
- }
- });
- return reviewResults;
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorInput.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorInput.java
deleted file mode 100644
index c9020428..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorInput.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.compare.patch.IFilePatch2;
-import org.eclipse.compare.patch.PatchConfiguration;
-import org.eclipse.compare.patch.PatchParser;
-import org.eclipse.compare.patch.ReaderCreator;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.ui.Images;
-import org.eclipse.mylyn.reviews.ui.ReviewDiffModel;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/*
- * @author Kilian Matt
- */
-public class ReviewTaskEditorInput implements IEditorInput {
-
- private Review review;
-
- public ReviewTaskEditorInput(Review review) {
- this.review = review;
- }
-
- public Review getReview() {
- return review;
- }
-
- public boolean exists() {
- return false;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return Images.SMALL_ICON;
- }
-
- public String getName() {
- // TODO
- return Messages.ReviewTaskEditorInput_New_Review;//"Review of" + model.getTask().getTaskKey() + " " +
- // model.getTask().toString();
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getToolTipText() {
- return Messages.NewReviewTaskEditorInput_Tooltip;
- }
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- return null;
- }
-
- public List<ReviewDiffModel> getScope() {
- try {
-
- IFilePatch2[] patches = PatchParser.parsePatch(new ReaderCreator() {
-
- @Override
- public Reader createReader() throws CoreException {
- return new InputStreamReader(new ByteArrayInputStream(
- ((Patch) review.getScope().get(0)).getContents()
- .getBytes()));
- }
- });
- List<ReviewDiffModel> model = new ArrayList<ReviewDiffModel>();
- for (int i = 0; i < patches.length; i++) {
- final PatchConfiguration configuration = new PatchConfiguration();
-
- final IFilePatch2 currentPatch = patches[i];
- model.add(new ReviewDiffModel(currentPatch, configuration));
- }
- return model;
- } catch (Exception ex) {
- ex.printStackTrace();
- throw new RuntimeException(ex);
- }
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorPart.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorPart.java
deleted file mode 100644
index d0279cfa..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorPart.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.eclipse.compare.CompareConfiguration;
-import org.eclipse.compare.CompareEditorInput;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.patch.IFilePatch2;
-import org.eclipse.compare.patch.PatchConfiguration;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.viewers.ArrayContentProvider;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylyn.reviews.core.ReviewData;
-import org.eclipse.mylyn.reviews.core.ReviewsUtil;
-import org.eclipse.mylyn.reviews.core.model.review.Patch;
-import org.eclipse.mylyn.reviews.core.model.review.Rating;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.core.model.review.ReviewFactory;
-import org.eclipse.mylyn.reviews.ui.Images;
-import org.eclipse.mylyn.reviews.ui.ReviewDiffModel;
-import org.eclipse.mylyn.reviews.ui.ReviewsUiPlugin;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.forms.IFormColors;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.Section;
-
-/*
- * @author Kilian Matt
- */
-public class ReviewTaskEditorPart extends AbstractTaskEditorPart {
- public static final String ID_PART_REVIEW = "org.eclipse.mylyn.reviews.ui.editors.ReviewTaskEditorPart"; //$NON-NLS-1$
- private TableViewer fileList;
- private Composite composite;
-
- public ReviewTaskEditorPart() {
- setPartName("Review ");
- setExpandVertically(true);
- }
-
- @Override
- public void createControl(Composite parent, FormToolkit toolkit) {
- Section section = createSection(parent, toolkit, true);
- GridLayout gl = new GridLayout(1, false);
- gl.marginBottom = 16;
- GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
- gd.horizontalSpan = 4;
- section.setLayout(gl);
- section.setLayoutData(gd);
-
- composite = toolkit.createComposite(section);
-
- composite.setLayout(new GridLayout(1, true));
-
- fileList = new TableViewer(composite);
-
- fileList.getControl().setLayoutData(
- new GridData(SWT.FILL, SWT.FILL, true, true));
-
- TableViewerColumn column = new TableViewerColumn(fileList, SWT.LEFT);
- column.getColumn().setText("Filename");
- column.getColumn().setWidth(100);
- column.getColumn().setResizable(true);
-
- TableLayout tableLayout = new TableLayout();
- tableLayout.addColumnData(new ColumnWeightData(100, true));
- fileList.getTable().setLayout(tableLayout);
-
- fileList.setLabelProvider(new TableLabelProvider() {
- private final int COLUMN_FILE = 0;
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- if (columnIndex == COLUMN_FILE) {
- if (element instanceof ReviewDiffModel) {
- ReviewDiffModel diffModel = ((ReviewDiffModel) element);
-
- return diffModel.getFileName();
- }
- }
- return null;
- }
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == COLUMN_FILE) {
- ISharedImages sharedImages = PlatformUI.getWorkbench()
- .getSharedImages();
- if (element instanceof ReviewDiffModel) {
- ReviewDiffModel diffModel = ((ReviewDiffModel) element);
- if (diffModel.isNewFile()) {
- return new NewFile().createImage();
- }
- if (!diffModel.canReview()) {
- return new MissingFile().createImage();
- }
- }
-
- return sharedImages.getImage(ISharedImages.IMG_OBJ_FILE);
- }
- return null;
- }
- });
-
- fileList.setContentProvider(new IStructuredContentProvider() {
-
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object inputElement) {
- // parse the patch and create our model for the table
- Patch patch = (Patch) inputElement;
- List<IFilePatch2> patches = patch.parse();
- ReviewDiffModel[] model = new ReviewDiffModel[patches.size()];
- int index = 0;
- for (IFilePatch2 currentPatch : patches) {
- final PatchConfiguration configuration = new PatchConfiguration();
- currentPatch.getTargetPath(configuration);
- model[index++] = new ReviewDiffModel(currentPatch,
- configuration);
-
- }
- return model;
- }
- });
- fileList.addDoubleClickListener(new IDoubleClickListener() {
-
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection) selection;
- if (sel.getFirstElement() instanceof ReviewDiffModel) {
- final ReviewDiffModel diffModel = ((ReviewDiffModel) sel
- .getFirstElement());
- if (diffModel.canReview()) {
- CompareConfiguration configuration = new CompareConfiguration();
- configuration.setLeftEditable(false);
- configuration.setRightEditable(false);
- configuration
- .setLeftLabel(Messages.EditorSupport_Original);
- configuration
- .setRightLabel(Messages.EditorSupport_Patched);
- configuration.setProperty(
- CompareConfiguration.IGNORE_WHITESPACE,
- false);
- configuration
- .setProperty(
- CompareConfiguration.USE_OUTLINE_VIEW,
- true);
- CompareUI.openCompareEditor(new CompareEditorInput(
- configuration) {
-
- @Override
- protected Object prepareInput(
- IProgressMonitor monitor)
- throws InvocationTargetException,
- InterruptedException {
- return diffModel.getCompareInput();
- }
- }, true);
- }
- }
- }
- }
- });
- setInput();
-
- createResultFields(composite, toolkit);
-
- section.setClient(composite);
-
- // Depends on 288171
- // getSashComposite().setData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION,
- // getMaximizePartAction());
- // if (getSashComposite() instanceof Composite) {
- // for (Control control : ((Composite)
- // getSashComposite()).getChildren()) {
- // control.setData(EditorUtil.KEY_TOGGLE_TO_MAXIMIZE_ACTION,
- // getMaximizePartAction());
- // }
- // }
-
- setSection(toolkit, section);
-
- }
-
- private void createResultFields(Composite composite, FormToolkit toolkit) {
-
- final Review review;
- final ReviewData rd = ReviewsUiPlugin.getDataManager().getReviewData(
- getModel().getTask());
- if (rd != null) {
- review = rd.getReview();
- } else {
- review = parseFromAttachments();
- if (review != null) {
- ReviewsUiPlugin.getDataManager().storeTask(
- getModel().getTask(), review);
- }
- }
-
- Composite resultComposite = toolkit.createComposite(composite);
- toolkit.paintBordersFor(resultComposite);
- resultComposite.setLayoutData(new GridData(SWT.FILL, SWT.DEFAULT, true,
- false));
- resultComposite.setLayout(new GridLayout(2, false));
-
- toolkit.createLabel(resultComposite, "Rating:").setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
- CCombo ratingsCombo = new CCombo(resultComposite, SWT.READ_ONLY
- | SWT.FLAT);
- ratingsCombo.setData(FormToolkit.KEY_DRAW_BORDER,
- FormToolkit.TREE_BORDER);
- toolkit.adapt(ratingsCombo, false, false);
-
- final ComboViewer ratingList = new ComboViewer(ratingsCombo);
-
- ratingList.setContentProvider(ArrayContentProvider.getInstance());
- ratingList.setLabelProvider(new LabelProvider() {
- @Override
- public String getText(Object element) {
- // TODO externalize string
- return ((Rating) element).getName();
- }
-
- @Override
- public Image getImage(Object element) {
- Rating rating = ((Rating) element);
- switch (rating) {
- case FAILED:
- return Images.REVIEW_RESULT_FAILED.createImage();
- case NONE:
- return Images.REVIEW_RESULT_NONE.createImage();
- case PASSED:
- return Images.REVIEW_RESULT_PASSED.createImage();
- case WARNING:
- return Images.REVIEW_RESULT_WARNING.createImage();
- }
- return super.getImage(element);
- }
- });
- ratingList.setInput(Rating.VALUES);
- ratingList.getControl().setLayoutData(
- new GridData(SWT.LEFT, SWT.TOP, false, false));
-
- toolkit.createLabel(resultComposite, "Rating comment:").setForeground(
- toolkit.getColors().getColor(IFormColors.TITLE));
- final Text commentText = toolkit.createText(resultComposite, "", SWT.MULTI);
-
- GridData gd = new GridData(SWT.FILL, SWT.DEFAULT, true, false);
- gd.heightHint = 100;
- commentText.setLayoutData(gd);
-
- if (review.getResult() != null) {
- Rating rating = review.getResult().getRating();
- ratingList.setSelection(new StructuredSelection(rating));
- String comment = review.getResult().getText();
- commentText.setText(comment != null ? comment : "");
- }
- commentText.addModifyListener(new ModifyListener() {
-
- public void modifyText(ModifyEvent e) {
- if (review.getResult() == null) {
- review.setResult(ReviewFactory.eINSTANCE
- .createReviewResult());
- }
- review.getResult().setText(commentText.getText());
- rd.setDirty();
- }
- });
- ratingList.addSelectionChangedListener(new ISelectionChangedListener() {
-
- public void selectionChanged(SelectionChangedEvent event) {
- Rating rating = (Rating) ((IStructuredSelection) event
- .getSelection()).getFirstElement();
- if (review.getResult() == null) {
- review.setResult(ReviewFactory.eINSTANCE
- .createReviewResult());
- }
- review.getResult().setRating(rating);
- rd.setDirty();
- }
- });
-
- }
-
- private Review parseFromAttachments() {
- try {
- final TaskDataModel model = getModel();
- List<Review> reviews = ReviewsUtil.getReviewAttachmentFromTask(
- TasksUi.getTaskDataManager(), TasksUi.getRepositoryModel(),
- model.getTask());
-
- if (reviews.size() > 0) {
- return reviews.get(0);
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- return null;
- }
-
- /**
- * Retrieves the review from the review data manager and fills the left
- * table with the files.
- */
- private void setInput() {
- ReviewData rd = ReviewsUiPlugin.getDataManager().getReviewData(
- getModel().getTask());
- if (rd != null) {
- fileList.setInput((rd.getReview().getScope().get(0)));
- }
- }
-
- private static class MissingFile extends CompositeImageDescriptor {
- ISharedImages sharedImages = PlatformUI.getWorkbench()
- .getSharedImages();
-
- @Override
- protected void drawCompositeImage(int width, int height) {
- drawImage(getBaseImageData(), 0, 0);
- drawImage(Images.OVERLAY_OBSTRUCTED.getImageData(), 7, 3);
- }
-
- @Override
- protected Point getSize() {
- ImageData img = getBaseImageData();
- return new Point(img.width, img.height);
- }
-
- private ImageData baseImage;
-
- private ImageData getBaseImageData() {
- if (baseImage == null) {
- baseImage = sharedImages.getImageDescriptor(
- ISharedImages.IMG_OBJ_FILE).getImageData();
- }
- return baseImage;
- }
-
- }
-
- private static class NewFile extends CompositeImageDescriptor {
- ISharedImages sharedImages = PlatformUI.getWorkbench()
- .getSharedImages();
-
- @Override
- protected void drawCompositeImage(int width, int height) {
- drawImage(getBaseImageData(), 0, 0);
- drawImage(Images.OVERLAY_ADDITION.getImageData(), 7, 5);
- }
-
- @Override
- protected Point getSize() {
-
- ImageData img = getBaseImageData();
- return new Point(img.width, img.height);
- }
-
- private ImageData baseImage;
-
- private ImageData getBaseImageData() {
- if (baseImage == null) {
- baseImage = sharedImages.getImageDescriptor(
- ISharedImages.IMG_OBJ_FILE).getImageData();
- }
- return baseImage;
- }
-
- }
-
- @Override
- protected void fillToolBar(ToolBarManager manager) {
- // Depends on 288171
- // manager.add(getMaximizePartAction());
- super.fillToolBar(manager);
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorPartAdvisor.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorPartAdvisor.java
deleted file mode 100644
index 2e4b4ddb..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/ReviewTaskEditorPartAdvisor.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import java.io.ByteArrayOutputStream;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
-import org.eclipse.mylyn.reviews.core.ReviewConstants;
-import org.eclipse.mylyn.reviews.core.ReviewData;
-import org.eclipse.mylyn.reviews.core.ReviewDataManager;
-import org.eclipse.mylyn.reviews.core.ReviewsUtil;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.ui.ReviewCommentTaskAttachmentSource;
-import org.eclipse.mylyn.reviews.ui.ReviewsUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.IRepositoryModel;
-import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskData;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPage;
-import org.eclipse.mylyn.tasks.ui.editors.AbstractTaskEditorPart;
-import org.eclipse.mylyn.tasks.ui.editors.ITaskEditorPartDescriptorAdvisor;
-import org.eclipse.mylyn.tasks.ui.editors.TaskEditorPartDescriptor;
-
-public class ReviewTaskEditorPartAdvisor implements
- ITaskEditorPartDescriptorAdvisor {
-
- public boolean canCustomize(ITask task) {
- if (!ReviewsUtil.hasReviewMarker(task)) {
- try {
- IRepositoryModel repositoryModel = TasksUi.getRepositoryModel();
- TaskData taskData = TasksUiPlugin.getTaskDataManager()
- .getTaskData(task);
- if (ReviewsUtil.getReviewAttachments(repositoryModel, taskData)
- .size() > 0) {
- ReviewsUtil.markAsReview(task);
- }
- } catch (CoreException e) {
- // FIXME
- e.printStackTrace();
- }
- }
-
- boolean isReview = ReviewsUtil.isMarkedAsReview(task);
- return isReview;
- }
-
- public Set<String> getBlockingIds(ITask task) {
- return Collections.emptySet();
- }
-
- public Set<String> getBlockingPaths(ITask task) {
- Set<String> blockedPaths = new HashSet<String>();
- blockedPaths.add(AbstractTaskEditorPage.PATH_ATTRIBUTES);
- blockedPaths.add(AbstractTaskEditorPage.PATH_ATTACHMENTS);
- blockedPaths.add(AbstractTaskEditorPage.PATH_PLANNING);
-
- return blockedPaths;
- }
-
- public Set<TaskEditorPartDescriptor> getPartContributions(ITask task) {
- Set<TaskEditorPartDescriptor> parts = new HashSet<TaskEditorPartDescriptor>();
- parts.add(new TaskEditorPartDescriptor(
- ReviewTaskEditorPart.ID_PART_REVIEW) {
-
- @Override
- public AbstractTaskEditorPart createPart() {
- return new ReviewTaskEditorPart();
- }
- }.setPath(AbstractTaskEditorPage.PATH_ATTRIBUTES));
- return parts;
- }
-
- public void taskMigration(ITask oldTask, ITask newTask) {
- ReviewDataManager dataManager = ReviewsUiPlugin.getDataManager();
- Review review = dataManager.getReviewData(oldTask).getReview();
- dataManager.storeOutgoingTask(newTask, review);
- ReviewsUtil.markAsReview(newTask);
- }
-
- public void afterSubmit(ITask task) {
- try {
- ReviewData reviewData = ReviewsUiPlugin.getDataManager()
- .getReviewData(task);
- Review review = reviewData.getReview();
-
- if (reviewData.isOutgoing() || reviewData.isDirty()) {
- reviewData.setDirty(false);
- TaskRepository taskRepository = TasksUiPlugin
- .getRepositoryManager().getRepository(
- task.getRepositoryUrl());
- TaskData taskData = TasksUiPlugin.getTaskDataManager()
- .getTaskData(task);
- // todo get which attachments have to be submitted
- TaskAttribute attachmentAttribute = taskData
- .getAttributeMapper().createTaskAttachment(taskData);
- byte[] attachmentBytes = createAttachment(review);
-
- ReviewCommentTaskAttachmentSource attachment = new ReviewCommentTaskAttachmentSource(
- attachmentBytes);
-
- AbstractRepositoryConnector connector = TasksUi
- .getRepositoryConnector(taskRepository
- .getConnectorKind());
- connector.getTaskAttachmentHandler().postContent(
- taskRepository, task, attachment, "review result", //$NON-NLS-1$
- attachmentAttribute, new NullProgressMonitor());
-
- TasksUiInternal.closeTaskEditorInAllPages(task, false);
- TasksUiInternal.synchronizeTask(connector, task, false, null);
- TasksUiInternal.openTaskInBackground(task, true);
- }
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
-
- public void prepareSubmit(ITask task) {
- }
-
- private byte[] createAttachment(Review review) {
- try {
- ResourceSet resourceSet = new ResourceSetImpl();
-
- Resource resource = resourceSet.createResource(URI
- .createFileURI("")); //$NON-NLS-1$
-
- resource.getContents().add(review);
- resource.getContents().add(review.getScope().get(0));
- if (review.getResult() != null)
- resource.getContents().add(review.getResult());
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- ZipOutputStream outputStream = new ZipOutputStream(
- byteArrayOutputStream);
- outputStream.putNextEntry(new ZipEntry(
- ReviewConstants.REVIEW_DATA_FILE));
- resource.save(outputStream, null);
- outputStream.closeEntry();
- outputStream.close();
- return byteArrayOutputStream.toByteArray();
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
-
- }
-
-}
\ No newline at end of file
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/TableLabelProvider.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/TableLabelProvider.java
deleted file mode 100644
index 22d00865..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/TableLabelProvider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Christoph Mayerhofer (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * @author Christoph Mayerhofer
- */
-public abstract class TableLabelProvider extends LabelProvider implements
- ITableLabelProvider {
-
- public abstract Image getColumnImage(Object element, int columnIndex);
-
- public abstract String getColumnText(Object element, int columnIndex);
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/UpdateReviewTask.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/UpdateReviewTask.java
deleted file mode 100644
index f51af485..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/UpdateReviewTask.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
- *******************************************************************************/
-package org.eclipse.mylyn.reviews.ui.editors;
-
-import java.io.ByteArrayOutputStream;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-import org.eclipse.mylyn.reviews.core.ReviewConstants;
-import org.eclipse.mylyn.reviews.core.model.review.Review;
-import org.eclipse.mylyn.reviews.ui.editors.Messages;
-import org.eclipse.mylyn.reviews.ui.ReviewCommentTaskAttachmentSource;
-import org.eclipse.mylyn.reviews.ui.ReviewsUiPlugin;
-import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
-import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
-import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
-
-/*
- * @author Kilian Matt
- */
-public class UpdateReviewTask extends Job {
-
-
-
- private TaskDataModel model;
- private Review review;
- private TaskRepository taskRepository;
- private AbstractRepositoryConnector connector;
-
- public UpdateReviewTask(TaskDataModel model, Review review) {
- super(Messages.UpdateReviewTask_Title);
- this.model = model;
- this.review = review;
-
- this.taskRepository = model.getTaskRepository();
-
- this.connector = TasksUi.getRepositoryConnector(taskRepository
- .getConnectorKind());
- }
-
- @Override
- protected IStatus run(final IProgressMonitor monitor) {
- try {
-
-
- final byte[] attachmentBytes = createAttachment(model, review);
-
- TaskAttribute attachmentAttribute = model.getTaskData().getAttributeMapper()
- .createTaskAttachment( model.getTaskData());
- try {
- ReviewCommentTaskAttachmentSource attachment = new ReviewCommentTaskAttachmentSource(
- attachmentBytes);
-
- monitor.subTask(org.eclipse.mylyn.reviews.ui.Messages.CreateTask_UploadingAttachment);
- connector.getTaskAttachmentHandler().postContent(
- taskRepository, model.getTask(), attachment,
- "review result", //$NON-NLS-1$
- attachmentAttribute, monitor);
- } catch (CoreException e) {
- e.printStackTrace();
- }
-
-
- return new Status(IStatus.OK, ReviewsUiPlugin.PLUGIN_ID,
- org.eclipse.mylyn.reviews.ui.Messages.CreateTask_Success);
- } catch (Exception e) {
- return new Status(IStatus.ERROR, ReviewsUiPlugin.PLUGIN_ID, e
- .getMessage());
- }
- }
-
- private byte[] createAttachment(TaskDataModel model, Review review) {
- try {
- ResourceSet resourceSet = new ResourceSetImpl();
-
- Resource resource = resourceSet.createResource(URI
- .createFileURI("")); //$NON-NLS-1$
-
- resource.getContents().add(review);
- resource.getContents().add(review.getScope().get(0));
- resource.getContents().add(review.getResult());
- ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
- ZipOutputStream outputStream = new ZipOutputStream(
- byteArrayOutputStream);
- outputStream.putNextEntry(new ZipEntry(
- ReviewConstants.REVIEW_DATA_FILE));
- resource.save(outputStream, null);
- outputStream.closeEntry();
- outputStream.close();
- return byteArrayOutputStream.toByteArray();
- } catch (Exception e) {
- e.printStackTrace();
- throw new RuntimeException(e);
- }
-
- }
-
-}
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/messages.properties b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/messages.properties
deleted file mode 100644
index 7eb450b0..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/editors/messages.properties
+++ /dev/null
@@ -1,44 +0,0 @@
-###############################################################################
-# Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - initial API and implementation
-###############################################################################
-CreateReviewTaskEditorPageFactory_Reviews=Reviews
-CreateReviewTaskEditorPart_Patches=Patches
-CreateReviewTaskEditorPart_Create_Review=Create review
-CreateReviewTaskEditorPart_Header_Author=Author
-CreateReviewTaskEditorPart_Header_Date=Date
-CreateReviewTaskEditorPart_Header_Filename=Filename
-EditorSupport_Original=Original
-EditorSupport_Patched=Patched
-NewReviewTaskEditorInput_ReviewPrefix=Review of
-NewReviewTaskEditorInput_Tooltip=Review input
-ReviewEditor_Assigned_to=Assigned to
-ReviewEditor_Comment=Comment
-ReviewEditor_Create_delegated_Review=Create delegated review
-ReviewEditor_Diff=Differences
-ReviewEditor_Files=Files
-ReviewEditor_New_Patch_based_Review=New patch-based Review
-ReviewEditor_Rating=Rating
-ReviewEditor_Review=Review
-ReviewEditor_Submit=Submit
-ReviewSummaryTaskEditorPart_Header_Author=Author
-ReviewSummaryTaskEditorPart_Header_Comment=Rating Comment
-ReviewSummaryTaskEditorPart_Header_Scope=Scope
-ReviewSummaryTaskEditorPart_Header_Result=Rating
-ReviewSummaryTaskEditorPart_Header_Reviewer=Reviewer
-ReviewSummaryTaskEditorPart_Header_ReviewId=Review Task
-ReviewSummaryTaskEditorPart_Partname=Review Summary
-ReviewTaskEditorInput_New_Review=New Review
-TaskEditorPatchReviewPart_Diff=Differences
-TaskEditorPatchReviewPart_Files=Files
-TaskEditorPatchReviewPart_Name=Reviews
-TaskEditorPatchReviewPart_Patches=Patches
-TaskEditorPatchReviewPart_Rating=Rating
-TaskEditorPatchReviewPart_Review=Review
-UpdateReviewTask_Title=Updating review task
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/messages.properties b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/messages.properties
deleted file mode 100644
index 022d1d92..00000000
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/reviews/ui/messages.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-CreateTask_Success=Successfully created task
-CreateTask_Title=Creating new Mylyn Reviews task
-CreateTask_UploadingAttachment=Uploading attachment
-PatchCreator_ReaderCreationFailed=ReviewPatchFile.createReader failed
-ReviewCommentTaskAttachmentSource_Description=Mylyn Review Result
-ReviewTaskEditorPageFactory_PageTitle=Reviews
diff --git a/org.eclipse.mylyn.reviews/.project b/org.eclipse.mylyn.reviews/.project
deleted file mode 100644
index 005dafcc..00000000
--- a/org.eclipse.mylyn.reviews/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.mylyn.reviews</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/org.eclipse.mylyn.reviews/build.properties b/org.eclipse.mylyn.reviews/build.properties
deleted file mode 100644
index 64f93a9f..00000000
--- a/org.eclipse.mylyn.reviews/build.properties
+++ /dev/null
@@ -1 +0,0 @@
-bin.includes = feature.xml
diff --git a/org.eclipse.mylyn.reviews/feature.xml b/org.eclipse.mylyn.reviews/feature.xml
deleted file mode 100644
index 1bcecf9a..00000000
--- a/org.eclipse.mylyn.reviews/feature.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.mylyn.reviews"
- label="Mylyn Reviews (Incubation)"
- version="0.0.1"
- provider-name="Mylyn Reviews Team">
-
- <description url="http://www.eclipse.org/reviews">
- Provides Review functionality for Mylyn
- </description>
-
- <copyright>
- Copyright (c) 2010 Research Group for Industrial Software (INSO), Vienna University of Technology and others. All rights reserved.
- </copyright>
-
- <license url="http://www.eclipse.org/legal/epl/notice.php">
- Eclipse Foundation Software User Agreement
-
-April 14, 2010
-Usage Of Content
-
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.
-Applicable Licenses
-
-Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" will mean the Content.
-
-Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").
-
- * Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
- * Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
- * A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins and/or Fragments associated with that Feature.
- * Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
-
-The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module including, but not limited to the following locations:
-
- * The top-level (root) directory
- * Plug-in and Fragment directories
- * Inside Plug-ins and Fragments packaged as JARs
- * Sub-directories of the directory named "src" of certain Plug-ins
- * Feature directories
-
-Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in that directory.
-
-THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):
-
- * Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)
- * Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)
- * Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)
- * Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)
- * Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)
-
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.
-Use of Provisioning Technology
-
-The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").
-
-You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:
-
- 1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based product.
- 2. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be accessed and copied to the Target Machine.
- 3. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
-
-Cryptography
-
-Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted.
-
-Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.
- </license>
-
- <plugin
- id="org.eclipse.mylyn.reviews.core"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
- <plugin
- id="org.eclipse.mylyn.reviews.ui"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="false"/>
-
-</feature>
|
ce7f1b2f0c49c2c536f16595888caaf893108ee0
|
Delta Spike
|
add small helper script to quickly verify most important scenarios
|
p
|
https://github.com/apache/deltaspike
|
diff --git a/deltaspike/buildall.sh b/deltaspike/buildall.sh
new file mode 100755
index 000000000..840fefbfa
--- /dev/null
+++ b/deltaspike/buildall.sh
@@ -0,0 +1,33 @@
+#!/bin/sh
+#####################################################################################
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#####################################################################################
+#
+# this is a small helper script for building a few container constellations locally
+# you can easily check the output via $> tail mvn-*.log | less
+#
+#####################################################################################
+
+rm mvn-*log
+mvn clean install -POWB -Dowb.version=1.1.8 | tee mvn-owb1_1_8.log
+mvn clean install -POWB -Dowb.version=1.2.1-SNAPSHOT -Dopenejb.owb.version=1.1.8 | tee mvn-owb1_2_1.log
+mvn clean install -PWeld -Dweld.version=1.1.10.Final | tee mvn-weld1_1_10.log
+mvn clean install -Ptomee-build-managed -Dtomee.version=1.6.0-SNAPSHOT -Dopenejb.version=4.6.0-SNAPSHOT -Dopenejb.owb.version=1.2.1-SNAPSHOT | tee mvn-tomee_1_6_0.log
+mvn clean install -Ptomee-build-managed -Dtomee.version=1.5.2 -Dopenejb.version=4.5.2 -Dopenejb.owb.version=1.1.8 | tee mvn-tomee_1_5_2.log
+mvn clean install -Pjbossas-build-managed-7 | tee mvn-jbossas_7.log
+
|
169dd5592f5d4ed4e561077579ad88d4d20806d5
|
brandonborkholder$glg2d
|
I abstracted out some common functionality from the ImageHelper and ShapeHelper, but the shader implementation needs to be rebuilt from the ground up.
|
p
|
https://github.com/brandonborkholder/glg2d
|
diff --git a/src/main/java/glg2d/GLGraphics2D.java b/src/main/java/glg2d/GLGraphics2D.java
index 2b2129b7..536d2e25 100644
--- a/src/main/java/glg2d/GLGraphics2D.java
+++ b/src/main/java/glg2d/GLGraphics2D.java
@@ -16,6 +16,7 @@
package glg2d;
+import glg2d.impl.gl2.GL2Transformhelper;
import glg2d.impl.gl2.GL2ColorHelper;
import glg2d.impl.gl2.GL2ImageDrawer;
import glg2d.impl.gl2.GL2ShapeDrawer;
@@ -99,7 +100,7 @@ protected void createDrawingHelpers() {
shapeHelper = new GL2ShapeDrawer();
imageHelper = new GL2ImageDrawer();
stringHelper = new GL2StringDrawer();
- matrixHelper = new G2DGLTransformHelper();
+ matrixHelper = new GL2Transformhelper();
colorHelper = new GL2ColorHelper();
addG2DDrawingHelper(shapeHelper);
diff --git a/src/main/java/glg2d/PathVisitor.java b/src/main/java/glg2d/PathVisitor.java
index d7d477fe..b4d46878 100644
--- a/src/main/java/glg2d/PathVisitor.java
+++ b/src/main/java/glg2d/PathVisitor.java
@@ -18,7 +18,7 @@
import java.awt.BasicStroke;
-import javax.media.opengl.GL2;
+import javax.media.opengl.GL;
/**
* Receives the calls from a {@link java.awt.geom.PathIterator} and draws the
@@ -40,7 +40,7 @@ public interface PathVisitor {
* @param context
* The GL context
*/
- void setGLContext(GL2 context);
+ void setGLContext(GL context);
/**
* Sets the stroke to be used when drawing a path. It's not needed for
diff --git a/src/main/java/glg2d/impl/AbstractImageHelper.java b/src/main/java/glg2d/impl/AbstractImageHelper.java
new file mode 100644
index 00000000..ea3ec77c
--- /dev/null
+++ b/src/main/java/glg2d/impl/AbstractImageHelper.java
@@ -0,0 +1,260 @@
+/**************************************************************************
+ Copyright 2012 Brandon Borkholder
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ***************************************************************************/
+
+package glg2d.impl;
+
+import glg2d.GLG2DImageHelper;
+import glg2d.GLGraphics2D;
+
+import java.awt.Color;
+import java.awt.Image;
+import java.awt.RenderingHints.Key;
+import java.awt.geom.AffineTransform;
+import java.awt.image.BufferedImage;
+import java.awt.image.BufferedImageOp;
+import java.awt.image.ImageObserver;
+import java.awt.image.RenderedImage;
+import java.awt.image.renderable.RenderableImage;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.util.HashMap;
+
+import com.jogamp.opengl.util.texture.Texture;
+import com.jogamp.opengl.util.texture.TextureCoords;
+import com.jogamp.opengl.util.texture.awt.AWTTextureIO;
+
+public abstract class AbstractImageHelper implements GLG2DImageHelper {
+ /**
+ * This cache is kept for each paint operation. We don't keep track of images
+ * being changed across different painting calls. The first time we see an
+ * image, we cache the texture. Then we clear the cache for the next call to
+ * {@code display()}.
+ */
+ protected TextureCache cache = new TextureCache();
+
+ protected GLGraphics2D g2d;
+
+ protected abstract void begin(Texture texture, AffineTransform xform, Color bgcolor);
+
+ protected abstract void applyTexture(Texture texture, int dx1, int dy1, int dx2, int dy2, float sx1, float sy1,
+ float sx2, float sy2);
+
+ protected abstract void end(Texture texture);
+
+ @Override
+ public void setG2D(GLGraphics2D g2d) {
+ this.g2d = g2d;
+ cache.clear();
+ }
+
+ @Override
+ public void push(GLGraphics2D newG2d) {
+ // nop
+ }
+
+ @Override
+ public void pop(GLGraphics2D parentG2d) {
+ // nop
+ }
+
+ @Override
+ public void setHint(Key key, Object value) {
+ // nop
+ }
+
+ @Override
+ public void resetHints() {
+ // nop
+ }
+
+ @Override
+ public void dispose() {
+ cache.clear();
+ }
+
+ @Override
+ public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
+ return drawImage(img, AffineTransform.getTranslateInstance(x, y), bgcolor, observer);
+ }
+
+ @Override
+ public boolean drawImage(Image img, AffineTransform xform, ImageObserver observer) {
+ return drawImage(img, xform, (Color) null, observer);
+ }
+
+ @Override
+ public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) {
+ double imgHeight = img.getHeight(null);
+ double imgWidth = img.getWidth(null);
+
+ if (imgHeight < 0 || imgWidth < 0) {
+ return false;
+ }
+
+ AffineTransform transform = AffineTransform.getTranslateInstance(x, y);
+ transform.scale(width / imgWidth, height / imgHeight);
+ return drawImage(img, transform, bgcolor, observer);
+ }
+
+ @Override
+ public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2,
+ int sy2, Color bgcolor, ImageObserver observer) {
+ Texture texture = getTexture(img, observer);
+ if (texture == null) {
+ return false;
+ }
+
+ float height = texture.getHeight();
+ float width = texture.getWidth();
+ begin(texture, null, bgcolor);
+ applyTexture(texture, dx1, dy1, dx2, dy2, sx1 / width, sy1 / height, sx2 / width, sy2 / height);
+ end(texture);
+
+ return true;
+ }
+
+ protected boolean drawImage(Image img, AffineTransform xform, Color color, ImageObserver observer) {
+ Texture texture = getTexture(img, observer);
+
+ begin(texture, xform, color);
+ applyTexture(texture);
+ end(texture);
+
+ return true;
+ }
+
+ protected void applyTexture(Texture texture) {
+ int width = texture.getWidth();
+ int height = texture.getHeight();
+ TextureCoords coords = texture.getImageTexCoords();
+
+ applyTexture(texture, 0, 0, width, height, coords.left(), coords.top(), coords.right(), coords.bottom());
+ }
+
+ /**
+ * Cache the texture if possible. I have a feeling this will run into issues
+ * later as images change. Just not sure how to handle it if they do. I
+ * suspect I should be using the ImageConsumer class and dumping pixels to the
+ * screen as I receive them.
+ *
+ * <p>
+ * If an image is a BufferedImage, turn it into a texture and cache it. If
+ * it's not, draw it to a BufferedImage and see if all the image data is
+ * available. If it is, cache it. If it's not, don't cache it. But if not all
+ * the image data is available, we will draw it what we have, since we draw
+ * anything in the image to a BufferedImage.
+ * </p>
+ */
+ protected Texture getTexture(Image image, ImageObserver observer) {
+ Texture texture = cache.get(image);
+ if (texture == null) {
+ BufferedImage bufferedImage;
+ if (image instanceof BufferedImage) {
+ bufferedImage = (BufferedImage) image;
+ } else {
+ bufferedImage = toBufferedImage(image);
+ }
+
+ texture = AWTTextureIO.newTexture(g2d.getGLContext().getGL().getGLProfile(), bufferedImage, false);
+ cache.put(image, texture);
+ }
+
+ return texture;
+ }
+
+ protected BufferedImage toBufferedImage(Image image) {
+ int width = image.getWidth(null);
+ int height = image.getHeight(null);
+ if (width < 0 || height < 0) {
+ return null;
+ }
+
+ BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
+ bufferedImage.createGraphics().drawImage(image, null, null);
+ return bufferedImage;
+ }
+
+ @Override
+ public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
+ // TODO Not implemented yet!
+ System.err.println("drawImage(BufferedImage, BufferedImageOp, int, int) not implemented yet!");
+ }
+
+ @Override
+ public void drawImage(RenderedImage img, AffineTransform xform) {
+ // TODO Not implemented yet!
+ System.err.println("drawImage(RenderedImage, AffineTransform) not implemented yet!");
+ }
+
+ @Override
+ public void drawImage(RenderableImage img, AffineTransform xform) {
+ // TODO Not implemented yet!
+ System.err.println("drawImage(RenderableImage, AffineTransform) not implemented yet!");
+ }
+
+ @SuppressWarnings("serial")
+ protected static class TextureCache extends HashMap<WeakKey<Image>, Texture> {
+ private ReferenceQueue<Image> queue = new ReferenceQueue<Image>();
+
+ public void expungeStaleEntries() {
+ Reference<? extends Image> ref = queue.poll();
+ while (ref != null) {
+ remove(ref);
+ ref = queue.poll();
+ }
+ }
+
+ public Texture get(Image image) {
+ expungeStaleEntries();
+ WeakKey<Image> key = new WeakKey<Image>(image, null);
+ return get(key);
+ }
+
+ public Texture put(Image image, Texture texture) {
+ expungeStaleEntries();
+ WeakKey<Image> key = new WeakKey<Image>(image, queue);
+ return put(key, texture);
+ }
+ }
+
+ protected static class WeakKey<T> extends WeakReference<T> {
+ private final int hash;
+
+ public WeakKey(T value, ReferenceQueue<T> queue) {
+ super(value, queue);
+ hash = value.hashCode();
+ }
+
+ @Override
+ public int hashCode() {
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ } else if (obj instanceof WeakKey) {
+ WeakKey<?> other = (WeakKey<?>) obj;
+ return other.hash == hash && get() == other.get();
+ } else {
+ return false;
+ }
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/java/glg2d/impl/AbstractShapeHelper.java b/src/main/java/glg2d/impl/AbstractShapeHelper.java
new file mode 100644
index 00000000..d8bcb7da
--- /dev/null
+++ b/src/main/java/glg2d/impl/AbstractShapeHelper.java
@@ -0,0 +1,222 @@
+/**************************************************************************
+ Copyright 2012 Brandon Borkholder
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ***************************************************************************/
+
+package glg2d.impl;
+
+import glg2d.GLG2DShapeHelper;
+import glg2d.GLGraphics2D;
+import glg2d.PathVisitor;
+
+import java.awt.RenderingHints;
+import java.awt.RenderingHints.Key;
+import java.awt.Shape;
+import java.awt.Stroke;
+import java.awt.geom.Arc2D;
+import java.awt.geom.Ellipse2D;
+import java.awt.geom.Line2D;
+import java.awt.geom.Path2D;
+import java.awt.geom.PathIterator;
+import java.awt.geom.Rectangle2D;
+import java.awt.geom.RoundRectangle2D;
+import java.util.ArrayDeque;
+import java.util.Deque;
+
+public abstract class AbstractShapeHelper implements GLG2DShapeHelper {
+ /**
+ * We know this is single-threaded, so we can use these as archetypes.
+ */
+ protected static final Ellipse2D.Float ELLIPSE = new Ellipse2D.Float();
+ protected static final RoundRectangle2D.Float ROUND_RECT = new RoundRectangle2D.Float();
+ protected static final Arc2D.Float ARC = new Arc2D.Float();
+ protected static final Rectangle2D.Float RECT = new Rectangle2D.Float();
+ protected static final Line2D.Float LINE = new Line2D.Float();
+
+ protected Deque<Stroke> strokeStack = new ArrayDeque<Stroke>(10);
+
+ @Override
+ public void setG2D(GLGraphics2D g2d) {
+ // nop
+ }
+
+ @Override
+ public void push(GLGraphics2D newG2d) {
+ strokeStack.push(newG2d.getStroke());
+ }
+
+ @Override
+ public void pop(GLGraphics2D parentG2d) {
+ strokeStack.pop();
+ }
+
+ @Override
+ public void setHint(Key key, Object value) {
+ // nop
+ }
+
+ @Override
+ public void resetHints() {
+ setHint(RenderingHints.KEY_ANTIALIASING, null);
+ }
+
+ @Override
+ public void dispose() {
+ // nop
+ }
+
+ @Override
+ public void setStroke(Stroke stroke) {
+ strokeStack.pop();
+ strokeStack.push(stroke);
+ }
+
+ @Override
+ public Stroke getStroke() {
+ return strokeStack.peek();
+ }
+
+ @Override
+ public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight, boolean fill) {
+ ROUND_RECT.setRoundRect(x, y, width, height, arcWidth, arcHeight);
+ if (fill) {
+ fill(ROUND_RECT, true);
+ } else {
+ draw(ROUND_RECT);
+ }
+ }
+
+ @Override
+ public void drawRect(int x, int y, int width, int height, boolean fill) {
+ RECT.setRect(x, y, width, height);
+ if (fill) {
+ fill(RECT, true);
+ } else {
+ draw(RECT);
+ }
+ }
+
+ @Override
+ public void drawLine(int x1, int y1, int x2, int y2) {
+ LINE.setLine(x1, y1, x2, y2);
+ draw(LINE);
+ }
+
+ @Override
+ public void drawOval(int x, int y, int width, int height, boolean fill) {
+ ELLIPSE.setFrame(x, y, width, height);
+ if (fill) {
+ fill(ELLIPSE, true);
+ } else {
+ draw(ELLIPSE);
+ }
+ }
+
+ @Override
+ public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle, boolean fill) {
+ ARC.setArc(x, y, width, height, startAngle, arcAngle, fill ? Arc2D.PIE : Arc2D.OPEN);
+ if (fill) {
+ fill(ARC);
+ } else {
+ draw(ARC);
+ }
+ }
+
+ @Override
+ public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
+ drawPoly(xPoints, yPoints, nPoints, false, false);
+ }
+
+ @Override
+ public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints, boolean fill) {
+ drawPoly(xPoints, yPoints, nPoints, fill, true);
+ }
+
+ protected void drawPoly(int[] xPoints, int[] yPoints, int nPoints, boolean fill, boolean close) {
+ Path2D.Float path = new Path2D.Float(PathIterator.WIND_NON_ZERO, nPoints);
+ path.moveTo(xPoints[0], yPoints[0]);
+ for (int i = 1; i < nPoints; i++) {
+ path.lineTo(xPoints[i], yPoints[i]);
+ }
+
+ if (close) {
+ path.closePath();
+ }
+
+ if (fill) {
+ fill(path);
+ } else {
+ draw(path);
+ }
+ }
+
+ @Override
+ public void fill(Shape shape) {
+ fill(shape, false);
+ }
+
+ protected abstract void fill(Shape shape, boolean isDefinitelySimpleConvex);
+
+ protected void traceShape(Shape shape, PathVisitor visitor) {
+ PathIterator iterator = shape.getPathIterator(null);
+ visitor.beginPoly(iterator.getWindingRule());
+
+ float[] coords = new float[10];
+ float[] previousVertex = new float[2];
+ for (; !iterator.isDone(); iterator.next()) {
+ int type = iterator.currentSegment(coords);
+ switch (type) {
+ case PathIterator.SEG_MOVETO:
+ visitor.moveTo(coords);
+ break;
+
+ case PathIterator.SEG_LINETO:
+ visitor.lineTo(coords);
+ break;
+
+ case PathIterator.SEG_QUADTO:
+ visitor.quadTo(previousVertex, coords);
+ break;
+
+ case PathIterator.SEG_CUBICTO:
+ visitor.cubicTo(previousVertex, coords);
+ break;
+
+ case PathIterator.SEG_CLOSE:
+ visitor.closeLine();
+ break;
+ }
+
+ switch (type) {
+ case PathIterator.SEG_LINETO:
+ case PathIterator.SEG_MOVETO:
+ previousVertex[0] = coords[0];
+ previousVertex[1] = coords[1];
+ break;
+
+ case PathIterator.SEG_QUADTO:
+ previousVertex[0] = coords[2];
+ previousVertex[1] = coords[3];
+ break;
+
+ case PathIterator.SEG_CUBICTO:
+ previousVertex[0] = coords[4];
+ previousVertex[1] = coords[5];
+ break;
+ }
+ }
+
+ visitor.endPoly();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/glg2d/impl/gl2/FastLineVisitor.java b/src/main/java/glg2d/impl/gl2/FastLineVisitor.java
index d6d2e601..37f5df69 100644
--- a/src/main/java/glg2d/impl/gl2/FastLineVisitor.java
+++ b/src/main/java/glg2d/impl/gl2/FastLineVisitor.java
@@ -22,6 +22,7 @@
import java.awt.BasicStroke;
import java.nio.FloatBuffer;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
/**
@@ -43,8 +44,8 @@ public class FastLineVisitor extends SimplePathVisitor {
protected float glLineWidth;
@Override
- public void setGLContext(GL2 context) {
- gl = context;
+ public void setGLContext(GL context) {
+ gl = context.getGL2();
}
@Override
diff --git a/src/main/java/glg2d/impl/gl2/FillSimpleConvexPolygonVisitor.java b/src/main/java/glg2d/impl/gl2/FillSimpleConvexPolygonVisitor.java
index 49b3fc4d..c2fced6f 100644
--- a/src/main/java/glg2d/impl/gl2/FillSimpleConvexPolygonVisitor.java
+++ b/src/main/java/glg2d/impl/gl2/FillSimpleConvexPolygonVisitor.java
@@ -21,6 +21,7 @@
import java.awt.BasicStroke;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
/**
@@ -33,8 +34,8 @@ public class FillSimpleConvexPolygonVisitor extends SimplePathVisitor {
protected VertexBuffer vBuffer = VertexBuffer.getSharedBuffer();
@Override
- public void setGLContext(GL2 context) {
- gl = context;
+ public void setGLContext(GL context) {
+ gl = context.getGL2();
}
@Override
diff --git a/src/main/java/glg2d/impl/gl2/GL2ImageDrawer.java b/src/main/java/glg2d/impl/gl2/GL2ImageDrawer.java
index 12f45cbf..a8a7e0fc 100644
--- a/src/main/java/glg2d/impl/gl2/GL2ImageDrawer.java
+++ b/src/main/java/glg2d/impl/gl2/GL2ImageDrawer.java
@@ -16,23 +16,11 @@
package glg2d.impl.gl2;
-import glg2d.GLG2DImageHelper;
import glg2d.GLG2DUtils;
-import glg2d.GLGraphics2D;
+import glg2d.impl.AbstractImageHelper;
import java.awt.Color;
-import java.awt.Image;
-import java.awt.RenderingHints.Key;
import java.awt.geom.AffineTransform;
-import java.awt.image.BufferedImage;
-import java.awt.image.BufferedImageOp;
-import java.awt.image.ImageObserver;
-import java.awt.image.RenderedImage;
-import java.awt.image.renderable.RenderableImage;
-import java.lang.ref.Reference;
-import java.lang.ref.ReferenceQueue;
-import java.lang.ref.WeakReference;
-import java.util.HashMap;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
@@ -40,109 +28,18 @@
import javax.media.opengl.fixedfunc.GLMatrixFunc;
import com.jogamp.opengl.util.texture.Texture;
-import com.jogamp.opengl.util.texture.TextureCoords;
-import com.jogamp.opengl.util.texture.awt.AWTTextureIO;
-
-public class GL2ImageDrawer implements GLG2DImageHelper {
- /**
- * This cache is kept for each paint operation. We don't keep track of images
- * being changed across different painting calls. The first time we see an
- * image, we cache the texture. Then we clear the cache for the next call to
- * {@code display()}.
- */
- protected TextureCache cache = new TextureCache();
-
- protected GLGraphics2D g2d;
-
- @Override
- public void setG2D(GLGraphics2D g2d) {
- this.g2d = g2d;
- cache.clear();
- }
-
- @Override
- public void push(GLGraphics2D newG2d) {
- }
-
- @Override
- public void pop(GLGraphics2D parentG2d) {
- }
-
- @Override
- public void setHint(Key key, Object value) {
- // nop
- }
-
- @Override
- public void resetHints() {
- // nop
- }
-
- @Override
- public void dispose() {
- cache.clear();
- }
-
- @Override
- public boolean drawImage(Image img, int x, int y, Color bgcolor, ImageObserver observer) {
- return drawImage(img, AffineTransform.getTranslateInstance(x, y), bgcolor, observer);
- }
-
- @Override
- public boolean drawImage(Image img, AffineTransform xform, ImageObserver observer) {
- return drawImage(img, xform, (Color) null, observer);
- }
-
- @Override
- public boolean drawImage(Image img, int x, int y, int width, int height, Color bgcolor, ImageObserver observer) {
- double imgHeight = img.getHeight(null);
- double imgWidth = img.getWidth(null);
-
- if (imgHeight < 0 || imgWidth < 0) {
- return false;
- }
-
- AffineTransform transform = AffineTransform.getTranslateInstance(x, y);
- transform.scale(width / imgWidth, height / imgHeight);
- return drawImage(img, transform, bgcolor, observer);
- }
+public class GL2ImageDrawer extends AbstractImageHelper {
@Override
- public boolean drawImage(Image img, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor,
- ImageObserver observer) {
- Texture texture = getTexture(img, observer);
- if (texture == null) {
- return false;
- }
-
- float height = texture.getHeight();
- float width = texture.getWidth();
- begin(texture, null, bgcolor);
- applyTexture(texture, dx1, dy1, dx2, dy2, sx1 / width, sy1 / height, sx2 / width, sy2 / height);
- end(texture);
-
- return true;
- }
-
- protected boolean drawImage(Image img, AffineTransform xform, Color color, ImageObserver observer) {
- Texture texture = getTexture(img, observer);
-
- begin(texture, xform, color);
- applyTexture(texture);
- end(texture);
-
- return true;
- }
-
protected void begin(Texture texture, AffineTransform xform, Color bgcolor) {
GL2 gl = g2d.getGLContext().getGL().getGL2();
gl.glTexEnvi(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, GL2ES1.GL_MODULATE);
gl.glTexParameterf(GL2ES1.GL_TEXTURE_ENV, GL2ES1.GL_TEXTURE_ENV_MODE, GL.GL_BLEND);
/*
- * This is unexpected since we never disable blending, but in some cases it
- * interacts poorly with multiple split panes, scroll panes and the text
- * renderer to disable blending.
+ * FIXME This is unexpected since we never disable blending, but in some
+ * cases it interacts poorly with multiple split panes, scroll panes and the
+ * text renderer to disable blending.
*/
g2d.setComposite(g2d.getComposite());
@@ -159,21 +56,17 @@ protected void begin(Texture texture, AffineTransform xform, Color bgcolor) {
g2d.getColorHelper().setColorRespectComposite(bgcolor == null ? Color.white : bgcolor);
}
+ @Override
protected void end(Texture texture) {
GL2 gl = g2d.getGLContext().getGL().getGL2();
gl.glEnd();
gl.glPopMatrix();
- texture.disable(gl);
- }
-
- protected void applyTexture(Texture texture) {
- int width = texture.getWidth();
- int height = texture.getHeight();
- TextureCoords coords = texture.getImageTexCoords();
- applyTexture(texture, 0, 0, width, height, coords.left(), coords.top(), coords.right(), coords.bottom());
+ texture.disable(gl);
+ g2d.getColorHelper().setColorRespectComposite(g2d.getColor());
}
+ @Override
protected void applyTexture(Texture texture, int dx1, int dy1, int dx2, int dy2, float sx1, float sy1, float sx2, float sy2) {
GL2 gl = g2d.getGLContext().getGL().getGL2();
gl.glBegin(GL2.GL_QUADS);
@@ -193,116 +86,4 @@ protected void applyTexture(Texture texture, int dx1, int dy1, int dx2, int dy2,
gl.glEnd();
}
-
- /**
- * Cache the texture if possible. I have a feeling this will run into issues
- * later as images change. Just not sure how to handle it if they do. I
- * suspect I should be using the ImageConsumer class and dumping pixels to the
- * screen as I receive them.
- *
- * <p>
- * If an image is a BufferedImage, turn it into a texture and cache it. If
- * it's not, draw it to a BufferedImage and see if all the image data is
- * available. If it is, cache it. If it's not, don't cache it. But if not all
- * the image data is available, we will draw it what we have, since we draw
- * anything in the image to a BufferedImage.
- * </p>
- */
- protected Texture getTexture(Image image, ImageObserver observer) {
- Texture texture = cache.get(image);
- if (texture == null) {
- BufferedImage bufferedImage;
- if (image instanceof BufferedImage) {
- bufferedImage = (BufferedImage) image;
- } else {
- bufferedImage = toBufferedImage(image);
- }
-
- texture = AWTTextureIO.newTexture(g2d.getGLContext().getGL().getGLProfile(), bufferedImage, false);
- cache.put(image, texture);
- }
-
- return texture;
- }
-
- protected BufferedImage toBufferedImage(Image image) {
- int width = image.getWidth(null);
- int height = image.getHeight(null);
- if (width < 0 || height < 0) {
- return null;
- }
-
- BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_4BYTE_ABGR);
- bufferedImage.createGraphics().drawImage(image, null, null);
- return bufferedImage;
- }
-
- @SuppressWarnings("serial")
- protected static class TextureCache extends HashMap<WeakKey<Image>, Texture> {
- private ReferenceQueue<Image> queue = new ReferenceQueue<Image>();
-
- public void expungeStaleEntries() {
- Reference<? extends Image> ref = queue.poll();
- while (ref != null) {
- remove(ref);
- ref = queue.poll();
- }
- }
-
- public Texture get(Image image) {
- expungeStaleEntries();
- WeakKey<Image> key = new WeakKey<Image>(image, null);
- return get(key);
- }
-
- public Texture put(Image image, Texture texture) {
- expungeStaleEntries();
- WeakKey<Image> key = new WeakKey<Image>(image, queue);
- return put(key, texture);
- }
- }
-
- protected static class WeakKey<T> extends WeakReference<T> {
- private final int hash;
-
- public WeakKey(T value, ReferenceQueue<T> queue) {
- super(value, queue);
- hash = value.hashCode();
- }
-
- @Override
- public int hashCode() {
- return hash;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- } else if (obj instanceof WeakKey) {
- WeakKey<?> other = (WeakKey<?>) obj;
- return other.hash == hash && get() == other.get();
- } else {
- return false;
- }
- }
- }
-
- @Override
- public void drawImage(BufferedImage img, BufferedImageOp op, int x, int y) {
- // TODO Not implemented yet!
- System.err.println("drawImage(BufferedImage, BufferedImageOp, int, int) not implemented yet!");
- }
-
- @Override
- public void drawImage(RenderedImage img, AffineTransform xform) {
- // TODO Not implemented yet!
- System.err.println("drawImage(RenderedImage, AffineTransform) not implemented yet!");
- }
-
- @Override
- public void drawImage(RenderableImage img, AffineTransform xform) {
- // TODO Not implemented yet!
- System.err.println("drawImage(RenderableImage, AffineTransform) not implemented yet!");
- }
}
diff --git a/src/main/java/glg2d/impl/gl2/GL2ShapeDrawer.java b/src/main/java/glg2d/impl/gl2/GL2ShapeDrawer.java
index 8cce8e0b..5451b9b9 100644
--- a/src/main/java/glg2d/impl/gl2/GL2ShapeDrawer.java
+++ b/src/main/java/glg2d/impl/gl2/GL2ShapeDrawer.java
@@ -16,55 +16,27 @@
package glg2d.impl.gl2;
-import glg2d.GLG2DShapeHelper;
import glg2d.GLGraphics2D;
-import glg2d.PathVisitor;
+import glg2d.impl.AbstractShapeHelper;
import java.awt.BasicStroke;
import java.awt.RenderingHints;
-import java.awt.RenderingHints.Key;
import java.awt.Shape;
import java.awt.Stroke;
-import java.awt.geom.Arc2D;
-import java.awt.geom.Ellipse2D;
-import java.awt.geom.Line2D;
-import java.awt.geom.Path2D;
-import java.awt.geom.PathIterator;
-import java.awt.geom.Rectangle2D;
-import java.awt.geom.RoundRectangle2D;
-import java.util.ArrayDeque;
-import java.util.Deque;
import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES1;
import javax.media.opengl.GL2GL3;
-public class GL2ShapeDrawer implements GLG2DShapeHelper {
- protected static final Ellipse2D.Double ELLIPSE = new Ellipse2D.Double();
-
- protected static final RoundRectangle2D.Double ROUND_RECT = new RoundRectangle2D.Double();
-
- protected static final Arc2D.Double ARC = new Arc2D.Double();
-
- protected static final Rectangle2D.Double RECT = new Rectangle2D.Double();
-
- protected static final Line2D.Double LINE = new Line2D.Double();
-
+public class GL2ShapeDrawer extends AbstractShapeHelper {
protected GL2 gl;
- protected Deque<Stroke> strokeStack = new ArrayDeque<Stroke>(10);
-
protected FillSimpleConvexPolygonVisitor simpleFillVisitor;
-
protected PolygonOrTesselatingVisitor complexFillVisitor;
-
protected LineDrawingVisitor simpleStrokeVisitor;
-
protected FastLineVisitor fastLineVisitor;
- protected Stroke stroke;
-
public GL2ShapeDrawer() {
simpleFillVisitor = new FillSimpleConvexPolygonVisitor();
complexFillVisitor = new PolygonOrTesselatingVisitor();
@@ -74,42 +46,14 @@ public GL2ShapeDrawer() {
@Override
public void setG2D(GLGraphics2D g2d) {
- gl = g2d.getGLContext().getGL().getGL2();
+ super.setG2D(g2d);
+ GL gl = g2d.getGLContext().getGL();
simpleFillVisitor.setGLContext(gl);
complexFillVisitor.setGLContext(gl);
simpleStrokeVisitor.setGLContext(gl);
fastLineVisitor.setGLContext(gl);
}
- @Override
- public void push(GLGraphics2D newG2d) {
- strokeStack.push(stroke);
- }
-
- @Override
- public void pop(GLGraphics2D parentG2d) {
- if (!strokeStack.isEmpty()) {
- stroke = strokeStack.pop();
- }
- setAntiAlias(parentG2d.getRenderingHint(RenderingHints.KEY_ANTIALIASING));
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void setHint(Key key, Object value) {
- if (key == RenderingHints.KEY_ANTIALIASING) {
- setAntiAlias(value);
- }
- }
-
- @Override
- public void resetHints() {
- setHint(RenderingHints.KEY_ANTIALIASING, null);
- }
-
public void setAntiAlias(Object hintValue) {
if (hintValue == RenderingHints.VALUE_ANTIALIAS_ON) {
gl.glEnable(GL.GL_LINE_SMOOTH);
@@ -125,92 +69,9 @@ public void setAntiAlias(Object hintValue) {
}
}
- @Override
- public void setStroke(Stroke stroke) {
- this.stroke = stroke;
- }
-
- @Override
- public Stroke getStroke() {
- return stroke;
- }
-
- @Override
- public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight, boolean fill) {
- ROUND_RECT.setRoundRect(x, y, width, height, arcWidth, arcHeight);
- if (fill) {
- fill(ROUND_RECT, true);
- } else {
- draw(ROUND_RECT);
- }
- }
-
- @Override
- public void drawRect(int x, int y, int width, int height, boolean fill) {
- if (fill) {
- gl.glRecti(x, y, x + width, y + height);
- } else {
- RECT.setRect(x, y, width, height);
- draw(RECT);
- }
- }
-
- @Override
- public void drawLine(int x1, int y1, int x2, int y2) {
- LINE.setLine(x1, y1, x2, y2);
- draw(LINE);
- }
-
- @Override
- public void drawOval(int x, int y, int width, int height, boolean fill) {
- ELLIPSE.setFrame(x, y, width, height);
- if (fill) {
- fill(ELLIPSE, true);
- } else {
- draw(ELLIPSE);
- }
- }
-
- @Override
- public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle, boolean fill) {
- ARC.setArc(x, y, width, height, startAngle, arcAngle, fill ? Arc2D.PIE : Arc2D.OPEN);
- if (fill) {
- fill(ARC);
- } else {
- draw(ARC);
- }
- }
-
- @Override
- public void drawPolyline(int[] xPoints, int[] yPoints, int nPoints) {
- drawPoly(xPoints, yPoints, nPoints, false, false);
- }
-
- @Override
- public void drawPolygon(int[] xPoints, int[] yPoints, int nPoints, boolean fill) {
- drawPoly(xPoints, yPoints, nPoints, fill, true);
- }
-
- protected void drawPoly(int[] xPoints, int[] yPoints, int nPoints, boolean fill, boolean close) {
- Path2D.Float path = new Path2D.Float(PathIterator.WIND_NON_ZERO, nPoints);
- path.moveTo(xPoints[0], yPoints[0]);
- for (int i = 1; i < nPoints; i++) {
- path.lineTo(xPoints[i], yPoints[i]);
- }
-
- if (close) {
- path.closePath();
- }
-
- if (fill) {
- fill(path);
- } else {
- draw(path);
- }
- }
-
@Override
public void draw(Shape shape) {
+ Stroke stroke = getStroke();
if (stroke instanceof BasicStroke) {
BasicStroke basicStroke = (BasicStroke) stroke;
if (fastLineVisitor.isValid(basicStroke)) {
@@ -229,10 +90,6 @@ public void draw(Shape shape) {
}
@Override
- public void fill(Shape shape) {
- fill(shape, false);
- }
-
protected void fill(Shape shape, boolean forceSimple) {
if (forceSimple) {
traceShape(shape, simpleFillVisitor);
@@ -240,56 +97,4 @@ protected void fill(Shape shape, boolean forceSimple) {
traceShape(shape, complexFillVisitor);
}
}
-
- protected void traceShape(Shape shape, PathVisitor visitor) {
- PathIterator iterator = shape.getPathIterator(null);
- visitor.beginPoly(iterator.getWindingRule());
-
- float[] coords = new float[10];
- float[] previousVertex = new float[2];
- for (; !iterator.isDone(); iterator.next()) {
- int type = iterator.currentSegment(coords);
- switch (type) {
- case PathIterator.SEG_MOVETO:
- visitor.moveTo(coords);
- break;
-
- case PathIterator.SEG_LINETO:
- visitor.lineTo(coords);
- break;
-
- case PathIterator.SEG_QUADTO:
- visitor.quadTo(previousVertex, coords);
- break;
-
- case PathIterator.SEG_CUBICTO:
- visitor.cubicTo(previousVertex, coords);
- break;
-
- case PathIterator.SEG_CLOSE:
- visitor.closeLine();
- break;
- }
-
- switch (type) {
- case PathIterator.SEG_LINETO:
- case PathIterator.SEG_MOVETO:
- previousVertex[0] = coords[0];
- previousVertex[1] = coords[1];
- break;
-
- case PathIterator.SEG_QUADTO:
- previousVertex[0] = coords[2];
- previousVertex[1] = coords[3];
- break;
-
- case PathIterator.SEG_CUBICTO:
- previousVertex[0] = coords[4];
- previousVertex[1] = coords[5];
- break;
- }
- }
-
- visitor.endPoly();
- }
}
diff --git a/src/main/java/glg2d/G2DGLTransformHelper.java b/src/main/java/glg2d/impl/gl2/GL2Transformhelper.java
similarity index 94%
rename from src/main/java/glg2d/G2DGLTransformHelper.java
rename to src/main/java/glg2d/impl/gl2/GL2Transformhelper.java
index f70df06b..77542159 100644
--- a/src/main/java/glg2d/G2DGLTransformHelper.java
+++ b/src/main/java/glg2d/impl/gl2/GL2Transformhelper.java
@@ -14,7 +14,11 @@
limitations under the License.
***************************************************************************/
-package glg2d;
+package glg2d.impl.gl2;
+
+import glg2d.GLG2DTransformHelper;
+import glg2d.GLG2DUtils;
+import glg2d.GLGraphics2D;
import java.awt.RenderingHints.Key;
import java.awt.geom.AffineTransform;
@@ -22,7 +26,7 @@
import javax.media.opengl.GL2;
import javax.media.opengl.fixedfunc.GLMatrixFunc;
-public class G2DGLTransformHelper implements GLG2DTransformHelper {
+public class GL2Transformhelper implements GLG2DTransformHelper {
protected static final float RAD_TO_DEG = 180f / (float) Math.PI;
protected GLGraphics2D g2d;
diff --git a/src/main/java/glg2d/impl/gl2/LineDrawingVisitor.java b/src/main/java/glg2d/impl/gl2/LineDrawingVisitor.java
index 4d61acb2..50a409d0 100644
--- a/src/main/java/glg2d/impl/gl2/LineDrawingVisitor.java
+++ b/src/main/java/glg2d/impl/gl2/LineDrawingVisitor.java
@@ -56,8 +56,8 @@ public class LineDrawingVisitor extends SimplePathVisitor {
protected VertexBuffer vBuffer = VertexBuffer.getSharedBuffer();
@Override
- public void setGLContext(GL2 context) {
- gl = context;
+ public void setGLContext(GL context) {
+ gl = context.getGL2();
}
@Override
diff --git a/src/main/java/glg2d/impl/gl2/PolygonOrTesselatingVisitor.java b/src/main/java/glg2d/impl/gl2/PolygonOrTesselatingVisitor.java
index 1985e3e6..184b422f 100644
--- a/src/main/java/glg2d/impl/gl2/PolygonOrTesselatingVisitor.java
+++ b/src/main/java/glg2d/impl/gl2/PolygonOrTesselatingVisitor.java
@@ -23,6 +23,7 @@
import java.awt.BasicStroke;
import java.nio.FloatBuffer;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
/**
@@ -83,8 +84,8 @@ public class PolygonOrTesselatingVisitor extends SimplePathVisitor {
protected PathVisitor tesselatorFallback;
@Override
- public void setGLContext(GL2 context) {
- gl = context;
+ public void setGLContext(GL context) {
+ gl = context.getGL2();
}
@Override
diff --git a/src/main/java/glg2d/impl/gl2/TesselatorVisitor.java b/src/main/java/glg2d/impl/gl2/TesselatorVisitor.java
index b54dc131..dc224897 100644
--- a/src/main/java/glg2d/impl/gl2/TesselatorVisitor.java
+++ b/src/main/java/glg2d/impl/gl2/TesselatorVisitor.java
@@ -21,6 +21,7 @@
import java.awt.BasicStroke;
import java.awt.geom.PathIterator;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLException;
import javax.media.opengl.glu.GLU;
@@ -47,8 +48,8 @@ public TesselatorVisitor() {
}
@Override
- public void setGLContext(GL2 context) {
- gl = context;
+ public void setGLContext(GL context) {
+ gl = context.getGL2();
}
@Override
diff --git a/src/main/java/glg2d/shaders/AbstractShader.java b/src/main/java/glg2d/impl/shader/AbstractShader.java
similarity index 99%
rename from src/main/java/glg2d/shaders/AbstractShader.java
rename to src/main/java/glg2d/impl/shader/AbstractShader.java
index 16efc6cf..fafc6b8b 100644
--- a/src/main/java/glg2d/shaders/AbstractShader.java
+++ b/src/main/java/glg2d/impl/shader/AbstractShader.java
@@ -14,7 +14,7 @@
limitations under the License.
***************************************************************************/
-package glg2d.shaders;
+package glg2d.impl.shader;
import javax.media.opengl.GL;
import javax.media.opengl.GL2ES2;
diff --git a/src/main/java/glg2d/shaders/FixedFuncShader.f b/src/main/java/glg2d/impl/shader/FixedFuncShader.f
similarity index 100%
rename from src/main/java/glg2d/shaders/FixedFuncShader.f
rename to src/main/java/glg2d/impl/shader/FixedFuncShader.f
diff --git a/src/main/java/glg2d/shaders/FixedFuncShader.v b/src/main/java/glg2d/impl/shader/FixedFuncShader.v
similarity index 100%
rename from src/main/java/glg2d/shaders/FixedFuncShader.v
rename to src/main/java/glg2d/impl/shader/FixedFuncShader.v
diff --git a/src/main/java/glg2d/shaders/G2DShaderImageDrawer.java b/src/main/java/glg2d/impl/shader/G2DShaderImageDrawer.java
similarity index 50%
rename from src/main/java/glg2d/shaders/G2DShaderImageDrawer.java
rename to src/main/java/glg2d/impl/shader/G2DShaderImageDrawer.java
index a3ee3f06..4b0a611e 100644
--- a/src/main/java/glg2d/shaders/G2DShaderImageDrawer.java
+++ b/src/main/java/glg2d/impl/shader/G2DShaderImageDrawer.java
@@ -14,19 +14,20 @@
limitations under the License.
***************************************************************************/
-package glg2d.shaders;
+package glg2d.impl.shader;
import glg2d.GLGraphics2D;
-import glg2d.impl.gl2.GL2ImageDrawer;
+import glg2d.impl.AbstractImageHelper;
import java.awt.Color;
import java.awt.geom.AffineTransform;
+import javax.media.opengl.GL2;
import javax.media.opengl.GL2ES2;
import com.jogamp.opengl.util.texture.Texture;
-public class G2DShaderImageDrawer extends GL2ImageDrawer {
+public class G2DShaderImageDrawer extends AbstractImageHelper {
protected Shader shader;
public G2DShaderImageDrawer(Shader shader) {
@@ -45,13 +46,58 @@ public void setG2D(GLGraphics2D g2d) {
@Override
protected void begin(Texture texture, AffineTransform xform, Color bgcolor) {
- super.begin(texture, xform, bgcolor);
+ /*
+ * FIXME This is unexpected since we never disable blending, but in some
+ * cases it interacts poorly with multiple split panes, scroll panes and the
+ * text renderer to disable blending.
+ */
+ g2d.setComposite(g2d.getComposite());
+
+ g2d.getMatrixHelper().push(g2d);
+ g2d.getColorHelper().push(g2d);
+ if (xform != null) {
+ g2d.getMatrixHelper().transform(xform);
+ }
+
+ GL2ES2 gl = g2d.getGLContext().getGL().getGL2ES2();
+
+ texture.enable(gl);
+ texture.bind(gl);
+
shader.use(true);
}
+ @Override
+ protected void applyTexture(Texture texture, int dx1, int dy1, int dx2, int dy2, float sx1, float sy1, float sx2, float sy2) {
+ GL2ES2 gl = g2d.getGLContext().getGL().getGL2ES2();
+
+ // TODO this needs to be implemented using buffers
+
+// gl.glBegin(GL2.GL_QUADS);
+//
+// // SW
+// gl.glTexCoord2f(sx1, sy2);
+// gl.glVertex2i(dx1, dy2);
+// // SE
+// gl.glTexCoord2f(sx2, sy2);
+// gl.glVertex2i(dx2, dy2);
+// // NE
+// gl.glTexCoord2f(sx2, sy1);
+// gl.glVertex2i(dx2, dy1);
+// // NW
+// gl.glTexCoord2f(sx1, sy1);
+// gl.glVertex2i(dx1, dy1);
+//
+// gl.glEnd();
+ }
+
@Override
protected void end(Texture texture) {
shader.use(false);
- super.end(texture);
+
+ g2d.getMatrixHelper().pop(g2d);
+ g2d.getColorHelper().pop(g2d);
+
+ texture.disable(g2d.getGLContext().getGL());
}
}
diff --git a/src/main/java/glg2d/shaders/G2DShaderShapeDrawer.java b/src/main/java/glg2d/impl/shader/G2DShaderShapeDrawer.java
similarity index 98%
rename from src/main/java/glg2d/shaders/G2DShaderShapeDrawer.java
rename to src/main/java/glg2d/impl/shader/G2DShaderShapeDrawer.java
index 38c1c0f4..a7eecbe9 100644
--- a/src/main/java/glg2d/shaders/G2DShaderShapeDrawer.java
+++ b/src/main/java/glg2d/impl/shader/G2DShaderShapeDrawer.java
@@ -14,7 +14,7 @@
limitations under the License.
***************************************************************************/
-package glg2d.shaders;
+package glg2d.impl.shader;
import glg2d.GLGraphics2D;
import glg2d.PathVisitor;
diff --git a/src/main/java/glg2d/shaders/GLShaderGraphics2D.java b/src/main/java/glg2d/impl/shader/GLShaderGraphics2D.java
similarity index 87%
rename from src/main/java/glg2d/shaders/GLShaderGraphics2D.java
rename to src/main/java/glg2d/impl/shader/GLShaderGraphics2D.java
index 50885c25..9d541ae6 100644
--- a/src/main/java/glg2d/shaders/GLShaderGraphics2D.java
+++ b/src/main/java/glg2d/impl/shader/GLShaderGraphics2D.java
@@ -14,23 +14,20 @@
limitations under the License.
***************************************************************************/
-package glg2d.shaders;
+package glg2d.impl.shader;
-import glg2d.G2DGLTransformHelper;
import glg2d.GLGraphics2D;
+import glg2d.impl.gl2.GL2Transformhelper;
import glg2d.impl.gl2.GL2ColorHelper;
+import glg2d.impl.gl2.GL2StringDrawer;
public class GLShaderGraphics2D extends GLGraphics2D {
- public GLShaderGraphics2D() {
- super();
- }
-
@Override
protected void createDrawingHelpers() {
Shader s = new ResourceShader(GLShaderGraphics2D.class, "TextureShader.v", "TextureShader.f");
imageHelper = new G2DShaderImageDrawer(s);
- stringHelper = new G2DShaderStringDrawer(s);
- matrixHelper = new G2DGLTransformHelper();
+ stringHelper = new GL2StringDrawer();
+ matrixHelper = new GL2Transformhelper();
colorHelper = new GL2ColorHelper();
s = new ResourceShader(GLShaderGraphics2D.class, "FixedFuncShader.v", "FixedFuncShader.f");
diff --git a/src/main/java/glg2d/shaders/ResourceShader.java b/src/main/java/glg2d/impl/shader/ResourceShader.java
similarity index 98%
rename from src/main/java/glg2d/shaders/ResourceShader.java
rename to src/main/java/glg2d/impl/shader/ResourceShader.java
index bd4a88db..79a867bf 100644
--- a/src/main/java/glg2d/shaders/ResourceShader.java
+++ b/src/main/java/glg2d/impl/shader/ResourceShader.java
@@ -14,7 +14,7 @@
limitations under the License.
***************************************************************************/
-package glg2d.shaders;
+package glg2d.impl.shader;
import java.io.BufferedReader;
import java.io.IOException;
diff --git a/src/main/java/glg2d/shaders/Shader.java b/src/main/java/glg2d/impl/shader/Shader.java
similarity index 97%
rename from src/main/java/glg2d/shaders/Shader.java
rename to src/main/java/glg2d/impl/shader/Shader.java
index 44041221..4866f410 100644
--- a/src/main/java/glg2d/shaders/Shader.java
+++ b/src/main/java/glg2d/impl/shader/Shader.java
@@ -14,7 +14,7 @@
limitations under the License.
***************************************************************************/
-package glg2d.shaders;
+package glg2d.impl.shader;
import javax.media.opengl.GL2ES2;
diff --git a/src/main/java/glg2d/shaders/ShaderException.java b/src/main/java/glg2d/impl/shader/ShaderException.java
similarity index 97%
rename from src/main/java/glg2d/shaders/ShaderException.java
rename to src/main/java/glg2d/impl/shader/ShaderException.java
index a1bb5711..1c89086d 100644
--- a/src/main/java/glg2d/shaders/ShaderException.java
+++ b/src/main/java/glg2d/impl/shader/ShaderException.java
@@ -14,7 +14,7 @@
limitations under the License.
***************************************************************************/
-package glg2d.shaders;
+package glg2d.impl.shader;
public class ShaderException extends RuntimeException {
private static final long serialVersionUID = 829519650852350876L;
diff --git a/src/main/java/glg2d/shaders/TextureShader.f b/src/main/java/glg2d/impl/shader/TextureShader.f
similarity index 100%
rename from src/main/java/glg2d/shaders/TextureShader.f
rename to src/main/java/glg2d/impl/shader/TextureShader.f
diff --git a/src/main/java/glg2d/shaders/TextureShader.v b/src/main/java/glg2d/impl/shader/TextureShader.v
similarity index 100%
rename from src/main/java/glg2d/shaders/TextureShader.v
rename to src/main/java/glg2d/impl/shader/TextureShader.v
diff --git a/src/main/java/glg2d/shaders/G2DShaderStringDrawer.java b/src/main/java/glg2d/shaders/G2DShaderStringDrawer.java
deleted file mode 100644
index 4512a0e1..00000000
--- a/src/main/java/glg2d/shaders/G2DShaderStringDrawer.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**************************************************************************
- Copyright 2012 Brandon Borkholder
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- ***************************************************************************/
-
-package glg2d.shaders;
-
-import glg2d.GLGraphics2D;
-import glg2d.impl.gl2.GL2StringDrawer;
-
-import java.awt.Color;
-
-import javax.media.opengl.GL2ES2;
-
-import com.jogamp.opengl.util.awt.TextRenderer;
-
-public class G2DShaderStringDrawer extends GL2StringDrawer {
- protected Shader shader;
-
- public G2DShaderStringDrawer(Shader shader) {
- this.shader = shader;
- }
-
- @Override
- public void setG2D(GLGraphics2D g2d) {
- super.setG2D(g2d);
-
- GL2ES2 gl = g2d.getGLContext().getGL().getGL2ES2();
- if (!shader.isProgram(gl)) {
- shader.setup(gl);
- }
- }
-
- @Override
- protected void begin(TextRenderer renderer, Color textColor) {
- super.begin(renderer, textColor);
- shader.use(true);
- }
-
- @Override
- protected void end(TextRenderer renderer) {
- shader.use(false);
- super.end(renderer);
- }
-}
diff --git a/src/test/java/glg2d/examples/shaders/CellShaderExample.java b/src/test/java/glg2d/examples/shaders/CellShaderExample.java
index 8e451b8a..6bdfcb52 100644
--- a/src/test/java/glg2d/examples/shaders/CellShaderExample.java
+++ b/src/test/java/glg2d/examples/shaders/CellShaderExample.java
@@ -2,16 +2,16 @@
import glg2d.G2DGLEventListener;
import glg2d.G2DGLPanel;
-import glg2d.G2DGLTransformHelper;
import glg2d.GLGraphics2D;
import glg2d.UIDemo;
+import glg2d.impl.gl2.GL2StringDrawer;
+import glg2d.impl.gl2.GL2Transformhelper;
import glg2d.impl.gl2.GL2ColorHelper;
-import glg2d.shaders.G2DShaderImageDrawer;
-import glg2d.shaders.G2DShaderShapeDrawer;
-import glg2d.shaders.G2DShaderStringDrawer;
-import glg2d.shaders.GLShaderGraphics2D;
-import glg2d.shaders.ResourceShader;
-import glg2d.shaders.Shader;
+import glg2d.impl.shader.G2DShaderImageDrawer;
+import glg2d.impl.shader.G2DShaderShapeDrawer;
+import glg2d.impl.shader.GLShaderGraphics2D;
+import glg2d.impl.shader.ResourceShader;
+import glg2d.impl.shader.Shader;
import java.awt.Dimension;
@@ -40,10 +40,10 @@ protected void createDrawingHelpers() {
s = new ResourceShader(CellShaderExample.class, "CellShader.v", "CellTextureShader.f");
imageHelper = new G2DShaderImageDrawer(s);
- stringHelper = new G2DShaderStringDrawer(s);
-
+ stringHelper = new GL2StringDrawer();
+
colorHelper = new GL2ColorHelper();
- matrixHelper = new G2DGLTransformHelper();
+ matrixHelper = new GL2Transformhelper();
addG2DDrawingHelper(shapeHelper);
addG2DDrawingHelper(imageHelper);
diff --git a/src/test/java/glg2d/misc/SimpleTimingTests.java b/src/test/java/glg2d/misc/SimpleTimingTests.java
index 4bc4743b..59a9f1f0 100644
--- a/src/test/java/glg2d/misc/SimpleTimingTests.java
+++ b/src/test/java/glg2d/misc/SimpleTimingTests.java
@@ -7,6 +7,7 @@
import java.awt.geom.AffineTransform;
import java.util.Random;
+import javax.media.opengl.GL;
import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
@@ -107,7 +108,7 @@ public void naiveQuadraticBezier() {
public void forwardDifferencingBezier() {
SimplePathVisitor visitor = new SimplePathVisitor() {
@Override
- public void setGLContext(GL2 context) {
+ public void setGLContext(GL context) {
}
@Override
|
b52a5a0b2c1166c28049c3debb78e03c6692dedc
|
adangel$pmd
|
optimizations, export improvements
git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@7583 51baf565-9d33-0410-a72c-fc3788e3496d
|
p
|
https://github.com/adangel/pmd
|
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/CHANGELOG.txt b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/CHANGELOG.txt
index e349969cfb3..8742c90ebc3 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/CHANGELOG.txt
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/CHANGELOG.txt
@@ -4,15 +4,18 @@ v4.0.0 - xxx 2011?
. New integrated AST View and XPath test area
. New rule creation wizard
. New report preferences panel
+. New file filter panel for exclusion/inclusion entries
. User-definable rule violation markers
Highest priority markers also decorate folders & projects (selectable)
. Colour syntax highlighting in code viewers/editors
+. Expanded rule import dialog to show incoming rules and any duplicates
+. Export rule function now only exports selected rules
. Overhauled rule preferences screen
. allows users to group/edit rules by multiple criteria
. new ability to enable/disable rules without removing them from rulesets
. larger editors for the various fields
. support for non-Java languages
-. group editing of filter exclusion rules
+. group editing of rule exclusion filters
. highlighting of non-default property values
. colour-tagged expressions in shown in rule table
. new property editors are fully type-aware
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/messages.properties b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/messages.properties
index c1e0d96ce0d..f63227772be 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/messages.properties
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/messages.properties
@@ -97,7 +97,7 @@ preference.ruleset.button.addrule = Add rule...
preference.ruleset.button.removerule = Remove rule
preference.ruleset.button.editrule = Edit rule...
preference.ruleset.button.importruleset = Import rule set...
-preference.ruleset.button.exportruleset = Export rule set...
+preference.ruleset.button.exportruleset = Export selected rules...
preference.ruleset.button.clearall = Clear all
preference.ruleset.button.ruledesigner = Rule Designer
preference.ruleset.button.addproperty = Add property...
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java
index 02a7cd1aeff..43e07652c9d 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/plugin/PMDPlugin.java
@@ -46,6 +46,10 @@
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IStatus;
@@ -68,7 +72,7 @@
/**
* The activator class controls the plug-in life cycle
*/
-public class PMDPlugin extends AbstractUIPlugin {
+public class PMDPlugin extends AbstractUIPlugin implements IResourceChangeListener {
private static File pluginFolder;
@@ -170,16 +174,35 @@ public static File getPluginFolder() {
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
- configureLogs(loadPreferences());
+
+ IPreferences prefs = loadPreferences();
+ configureLogs(prefs);
registerStandardRuleSets();
registerAdditionalRuleSets();
+ fileChangeListenerEnabled(prefs.isCheckAfterSaveEnabled());
}
-
+
+
+
+ public void fileChangeListenerEnabled(boolean flag) {
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+ if (flag) {
+ workspace.addResourceChangeListener(this);
+ } else {
+ workspace.removeResourceChangeListener(this);
+ }
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+
+ fileChangeListenerEnabled(false);
+
plugin = null;
disposeResources();
super.stop(context);
@@ -541,5 +564,14 @@ public void removedMarkersIn(IResource resource) {
decorator.changed(changes);
}
+ public void resourceChanged(IResourceChangeEvent event) {
+
+// switch (event.getType()) {
+// case PRE_DELETE:
+// case POST_CHANGE:
+// }
+
+ }
+
}
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/AbstractDefaultCommand.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/AbstractDefaultCommand.java
index d0ba892221e..f8bfdd5ee0f 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/AbstractDefaultCommand.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/AbstractDefaultCommand.java
@@ -38,6 +38,7 @@
import name.herlin.command.AbstractProcessableCommand;
import name.herlin.command.CommandException;
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
+import net.sourceforge.pmd.lang.Language;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IFile;
@@ -70,11 +71,22 @@ protected AbstractDefaultCommand(String theName, String theDescription) {
description = theDescription;
}
+ /**
+ *
+ * @param file
+ * @return
+ * @deprecated we support multiple languages now
+ */
public static boolean isJavaFile(IFile file) {
if (file == null) return false;
return "JAVA".equalsIgnoreCase(file.getFileExtension());
}
+ public static boolean isLanguageFile(IFile file, Language language) {
+ if (file == null) return false;
+ return language.hasExtension(file.getFileExtension());
+ }
+
/**
* @return Returns the readOnly status.
*/
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/BaseVisitor.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/BaseVisitor.java
index 0ad05f9b17c..36a43f595ce 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/BaseVisitor.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/BaseVisitor.java
@@ -74,7 +74,7 @@ public class BaseVisitor {
private static final Logger log = Logger.getLogger(BaseVisitor.class);
private IProgressMonitor monitor;
private boolean useTaskMarker = false;
- private Map<IFile, Set<MarkerInfo>> accumulator;
+ private Map<IFile, Set<MarkerInfo2>> accumulator;
// private PMDEngine pmdEngine;
private RuleSet ruleSet;
private int fileCount;
@@ -123,7 +123,7 @@ public void setUseTaskMarker(final boolean useTaskMarker) {
*
* @return Map
*/
- public Map<IFile, Set<MarkerInfo>> getAccumulator() {
+ public Map<IFile, Set<MarkerInfo2>> getAccumulator() {
return accumulator;
}
@@ -133,7 +133,7 @@ public Map<IFile, Set<MarkerInfo>> getAccumulator() {
* @param accumulator
* The accumulator to set
*/
- public void setAccumulator(final Map<IFile, Set<MarkerInfo>> accumulator) {
+ public void setAccumulator(final Map<IFile, Set<MarkerInfo2>> accumulator) {
this.accumulator = accumulator;
}
@@ -245,69 +245,65 @@ private boolean isIncluded(IFile file) throws PropertiesException {
* @param resource
* the resource to process
*/
- protected final void reviewResource(final IResource resource) {
- IFile file = (IFile) resource.getAdapter(IFile.class);
- if (file != null && file.getFileExtension() != null) {
-
- Reader input = null;
- try {
- boolean included = isIncluded(file);
- log.debug("Derived files included: " + projectProperties.isIncludeDerivedFiles());
- log.debug("file " + file.getName() + " is derived: " + file.isDerived());
- log.debug("file checked: " + included);
-
- final File sourceCodeFile = file.getRawLocation().toFile();
- if (included && getRuleSet().applies(sourceCodeFile) && isFileInWorkingSet(file)) {
- subTask("PMD checking: " + file.getName());
-
- LanguageVersion version = PMDPlugin.javaVersionFor(file.getProject());
- if (version != null) configuration().setDefaultLanguageVersion(version);
-
- Timer timer = new Timer();
-
- RuleContext context = PMD.newRuleContext(file.getName(), sourceCodeFile);
-
- input = new InputStreamReader(file.getContents(), file.getCharset());
-// getPmdEngine().processFile(input, getRuleSet(), context);
-// getPmdEngine().processFile(sourceCodeFile, getRuleSet(), context);
-
- RuleSets rSets = new RuleSets(getRuleSet());
- new SourceCodeProcessor(configuration()).processSourceCode(input, rSets, context);
-
- timer.stop();
- pmdDuration += timer.getDuration();
-
- updateMarkers(file, context, isUseTaskMarker(), getAccumulator());
-
- worked(1);
- fileCount++;
- } else {
- log.debug("The file " + file.getName() + " is not in the working set");
- }
+ protected final void reviewResource(IResource resource) {
- } catch (CoreException e) {
- log.error("Core exception visiting " + file.getName(), e); // TODO:
- // complete
- // message
- } catch (PMDException e) {
- log.error("PMD exception visiting " + file.getName(), e); // TODO:
- // complete
- // message
- } catch (IOException e) {
- log.error("IO exception visiting " + file.getName(), e); // TODO:
- // complete
- // message
- } catch (PropertiesException e) {
- log.error("Properties exception visiting " + file.getName(), e); // TODO:
- // complete
- // message
- } finally {
- IOUtil.closeQuietly(input);
- }
+ IFile file = (IFile) resource.getAdapter(IFile.class);
+ if (file == null || file.getFileExtension() == null) return;
+
+ Reader input = null;
+ try {
+ boolean included = isIncluded(file);
+ log.debug("Derived files included: " + projectProperties.isIncludeDerivedFiles());
+ log.debug("file " + file.getName() + " is derived: " + file.isDerived());
+ log.debug("file checked: " + included);
+
+ final File sourceCodeFile = file.getRawLocation().toFile();
+ if (included && getRuleSet().applies(sourceCodeFile) && isFileInWorkingSet(file)) {
+ subTask("PMD checking: " + file.getName());
+
+ setLanguageVersion(file);
+
+ Timer timer = new Timer();
+
+ RuleContext context = PMD.newRuleContext(file.getName(), sourceCodeFile);
+
+ input = new InputStreamReader(file.getContents(), file.getCharset());
+ // getPmdEngine().processFile(input, getRuleSet(), context);
+ // getPmdEngine().processFile(sourceCodeFile, getRuleSet(), context);
+
+ RuleSets rSets = new RuleSets(getRuleSet());
+ new SourceCodeProcessor(configuration()).processSourceCode(input, rSets, context);
+
+ timer.stop();
+ pmdDuration += timer.getDuration();
+
+ updateMarkers(file, context, isUseTaskMarker(), getAccumulator());
+
+ worked(1);
+ fileCount++;
+ } else {
+ log.debug("The file " + file.getName() + " is not in the working set");
+ }
+
+ } catch (CoreException e) {
+ log.error("Core exception visiting " + file.getName(), e); // TODO: // complete message
+ } catch (PMDException e) {
+ log.error("PMD exception visiting " + file.getName(), e); // TODO: // complete message
+ } catch (IOException e) {
+ log.error("IO exception visiting " + file.getName(), e); // TODO: // complete message
+ } catch (PropertiesException e) {
+ log.error("Properties exception visiting " + file.getName(), e); // TODO: // complete message
+ } finally {
+ IOUtil.closeQuietly(input);
+ }
- }
}
+ private void setLanguageVersion(IFile file) {
+ LanguageVersion version = PMDPlugin.javaVersionFor(file.getProject());
+ if (version != null) configuration().setDefaultLanguageVersion(version);
+ }
+
/**
* Test if a file is in the PMD working set
*
@@ -360,15 +356,16 @@ public static String markerTypeFor(RuleViolation violation) {
}
}
- private void updateMarkers(final IFile file, final RuleContext context, final boolean fTask, final Map<IFile, Set<MarkerInfo>> accumulator)
+ private void updateMarkers(IFile file, RuleContext context, boolean fTask, Map<IFile, Set<MarkerInfo2>> accumulator)
throws CoreException, PropertiesException {
- final Set<MarkerInfo> markerSet = new HashSet<MarkerInfo>();
- final List<Review> reviewsList = findReviewedViolations(file);
- final Review review = new Review();
- final Iterator<RuleViolation> iter = context.getReport().iterator();
+
+ Set<MarkerInfo2> markerSet = new HashSet<MarkerInfo2>();
+ List<Review> reviewsList = findReviewedViolations(file);
+ Review review = new Review();
+ Iterator<RuleViolation> iter = context.getReport().iterator();
// final IPreferences preferences = PMDPlugin.getDefault().loadPreferences();
// final int maxViolationsPerFilePerRule = preferences.getMaxViolationsPerFilePerRule();
- final Map<Rule, Integer> violationsByRule = new HashMap<Rule, Integer>();
+ Map<Rule, Integer> violationsByRule = new HashMap<Rule, Integer>();
Rule rule = null;
while (iter.hasNext()) {
@@ -379,35 +376,37 @@ private void updateMarkers(final IFile file, final RuleContext context, final bo
if (reviewsList.contains(review)) {
log.debug("Ignoring violation of rule " + rule.getName() + " at line " + violation.getBeginLine() + " because of a review.");
- } else {
- Integer count = violationsByRule.get(rule);
- if (count == null) {
- count = NumericConstants.ZERO;
- violationsByRule.put(rule, count);
- }
+ continue;
+ }
- int maxViolations = maxAllowableViolationsFor(rule);
+ Integer count = violationsByRule.get(rule);
+ if (count == null) {
+ count = NumericConstants.ZERO;
+ violationsByRule.put(rule, count);
+ }
- if (count.intValue() < maxViolations) {
- // Ryan Gustafson 02/16/2008 - Always use PMD_MARKER, as people get confused as to why PMD problems don't always show up on Problems view like they do when you do build.
- // markerSet.add(getMarkerInfo(violation, fTask ? PMDRuntimeConstants.PMD_TASKMARKER : PMDRuntimeConstants.PMD_MARKER));
- markerSet.add(getMarkerInfo(violation, markerTypeFor(violation)));
- /*
- if (isDfaEnabled && violation.getRule().usesDFA()) {
- markerSet.add(getMarkerInfo(violation, PMDRuntimeConstants.PMD_DFA_MARKER));
- } else {
+ int maxViolations = maxAllowableViolationsFor(rule);
+
+ if (count.intValue() < maxViolations) {
+ // Ryan Gustafson 02/16/2008 - Always use PMD_MARKER, as people get confused as to why PMD problems don't always show up on Problems view like they do when you do build.
+ // markerSet.add(getMarkerInfo(violation, fTask ? PMDRuntimeConstants.PMD_TASKMARKER : PMDRuntimeConstants.PMD_MARKER));
+ markerSet.add(
+ getMarkerInfo(violation, markerTypeFor(violation))
+ );
+ /*
+ if (isDfaEnabled && violation.getRule().usesDFA()) {
+ markerSet.add(getMarkerInfo(violation, PMDRuntimeConstants.PMD_DFA_MARKER));
+ } else {
markerSet.add(getMarkerInfo(violation, fTask ? PMDRuntimeConstants.PMD_TASKMARKER : PMDRuntimeConstants.PMD_MARKER));
- }
+ }
*/
- violationsByRule.put(rule, Integer.valueOf(count.intValue() + 1));
+ violationsByRule.put(rule, Integer.valueOf(count.intValue() + 1));
- log.debug("Adding a violation for rule " + rule.getName() + " at line " + violation.getBeginLine());
+ log.debug("Adding a violation for rule " + rule.getName() + " at line " + violation.getBeginLine());
} else {
log.debug("Ignoring violation of rule " + rule.getName() + " at line " + violation.getBeginLine()
+ " because maximum violations has been reached for file " + file.getName());
}
-
- }
}
if (accumulator != null) {
@@ -477,75 +476,47 @@ private List<Review> findReviewedViolations(final IFile file) {
return reviews;
}
- /**
- * Create a marker info object from a violation
- *
- * @param violation
- * a PMD violation
- * @param type
- * a marker type
- * @return markerInfo a markerInfo object
- */
- private MarkerInfo getMarkerInfo(final RuleViolation violation, final String type) throws PropertiesException {
- final MarkerInfo markerInfo = new MarkerInfo(type);
-
- final List<String> attributeNames = new ArrayList<String>();
- final List<Object> values = new ArrayList<Object>();
+ private MarkerInfo2 getMarkerInfo(RuleViolation violation, String type) throws PropertiesException {
+
+ Rule rule = violation.getRule();
+
+ MarkerInfo2 info = new MarkerInfo2(type, 7);
- attributeNames.add(IMarker.MESSAGE);
- values.add(violation.getDescription());
+ info.add(IMarker.MESSAGE, violation.getDescription());
+ info.add(IMarker.LINE_NUMBER, violation.getBeginLine());
+ info.add(PMDRuntimeConstants.KEY_MARKERATT_LINE2, violation.getEndLine());
+ info.add(PMDRuntimeConstants.KEY_MARKERATT_RULENAME, rule.getName());
+ info.add(PMDRuntimeConstants.KEY_MARKERATT_PRIORITY ,rule.getPriority().getPriority());
- attributeNames.add(IMarker.LINE_NUMBER);
- values.add(Integer.valueOf(violation.getBeginLine()));
-
- attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_LINE2);
- values.add(Integer.valueOf(violation.getEndLine()));
-
- attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_RULENAME);
- values.add(violation.getRule().getName());
-
- attributeNames.add(PMDRuntimeConstants.KEY_MARKERATT_PRIORITY);
- values.add(Integer.valueOf(violation.getRule().getPriority().getPriority()));
-
- switch (violation.getRule().getPriority().getPriority()) {
+ switch (rule.getPriority().getPriority()) {
case 1:
- attributeNames.add(IMarker.PRIORITY);
- values.add(Integer.valueOf(IMarker.PRIORITY_HIGH));
- attributeNames.add(IMarker.SEVERITY);
- values.add(Integer.valueOf(projectProperties.violationsAsErrors()?IMarker.SEVERITY_ERROR:IMarker.SEVERITY_WARNING));
+ info.add(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
+ info.add(IMarker.SEVERITY, projectProperties.violationsAsErrors() ? IMarker.SEVERITY_ERROR : IMarker.SEVERITY_WARNING);
break;
- case 2:
- attributeNames.add(IMarker.SEVERITY);
+ case 2:
if (projectProperties.violationsAsErrors()) {
- values.add(Integer.valueOf(IMarker.SEVERITY_ERROR));
+ info.add(IMarker.SEVERITY, IMarker.SEVERITY_ERROR);
} else {
- values.add(Integer.valueOf(IMarker.SEVERITY_WARNING));
- attributeNames.add(IMarker.PRIORITY);
- values.add(Integer.valueOf(IMarker.PRIORITY_HIGH));
+ info.add(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
+ info.add(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
}
break;
case 5:
- attributeNames.add(IMarker.SEVERITY);
- values.add(Integer.valueOf(IMarker.SEVERITY_INFO));
+ info.add(IMarker.SEVERITY, IMarker.SEVERITY_INFO);
break;
case 3:
- attributeNames.add(IMarker.PRIORITY);
- values.add(Integer.valueOf(IMarker.PRIORITY_HIGH));
+ info.add(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
case 4:
default:
- attributeNames.add(IMarker.SEVERITY);
- values.add(Integer.valueOf(IMarker.SEVERITY_WARNING));
+ info.add(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
break;
}
-
- markerInfo.setAttributeNames(attributeNames.toArray(new String[attributeNames.size()]));
- markerInfo.setAttributeValues(values.toArray());
-
- return markerInfo;
+
+ return info;
}
-
+
/**
* Private inner type to handle reviews
*/
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/DeleteMarkersCommand.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/DeleteMarkersCommand.java
index bb6c9654270..82d58955cd7 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/DeleteMarkersCommand.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/DeleteMarkersCommand.java
@@ -57,11 +57,11 @@ public class DeleteMarkersCommand extends AbstractDefaultCommand {
public DeleteMarkersCommand() {
super("DeleteMarkersCommand", "Deletes a possible large number of markers");
- this.setOutputProperties(true);
- this.setReadOnly(false);
- this.setTerminated(false);
- this.setMarkers(null);
- this.setUserInitiated(false);
+ setOutputProperties(true);
+ setReadOnly(false);
+ setTerminated(false);
+ setMarkers(null);
+ setUserInitiated(false);
}
public final void setMarkers(IMarker[] theMarkers) { // NOPMD by Sven on 13.11.06 11:43
@@ -95,4 +95,4 @@ public void reset() {
setMarkers(null);
}
-}
+}
\ No newline at end of file
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/DeltaVisitor.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/DeltaVisitor.java
index 09f9d283aea..3c9d0f2f854 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/DeltaVisitor.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/DeltaVisitor.java
@@ -14,6 +14,7 @@
*
*/
public class DeltaVisitor extends BaseVisitor implements IResourceDeltaVisitor {
+
private static final Logger log = Logger.getLogger(DeltaVisitor.class);
/**
@@ -26,40 +27,43 @@ public DeltaVisitor() {
/**
* Constructor with monitor
*/
- public DeltaVisitor(final IProgressMonitor monitor) {
+ public DeltaVisitor(IProgressMonitor monitor) {
super();
- this.setMonitor(monitor);
+ setMonitor(monitor);
}
/**
* @see org.eclipse.core.resources.IResourceDeltaVisitor#visit(IResourceDelta)
*/
- public boolean visit(final IResourceDelta delta) throws CoreException {
- boolean fProcessChildren = true;
+ public boolean visit(IResourceDelta delta) throws CoreException {
+
+ if (isCanceled()) return false;
- if (this.isCanceled()) {
- fProcessChildren = false;
- } else {
- if (delta.getKind() == IResourceDelta.ADDED) {
- log.debug("Visiting added resource " + delta.getResource().getName());
- visitAdded(delta.getResource());
- } else if (delta.getKind() == IResourceDelta.CHANGED) {
- log.debug("Visiting changed resource " + delta.getResource().getName());
- visitChanged(delta.getResource());
- } else { // other kinds are not visited
- log.debug("Resource " + delta.getResource().getName() + " not visited.");
- }
- }
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED : {
+ log.debug("Visiting added resource " + delta.getResource().getName());
+ visitAdded(delta.getResource());
+ break;
+ }
+ case IResourceDelta.CHANGED : {
+ log.debug("Visiting changed resource " + delta.getResource().getName());
+ visitChanged(delta.getResource());
+ break;
+ }
+ default : { // other kinds are not visited
+ log.debug("Resource " + delta.getResource().getName() + " not visited.");
+ }
+ }
- return fProcessChildren;
+ return true;
}
/**
* Visit added resource
* @param resource a new resource
*/
- private void visitAdded(final IResource resource) {
- this.reviewResource(resource);
+ private void visitAdded(IResource resource) {
+ reviewResource(resource);
}
/**
@@ -67,7 +71,7 @@ private void visitAdded(final IResource resource) {
* @param resource a changed resource
*/
private void visitChanged(final IResource resource) {
- this.reviewResource(resource);
+ reviewResource(resource);
}
}
\ No newline at end of file
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/MarkerInfo.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/MarkerInfo.java
deleted file mode 100644
index f33e622b4e1..00000000000
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/MarkerInfo.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * <copyright>
- * Copyright 1997-2003 PMD for Eclipse Development team
- * under sponsorship of the Defense Advanced Research Projects
- * Agency (DARPA).
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the Cougaar Open Source License as published by
- * DARPA on the Cougaar Open Source Website (www.cougaar.org).
- *
- * THE COUGAAR SOFTWARE AND ANY DERIVATIVE SUPPLIED BY LICENSOR IS
- * PROVIDED "AS IS" WITHOUT WARRANTIES OF ANY KIND, WHETHER EXPRESS OR
- * IMPLIED, INCLUDING (BUT NOT LIMITED TO) ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, AND WITHOUT
- * ANY WARRANTIES AS TO NON-INFRINGEMENT. IN NO EVENT SHALL COPYRIGHT
- * HOLDER BE LIABLE FOR ANY DIRECT, SPECIAL, INDIRECT OR CONSEQUENTIAL
- * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE OF DATA OR PROFITS,
- * TORTIOUS CONDUCT, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THE COUGAAR SOFTWARE.
- *
- * </copyright>
- */
-package net.sourceforge.pmd.eclipse.runtime.cmd;
-
-/**
- * This class is intended to hold informations for future marker creation.
- *
- * @author Philippe Herlin
- *
- */
-public class MarkerInfo {
-
- private final String type;
- private String[] attributeNames;
- private Object[] attributeValues;
-
- public MarkerInfo(String theType) {
- type = theType;
- }
- /**
- * @return
- */
- public String[] getAttributeNames() {
- return attributeNames;
- }
-
- /**
- * @return
- */
- public Object[] getAttributeValues() {
- return attributeValues;
- }
-
- /**
- * @return
- */
- public String getType() {
- return type;
- }
-
- /**
- * @param strings
- */
- public void setAttributeNames(String[] strings) {
- attributeNames = strings;
- }
-
- /**
- * @param objects
- */
- public void setAttributeValues(Object[] objects) {
- attributeValues = objects;
- }
-
-}
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/MarkerInfo2.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/MarkerInfo2.java
new file mode 100644
index 00000000000..72cb7387191
--- /dev/null
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/MarkerInfo2.java
@@ -0,0 +1,40 @@
+package net.sourceforge.pmd.eclipse.runtime.cmd;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ *
+ * @author Brian Remedios
+ */
+public class MarkerInfo2 {
+
+ private final String type;
+ private List<String> names;
+ private List<Object> values;
+
+ public MarkerInfo2(String theType, int expectedSize) {
+ type = theType;
+ names = new ArrayList<String>(expectedSize);
+ values = new ArrayList<Object>(expectedSize);
+ }
+
+ public void add(String name, Object value) {
+ names.add(name);
+ values.add(value);
+ }
+
+ public void add(String name, int value) {
+ add(name, Integer.valueOf(value));
+ }
+
+ public void addAsMarkerTo(IFile file) throws CoreException {
+
+ IMarker marker = file.createMarker(type);
+ marker.setAttributes(names.toArray(new String[names.size()]), values.toArray());
+ }
+}
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/ReviewCodeCmd.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/ReviewCodeCmd.java
index 9e3007d056b..28a3b7ac940 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/ReviewCodeCmd.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/cmd/ReviewCodeCmd.java
@@ -52,6 +52,7 @@
import net.sourceforge.pmd.eclipse.runtime.properties.IProjectProperties;
import net.sourceforge.pmd.eclipse.runtime.properties.PropertiesException;
import net.sourceforge.pmd.eclipse.ui.actions.RuleSetUtil;
+import net.sourceforge.pmd.lang.Language;
import org.apache.log4j.Logger;
import org.eclipse.core.resources.IContainer;
@@ -91,7 +92,7 @@ public class ReviewCodeCmd extends AbstractDefaultCommand {
private final List<ISchedulingRule> resources = new ArrayList<ISchedulingRule>();
private IResourceDelta resourceDelta;
- private Map<IFile, Set<MarkerInfo>> markersByFile = new HashMap<IFile, Set<MarkerInfo>>();
+ private Map<IFile, Set<MarkerInfo2>> markersByFile = new HashMap<IFile, Set<MarkerInfo2>>();
private boolean taskMarker;
private boolean openPmdPerspective;
private int ruleCount;
@@ -231,7 +232,7 @@ public void run() {
/**
* @return Returns the file markers
*/
- public Map<IFile, Set<MarkerInfo>> getMarkers() {
+ public Map<IFile, Set<MarkerInfo2>> getMarkers() {
return markersByFile;
}
@@ -284,7 +285,7 @@ public void setOpenPmdPerspective(boolean openPmdPerspective) {
@Override
public void reset() {
resources.clear();
- markersByFile = new HashMap<IFile, Set<MarkerInfo>>();
+ markersByFile = new HashMap<IFile, Set<MarkerInfo2>>();
setTerminated(false);
openPmdPerspective = false;
onErrorIssue = null;
@@ -518,11 +519,10 @@ private void applyMarkers() {
if (isCanceled()) break;
currentFile = file.getName();
- Set<MarkerInfo> markerInfoSet = markersByFile.get(file);
+ Set<MarkerInfo2> markerInfoSet = markersByFile.get(file);
// MarkerUtil.deleteAllMarkersIn(file);
- for (MarkerInfo markerInfo : markerInfoSet) {
- IMarker marker = file.createMarker(markerInfo.getType());
- marker.setAttributes(markerInfo.getAttributeNames(), markerInfo.getAttributeValues());
+ for (MarkerInfo2 markerInfo : markerInfoSet) {
+ markerInfo.addAsMarkerTo(file);
violationCount++;
}
@@ -537,7 +537,6 @@ private void applyMarkers() {
logInfo("" + violationCount + " markers applied on " + count + " files in " + timer.getDuration() + "ms.");
log.info("End of processing marker directives. " + violationCount + " violations for " + count + " files.");
}
-
}
/**
@@ -581,7 +580,7 @@ private int countDeltaElement(IResourceDelta delta) {
*
* @author SebastianRaffel ( 07.05.2005 )
*/
- private void switchToPmdPerspective() {
+ private static void switchToPmdPerspective() {
final IWorkbench workbench = PlatformUI.getWorkbench();
final IPerspectiveRegistry reg = workbench.getPerspectiveRegistry();
final IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
@@ -598,7 +597,7 @@ public boolean visit(final IResource resource) {
boolean fVisitChildren = true;
count++;
- if (resource instanceof IFile && isJavaFile((IFile) resource)) {
+ if (resource instanceof IFile && isLanguageFile((IFile) resource, Language.JAVA)) {
fVisitChildren = false;
}
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/preferences/impl/PreferencesManagerImpl.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/preferences/impl/PreferencesManagerImpl.java
index cc9f1463102..a26a51b1b91 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/preferences/impl/PreferencesManagerImpl.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/runtime/preferences/impl/PreferencesManagerImpl.java
@@ -515,17 +515,19 @@ private void updateConfiguredProjects(RuleSet updatedRuleSet) {
*/
private void storeRuleSetInStateLocation(RuleSet ruleSet) {
OutputStream out = null;
+ PMDPlugin plugin = PMDPlugin.getDefault();
+
try {
- IPath ruleSetLocation = PMDPlugin.getDefault().getStateLocation().append(PREFERENCE_RULESET_FILE);
+ IPath ruleSetLocation = plugin.getStateLocation().append(PREFERENCE_RULESET_FILE);
out = new FileOutputStream(ruleSetLocation.toOSString());
- IRuleSetWriter writer = PMDPlugin.getDefault().getRuleSetWriter();
+ IRuleSetWriter writer = plugin.getRuleSetWriter();
writer.write(out, ruleSet);
out.flush();
} catch (IOException e) {
- PMDPlugin.getDefault().logError("IO Exception when storing ruleset in state location", e);
+ plugin.logError("IO Exception when storing ruleset in state location", e);
} catch (WriterException e) {
- PMDPlugin.getDefault().logError("General PMD Eclipse Exception when storing ruleset in state location", e);
+ plugin.logError("General PMD Eclipse Exception when storing ruleset in state location", e);
} finally {
IOUtil.closeQuietly(out);
}
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/filters/FilterPreferencesPage.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/filters/FilterPreferencesPage.java
index 2ee8105bcb2..599183b921a 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/filters/FilterPreferencesPage.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/filters/FilterPreferencesPage.java
@@ -68,7 +68,8 @@ public class FilterPreferencesPage extends AbstractPMDPreferencePage implements
private Button pmdButt;
private Text patternField;
private BasicTableManager reportTableMgr;
-
+ private Collection<Control> editorWidgets = new ArrayList<Control>();
+
private static Image IncludeIcon;
private static Image ExcludeIcon;
@@ -172,11 +173,10 @@ private FilterHolder[] currentFilters() {
}
private void enableEditor(boolean flag) {
- cpdButt.setEnabled(flag);
- pmdButt.setEnabled(flag);
- excludeButt.setEnabled(flag);
- includeButt.setEnabled(flag);
- patternField.setEnabled(flag);
+
+ for (Control control : editorWidgets) {
+ control.setEnabled(flag);
+ }
}
private List<String> tableFilters(boolean isInclude) {
@@ -229,9 +229,7 @@ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { }
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- selectedPatterns(filtersIn(selection.toList()));
- updateControls();
+ patternsSelected();
}
});
@@ -246,6 +244,12 @@ public void handleEvent(Event event) {
return parent;
}
+ private void patternsSelected() {
+ IStructuredSelection selection = (IStructuredSelection)tableViewer.getSelection();
+ selectedPatterns(filtersIn(selection.toList()));
+ updateControls();
+ }
+
private void selectedPatterns(Collection<FilterHolder> holders) {
setState(holders, includeButt, FilterHolder.IncludeAccessor);
@@ -304,7 +308,8 @@ private void buildFilterEditor(Composite parent) {
Label typeLabel = new Label(editorPanel, SWT.None);
typeLabel.setLayoutData( new GridData());
typeLabel.setText("Type:");
-
+ editorWidgets.add(typeLabel);
+
excludeButt = createButton(editorPanel, SWT.RADIO, excludeIcon(), "Exclude");
excludeButt.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
@@ -321,10 +326,14 @@ public void widgetSelected(SelectionEvent se) {
}
});
+ editorWidgets.add(excludeButt);
+ editorWidgets.add(includeButt);
+
Label contextLabel = new Label(editorPanel, SWT.None);
contextLabel.setLayoutData( new GridData());
contextLabel.setText("Applies to:");
-
+ editorWidgets.add(contextLabel);
+
pmdButt = createButton(editorPanel, SWT.CHECK, "PMD");
pmdButt.addSelectionListener( new SelectionAdapter() {
public void widgetSelected(SelectionEvent se) {
@@ -341,10 +350,14 @@ public void widgetSelected(SelectionEvent se) {
}
});
+ editorWidgets.add(pmdButt);
+ editorWidgets.add(cpdButt);
+
Label patternLabel = new Label(editorPanel, SWT.None);
patternLabel.setLayoutData( new GridData());
patternLabel.setText("Pattern:");
-
+ editorWidgets.add(patternLabel);
+
patternField = new Text(editorPanel, SWT.BORDER);
patternField.setLayoutData( new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1) );
patternField.addFocusListener(new FocusAdapter() {
@@ -353,6 +366,15 @@ public void focusLost(FocusEvent fe) {
tableViewer.refresh();
}
});
+ editorWidgets.add(patternField);
+
+ Label spacer = new Label(editorPanel, SWT.None);
+ spacer.setLayoutData( new GridData() );
+ Label description = new Label(editorPanel, SWT.None);
+ description.setLayoutData( new GridData(GridData.FILL, GridData.BEGINNING, true, false, 2, 1) );
+ description.setText("name or path pattern (* = any string, ? = any character)");
+
+ editorWidgets.add(description);
}
/**
@@ -535,7 +557,14 @@ private FilterHolder[] tableFiltersWith(FilterHolder anotherOne) {
private void addNewFilter() {
FilterHolder newHolder = new FilterHolder(NewFilterPattern, true, false, false);
- tableViewer.setInput( tableFiltersWith(newHolder) );
+
+ FilterHolder[] holders = tableFiltersWith(newHolder);
+ tableViewer.setInput( holders );
+
+ tableViewer.getTable().select(holders.length-1);
+ patternsSelected();
+ patternField.selectAll();
+ patternField.forceFocus();
}
/**
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/preferences/br/RuleTableManager.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/preferences/br/RuleTableManager.java
index b6973a4ada1..43a7a74975f 100755
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/preferences/br/RuleTableManager.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/preferences/br/RuleTableManager.java
@@ -84,7 +84,7 @@ public class RuleTableManager extends AbstractTreeTableManager<Rule> implements
private MenuItem useDefaultsItem;
private Button addRuleButton;
private Button removeRuleButton;
-
+ private Button exportRuleSetButton;
private RuleSelectionListener ruleSelectionListener;
private ValueResetHandler resetHandler;
@@ -312,22 +312,46 @@ private Button buildExportRuleSetButton(final Composite parent) {
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
- FileDialog dialog = new FileDialog(parent.getShell(), SWT.SAVE);
- String fileName = dialog.open();
- if (fileName != null) {
- try {
- exportTo(fileName, parent.getShell());
- } catch (Exception e) {
- plugin.showError(getMessage(StringKeys.ERROR_EXPORTING_RULESET), e);
- }
- }
+ exportSelectedRules();
}
-
});
return button;
}
+ private void exportSelectedRules() {
+
+ Shell shell = treeViewer.getTree().getShell();
+
+ FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+ dialog.setText("Export " + ruleSelection.allRules().size() + " rules");
+
+ String fileName = dialog.open();
+ if (StringUtil.isNotEmpty(fileName)) {
+ try {
+ exportTo(fileName, shell);
+ } catch (Exception e) {
+ plugin.showError(getMessage(StringKeys.ERROR_EXPORTING_RULESET), e);
+ }
+ }
+ }
+
+ private RuleSet ruleSelectionAsRuleSet() {
+
+ RuleSet rs = new RuleSet();
+ rs.setName( ruleSet.getName() );
+ rs.setDescription( ruleSet.getDescription() );
+ rs.setFileName( ruleSet.getFileName());
+ rs.addExcludePatterns( ruleSet.getExcludePatterns() );
+ rs.addIncludePatterns( ruleSet.getIncludePatterns() );
+
+ for (Rule rule : ruleSelection.allRules()) {
+ rs.addRule(rule);
+ }
+
+ return rs;
+ }
+
private void exportTo(String fileName, Shell shell) throws FileNotFoundException, WriterException, IOException {
File file = new File(fileName);
@@ -340,7 +364,12 @@ private void exportTo(String fileName, Shell shell) throws FileNotFoundException
}
InputDialog input = null;
+
+ RuleSet ruleSet = null;
+
if (flContinue) {
+ ruleSet = ruleSelectionAsRuleSet();
+
input = new InputDialog(shell,
getMessage(StringKeys.PREF_RULESET_DIALOG_TITLE),
getMessage(StringKeys.PREF_RULESET_DIALOG_RULESET_DESCRIPTION),
@@ -466,6 +495,8 @@ private void doImport(RuleSet selectedRuleSet, boolean doByReference) {
} catch (RuntimeException e) {
plugin.showError(getMessage(StringKeys.ERROR_IMPORTING_RULESET), e);
}
+
+ updateCheckControls();
}
public Composite buildGroupCombo(Composite parent, String comboLabelKey, final Object[][] groupingChoices) {
@@ -541,7 +572,7 @@ public Composite buildRuleTableButtons(Composite parent) {
addRuleButton = buildAddRuleButton(composite);
removeRuleButton = buildRemoveRuleButton(composite);
Button importRuleSetButton = buildImportRuleSetButton(composite);
- Button exportRuleSetButton = buildExportRuleSetButton(composite);
+ exportRuleSetButton = buildExportRuleSetButton(composite);
Button ruleDesignerButton = buildRuleDesignerButton(composite);
GridData data = new GridData();
@@ -865,7 +896,10 @@ protected void selectedItems(Object[] items) {
ruleSelectionListener.selection(ruleSelection);
}
- if (removeRuleButton != null) removeRuleButton.setEnabled(items.length > 0);
+ boolean hasSelections = items.length > 0;
+
+ if (removeRuleButton != null) removeRuleButton.setEnabled(hasSelections);
+ if (exportRuleSetButton != null) exportRuleSetButton.setEnabled(hasSelections);
}
private class SelectionStats {
@@ -892,7 +926,7 @@ private SelectionStats selectionRatioIn(Rule[] rules) {
if (StringUtil.isNotEmpty(rule.dysfunctionReason())) dysfunctionCount++;
}
}
- return new SelectionStats(selectedCount , rules.length, dysfunctionCount) ;
+ return new SelectionStats(selectedCount, rules.length, dysfunctionCount) ;
}
protected void setAllItemsActive() {
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/views/actions/DisableRuleAction.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/views/actions/DisableRuleAction.java
index 68eb9739adc..4eb722bf734 100755
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/views/actions/DisableRuleAction.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/views/actions/DisableRuleAction.java
@@ -12,6 +12,11 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.TableViewer;
public class DisableRuleAction extends AbstractViolationSelectionAction {
@@ -53,21 +58,41 @@ private void removeViolationsOf(List<Rule> rules, Set<IProject> projects) {
System.out.println("Violations deleted: " + deletions);
}
+ private List<Rule> disableRulesFor(IMarker[] markers) {
+
+ List<Rule> rules = MarkerUtil.rulesFor(markers);
+
+ for (Rule rule : rules) {
+ preferences.isActive(rule.getName(), false);
+ }
+
+ preferences.sync();
+ return rules;
+ }
+
/**
* @see org.eclipse.jface.action.IAction#run()
*/
public void run() {
final IMarker[] markers = getSelectedViolations();
- if (markers == null) return;
+ if (markers == null) return;
- List<Rule> rules = MarkerUtil.rulesFor(markers);
- for (Rule rule : rules) {
- preferences.isActive(rule.getName(), false);
+ try {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ workspace.run(new IWorkspaceRunnable() {
+ public void run(IProgressMonitor monitor) throws CoreException {
+ List<Rule> rules = disableRulesFor(markers);
+ removeViolationsOf(rules, MarkerUtil.commonProjectsOf(markers) );
+ }
+ }, null);
+ } catch (CoreException ce) {
+ logErrorByKey(StringKeys.ERROR_CORE_EXCEPTION, ce);
}
- preferences.sync();
- removeViolationsOf(rules, MarkerUtil.commonProjectsOf(markers) );
+
+
+
}
}
diff --git a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/views/actions/ReviewAction.java b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/views/actions/ReviewAction.java
index 55a39cb3acc..aab3eabba6b 100644
--- a/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/views/actions/ReviewAction.java
+++ b/pmd-eclipse-plugin/plugins/net.sourceforge.pmd.eclipse.plugin/src/net/sourceforge/pmd/eclipse/ui/views/actions/ReviewAction.java
@@ -37,6 +37,7 @@
*
*/
public class ReviewAction extends AbstractViolationSelectionAction {
+
private static final Logger log = Logger.getLogger(ReviewAction.class);
private IProgressMonitor monitor;
@@ -64,13 +65,7 @@ public void run() {
// Get confirmation if multiple markers are selected
// Not necessary when using PMD style
- boolean go = true;
- if (markers.length > 1 && !reviewPmdStyle) {
- String title = getString(StringKeys.CONFIRM_TITLE);
- String message = getString(StringKeys.CONFIRM_REVIEW_MULTIPLE_MARKERS);
- Shell shell = Display.getCurrent().getActiveShell();
- go = MessageDialog.openConfirm(shell, title, message);
- }
+ boolean go = confirmForMultiples(markers, reviewPmdStyle);
// If only one marker selected or user has confirmed, review violation
if (go) {
@@ -92,6 +87,17 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte
}
}
+ private static boolean confirmForMultiples(IMarker[] markers, boolean reviewPmdStyle) {
+ boolean go = true;
+ if (markers.length > 1 && !reviewPmdStyle) {
+ String title = getString(StringKeys.CONFIRM_TITLE);
+ String message = getString(StringKeys.CONFIRM_REVIEW_MULTIPLE_MARKERS);
+ Shell shell = Display.getCurrent().getActiveShell();
+ go = MessageDialog.openConfirm(shell, title, message);
+ }
+ return go;
+ }
+
/**
* Do the insertion of the review comment
*
@@ -111,11 +117,9 @@ protected void insertReview(IMarker marker, boolean reviewPmdStyle) {
monitorWorked();
- if (reviewPmdStyle) {
- sourceCode = addPmdReviewComment(sourceCode, offset, marker);
- } else {
- sourceCode = addPluginReviewComment(sourceCode, offset, marker);
- }
+ sourceCode = reviewPmdStyle ?
+ addPmdReviewComment(sourceCode, offset, marker) :
+ addPluginReviewComment(sourceCode, offset, marker);
monitorWorked();
@@ -129,18 +133,8 @@ protected void insertReview(IMarker marker, boolean reviewPmdStyle) {
}
}
- } catch (JavaModelException e) {
- IJavaModelStatus status = e.getJavaModelStatus();
- PMDPlugin.getDefault().logError(status);
- log.warn("Ignoring Java Model Exception : " + status.getMessage());
- if (log.isDebugEnabled()) {
- log.debug(" code : " + status.getCode());
- log.debug(" severity : " + status.getSeverity());
- IJavaElement[] elements = status.getElements();
- for (int i = 0; i < elements.length; i++) {
- log.debug(" element : " + elements[i].getElementName() + " (" + elements[i].getElementType() + ')');
- }
- }
+ } catch (JavaModelException jme) {
+ ignore(jme);
} catch (CoreException e) {
logErrorByKey(StringKeys.ERROR_CORE_EXCEPTION, e);
} catch (IOException e) {
@@ -148,6 +142,21 @@ protected void insertReview(IMarker marker, boolean reviewPmdStyle) {
}
}
+ private static void ignore(JavaModelException jme) {
+
+ IJavaModelStatus status = jme.getJavaModelStatus();
+ PMDPlugin.getDefault().logError(status);
+ log.warn("Ignoring Java Model Exception : " + status.getMessage());
+ if (log.isDebugEnabled()) {
+ log.debug(" code : " + status.getCode());
+ log.debug(" severity : " + status.getSeverity());
+ IJavaElement[] elements = status.getElements();
+ for (int i = 0; i < elements.length; i++) {
+ log.debug(" element : " + elements[i].getElementName() + " (" + elements[i].getElementType() + ')');
+ }
+ }
+ }
+
/**
* Get the monitor
*
@@ -178,7 +187,7 @@ private void monitorWorked() {
/**
* Renvoie la position dans le code source du début de la ligne du marqueur
*/
- private int getMarkerLineStart(String sourceCode, int lineNumber) {
+ private static int getMarkerLineStart(String sourceCode, int lineNumber) {
int lineStart = 0;
int currentLine = 1;
for (lineStart = 0; lineStart < sourceCode.length(); lineStart++) {
@@ -209,7 +218,7 @@ public static String additionalCommentTxt() {
/**
* Insert a review comment with the Plugin style
*/
- private String addPluginReviewComment(String sourceCode, int offset, IMarker marker) {
+ private static String addPluginReviewComment(String sourceCode, int offset, IMarker marker) {
// Copy the source code until the violation line not included
StringBuilder sb = new StringBuilder(sourceCode.substring(0, offset));
@@ -230,7 +239,7 @@ private String addPluginReviewComment(String sourceCode, int offset, IMarker mar
/**
* Insert a review comment with the PMD style
*/
- private String addPmdReviewComment(String sourceCode, int offset, IMarker marker) {
+ private static String addPmdReviewComment(String sourceCode, int offset, IMarker marker) {
String result = sourceCode;
// Find the end of line
@@ -297,4 +306,4 @@ public static String readFile(IFile file) throws IOException, CoreException {
}
}
-}
+}
\ No newline at end of file
|
736169aa2a46f489cd8e75cf4d61cef997fc456f
|
spring-framework
|
revised WebApplicationContext lookup--
|
p
|
https://github.com/spring-projects/spring-framework
|
diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java
index fed2015a4a71..8859e88a7c37 100644
--- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java
+++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/support/RequestContextUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
package org.springframework.web.servlet.support;
import java.util.Locale;
-
import javax.servlet.ServletContext;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
@@ -79,10 +78,7 @@ public static WebApplicationContext getWebApplicationContext(
if (servletContext == null) {
throw new IllegalStateException("No WebApplicationContext found: not in a DispatcherServlet request?");
}
- webApplicationContext = WebApplicationContextUtils.getWebApplicationContext(servletContext);
- if (webApplicationContext == null) {
- throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
- }
+ webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext);
}
return webApplicationContext;
}
diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java
index 809468636854..96aec8fbd6dc 100644
--- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java
+++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/AbstractSpringPreparerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,16 +16,15 @@
package org.springframework.web.servlet.view.tiles2;
-import javax.servlet.ServletRequest;
-
import org.apache.tiles.TilesException;
import org.apache.tiles.context.TilesRequestContext;
import org.apache.tiles.preparer.PreparerFactory;
import org.apache.tiles.preparer.ViewPreparer;
-import org.apache.tiles.servlet.context.ServletTilesApplicationContext;
+import org.apache.tiles.servlet.context.ServletTilesRequestContext;
import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.servlet.support.RequestContextUtils;
+import org.springframework.web.context.support.WebApplicationContextUtils;
+import org.springframework.web.servlet.DispatcherServlet;
/**
* Abstract implementation of the Tiles2 {@link org.apache.tiles.preparer.PreparerFactory}
@@ -41,20 +40,24 @@
public abstract class AbstractSpringPreparerFactory implements PreparerFactory {
public ViewPreparer getPreparer(String name, TilesRequestContext context) throws TilesException {
- ServletRequest servletRequest = null;
- if (context.getRequest() instanceof ServletRequest) {
- servletRequest = (ServletRequest) context.getRequest();
- }
- ServletTilesApplicationContext tilesApplicationContext = null;
- if (context instanceof ServletTilesApplicationContext) {
- tilesApplicationContext = (ServletTilesApplicationContext) context;
- }
- if (servletRequest == null && tilesApplicationContext == null) {
- throw new IllegalStateException("SpringBeanPreparerFactory requires either a " +
- "ServletRequest or a ServletTilesApplicationContext to operate on");
+ WebApplicationContext webApplicationContext = (WebApplicationContext) context.getRequestScope().get(
+ DispatcherServlet.WEB_APPLICATION_CONTEXT_ATTRIBUTE);
+ if (webApplicationContext == null) {
+ /* as of Tiles 2.1:
+ webApplicationContext = (WebApplicationContext) context.getApplicationContext().getApplicationScope().get(
+ WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
+ if (webApplicationContext == null) {
+ throw new IllegalStateException("No WebApplicationContext found: no ContextLoaderListener registered?");
+ }
+ */
+ if (!(context instanceof ServletTilesRequestContext)) {
+ throw new IllegalStateException(
+ getClass().getSimpleName() + " requires a ServletTilesRequestContext to operate on");
+ }
+ ServletTilesRequestContext servletRequestContext = (ServletTilesRequestContext) context;
+ webApplicationContext = WebApplicationContextUtils.getRequiredWebApplicationContext(
+ servletRequestContext.getServletContext());
}
- WebApplicationContext webApplicationContext = RequestContextUtils.getWebApplicationContext(
- servletRequest, tilesApplicationContext.getServletContext());
return getPreparer(name, webApplicationContext);
}
diff --git a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/SpringBeanPreparerFactory.java b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/SpringBeanPreparerFactory.java
index 3216059f8e73..527177951c94 100644
--- a/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/SpringBeanPreparerFactory.java
+++ b/org.springframework.web.servlet/src/main/java/org/springframework/web/servlet/view/tiles2/SpringBeanPreparerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2007 the original author or authors.
+ * Copyright 2002-2009 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,7 +36,7 @@ public class SpringBeanPreparerFactory extends AbstractSpringPreparerFactory {
@Override
protected ViewPreparer getPreparer(String name, WebApplicationContext context) throws TilesException {
- return (ViewPreparer) context.getBean(name, ViewPreparer.class);
+ return context.getBean(name, ViewPreparer.class);
}
}
|
bba004602c091dbb5c1da4b7a1d05a0ef4e55c42
|
Delta Spike
|
fix old TODO and use field injection of Extension.
|
c
|
https://github.com/apache/deltaspike
|
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/HandlerMethodStorageProducer.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/HandlerMethodStorageProducer.java
index 4b1ea0f4f..2f5743549 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/HandlerMethodStorageProducer.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/exception/control/HandlerMethodStorageProducer.java
@@ -18,23 +18,22 @@
*/
package org.apache.deltaspike.core.impl.exception.control;
-import org.apache.deltaspike.core.api.provider.BeanProvider;
import org.apache.deltaspike.core.impl.exception.control.extension.ExceptionControlExtension;
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
+import javax.inject.Inject;
@ApplicationScoped
public class HandlerMethodStorageProducer
{
+ @Inject
+ private ExceptionControlExtension exceptionControlExtension;
+
@Produces
@ApplicationScoped
protected HandlerMethodStorage createHandlerMethodStorage()
{
- //X TODO change it back to parameter injection after fixing the test-setup for ExcludeIntegrationTest
- ExceptionControlExtension exceptionControlExtension =
- BeanProvider.getContextualReference(ExceptionControlExtension.class);
-
return new HandlerMethodStorageImpl(exceptionControlExtension.getAllExceptionHandlers());
}
}
|
92b6087d67805d4f7787bd9cf4591ffe5d912ae1
|
bendisposto$prob
|
first version of the theory plugin (supports operators only)
|
a
|
https://github.com/hhu-stups/prob-rodinplugin
|
diff --git a/de.prob.core/src/de/prob/core/domainobjects/eval/ExpressionEvalElement.java b/de.prob.core/src/de/prob/core/domainobjects/eval/ExpressionEvalElement.java
index 59f50c99..e321a394 100644
--- a/de.prob.core/src/de/prob/core/domainobjects/eval/ExpressionEvalElement.java
+++ b/de.prob.core/src/de/prob/core/domainobjects/eval/ExpressionEvalElement.java
@@ -9,6 +9,7 @@
import java.util.LinkedList;
import org.eventb.core.ast.Expression;
+import org.eventb.core.ast.FormulaFactory;
import de.be4.classicalb.core.parser.BParser;
import de.be4.classicalb.core.parser.exceptions.BException;
@@ -28,7 +29,7 @@ public static ExpressionEvalElement fromRodin(final Expression expression)
String message = "Expression input must not be null";
throw new BException("", new NullPointerException(message));
}
- ExpressionVisitor ev = new ExpressionVisitor(new LinkedList<String>());
+ ExpressionVisitor ev = new ExpressionVisitor(new LinkedList<String>(),FormulaFactory.getDefault(),FormulaFactory.getDefault().makeTypeEnvironment());
expression.accept(ev);
AExpressionParseUnit epu = new AExpressionParseUnit(ev.getExpression());
Start start = new Start(epu, new EOF());
diff --git a/de.prob.core/src/de/prob/core/langdep/EventBAnimatorPart.java b/de.prob.core/src/de/prob/core/langdep/EventBAnimatorPart.java
index c19e65af..1863472a 100644
--- a/de.prob.core/src/de/prob/core/langdep/EventBAnimatorPart.java
+++ b/de.prob.core/src/de/prob/core/langdep/EventBAnimatorPart.java
@@ -70,7 +70,7 @@ public void parseExpression(final IPrologTermOutput pto,
final Expression ee = parseResult.getParsedExpression();
typeCheck(ff, ee);
final ExpressionVisitor visitor = new ExpressionVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(), ff, ff.makeTypeEnvironment());
ee.accept(visitor);
toPrologTerm(pto, visitor.getExpression(), wrap, EXPR_WRAPPER);
}
@@ -86,7 +86,7 @@ public void parsePredicate(final IPrologTermOutput pto,
final Predicate pp = parseResult.getParsedPredicate();
typeCheck(ff, pp);
final PredicateVisitor visitor = new PredicateVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(), ff, ff.makeTypeEnvironment());
pp.accept(visitor);
toPrologTerm(pto, visitor.getPredicate(), wrap, PRED_WRAPPER);
}
@@ -276,7 +276,8 @@ private void printTransPred(final IPrologTermOutput pto,
pto.printAtom(eventName);
if (predicate != null) {
final PredicateVisitor visitor = new PredicateVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(), FormulaFactory.getDefault(),
+ FormulaFactory.getDefault().makeTypeEnvironment());
predicate.accept(visitor);
final ASTProlog prolog = new ASTProlog(pto, null);
visitor.getPredicate().apply(prolog);
diff --git a/de.prob.core/src/de/prob/eventb/translator/AssignmentVisitor.java b/de.prob.core/src/de/prob/eventb/translator/AssignmentVisitor.java
index a27ce9ff..135239a0 100644
--- a/de.prob.core/src/de/prob/eventb/translator/AssignmentVisitor.java
+++ b/de.prob.core/src/de/prob/eventb/translator/AssignmentVisitor.java
@@ -15,8 +15,10 @@
import org.eventb.core.ast.BecomesMemberOf;
import org.eventb.core.ast.BecomesSuchThat;
import org.eventb.core.ast.Expression;
+import org.eventb.core.ast.FormulaFactory;
import org.eventb.core.ast.FreeIdentifier;
import org.eventb.core.ast.ISimpleVisitor;
+import org.eventb.core.ast.ITypeEnvironment;
import org.eventb.core.ast.Predicate;
import de.be4.classicalb.core.parser.node.AAssignSubstitution;
@@ -33,6 +35,13 @@ public class AssignmentVisitor extends SimpleVisitorAdapter implements
private PSubstitution sub;
private boolean substitutonSet = false;
+ private final FormulaFactory ff;
+ private final ITypeEnvironment typeEnvironment;
+
+ public AssignmentVisitor(FormulaFactory ff, ITypeEnvironment typeEnvironment) {
+ this.ff = ff;
+ this.typeEnvironment = typeEnvironment;
+ }
public PSubstitution getSubstitution() {
return sub;
@@ -64,7 +73,7 @@ private List<PExpression> createListOfExpressions(
final List<PExpression> list = new ArrayList<PExpression>();
for (Expression e : expressions) {
final ExpressionVisitor visitor = new ExpressionVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(),ff,typeEnvironment);
e.accept(visitor);
list.add(visitor.getExpression());
}
@@ -94,7 +103,7 @@ public void visitBecomesMemberOf(final BecomesMemberOf assignment) {
final Expression set = assignment.getSet();
final ExpressionVisitor visitor = new ExpressionVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(),ff,typeEnvironment);
set.accept(visitor);
becomesElementOfSubstitution
@@ -112,7 +121,7 @@ public void visitBecomesSuchThat(final BecomesSuchThat assignment) {
list.addFirst(f.getName() + "'");
}
final Predicate predicate = assignment.getCondition();
- final PredicateVisitor visitor = new PredicateVisitor(list);
+ final PredicateVisitor visitor = new PredicateVisitor(list,ff,typeEnvironment);
predicate.accept(visitor);
final ABecomesSuchSubstitution becomesSuchSubstitution = new ABecomesSuchSubstitution();
becomesSuchSubstitution
diff --git a/de.prob.core/src/de/prob/eventb/translator/ContextTranslator.java b/de.prob.core/src/de/prob/eventb/translator/ContextTranslator.java
index 9ea99009..aa39cc77 100644
--- a/de.prob.core/src/de/prob/eventb/translator/ContextTranslator.java
+++ b/de.prob.core/src/de/prob/eventb/translator/ContextTranslator.java
@@ -318,7 +318,7 @@ private List<PPredicate> extractPredicates(final ISCAxiom[] predicates,
continue;
}
final PredicateVisitor visitor = new PredicateVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(),ff,te);
element.getPredicate(ff, te).accept(visitor);
final PPredicate predicate = visitor.getPredicate();
list.add(predicate);
diff --git a/de.prob.core/src/de/prob/eventb/translator/ExpressionVisitor.java b/de.prob.core/src/de/prob/eventb/translator/ExpressionVisitor.java
index 131de23f..dddcece6 100644
--- a/de.prob.core/src/de/prob/eventb/translator/ExpressionVisitor.java
+++ b/de.prob.core/src/de/prob/eventb/translator/ExpressionVisitor.java
@@ -22,13 +22,20 @@
import org.eventb.core.ast.Expression;
import org.eventb.core.ast.ExtendedExpression;
import org.eventb.core.ast.Formula;
+import org.eventb.core.ast.FormulaFactory;
import org.eventb.core.ast.FreeIdentifier;
import org.eventb.core.ast.ISimpleVisitor;
+import org.eventb.core.ast.ITypeEnvironment;
import org.eventb.core.ast.IntegerLiteral;
import org.eventb.core.ast.Predicate;
import org.eventb.core.ast.QuantifiedExpression;
import org.eventb.core.ast.SetExtension;
import org.eventb.core.ast.UnaryExpression;
+import org.eventb.core.ast.extension.IExpressionExtension;
+import org.eventb.core.ast.extension.IPredicateExtension;
+import org.eventb.core.ast.extension.datatype.ITypeParameter;
+import org.eventb.internal.core.ast.extension.datatype.Datatype;
+import org.eventb.theory.core.TheoryElement;
import de.be4.classicalb.core.parser.node.AAddExpression;
import de.be4.classicalb.core.parser.node.ABoolSetExpression;
@@ -113,6 +120,8 @@ public class ExpressionVisitor extends SimpleVisitorAdapter implements // NOPMD
private final LinkedList<String> bounds; // NOPMD bendisposto
// we need some abilities of the linked list, using List is not an option
private boolean expressionSet = false;
+ private FormulaFactory ff;
+ private ITypeEnvironment typeEnvironment;
@SuppressWarnings("unused")
private ExpressionVisitor() { // we want to prevent clients from calling
@@ -121,9 +130,12 @@ private ExpressionVisitor() { // we want to prevent clients from calling
throw new AssertionError("Do not call this constructor");
}
- public ExpressionVisitor(final LinkedList<String> bounds) { // NOPMD
+ public ExpressionVisitor(final LinkedList<String> bounds,
+ FormulaFactory ff, ITypeEnvironment typeEnvironment) { // NOPMD
super();
this.bounds = bounds;
+ this.ff = ff;
+ this.typeEnvironment = typeEnvironment;
}
public PExpression getExpression() {
@@ -147,7 +159,8 @@ public void visitQuantifiedExpression(final QuantifiedExpression expression) {
final BoundIdentDecl[] decls = expression.getBoundIdentDecls();
for (final BoundIdentDecl boundIdentDecl : decls) {
- final ExpressionVisitor visitor = new ExpressionVisitor(bounds);
+ final ExpressionVisitor visitor = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
boundIdentDecl.accept(visitor);
ev.add(visitor);
bounds.addFirst(boundIdentDecl.getName());
@@ -161,13 +174,14 @@ public void visitQuantifiedExpression(final QuantifiedExpression expression) {
// Process internal Expression and Predcate
final Predicate predicate = expression.getPredicate();
- final PredicateVisitor predicateVisitor = new PredicateVisitor(bounds);
+ final PredicateVisitor predicateVisitor = new PredicateVisitor(bounds,
+ ff, typeEnvironment);
predicate.accept(predicateVisitor);
final PPredicate pr = predicateVisitor.getPredicate();
final ExpressionVisitor expressionVisitor = new ExpressionVisitor(
- bounds);
+ bounds, ff, typeEnvironment);
expression.getExpression().accept(expressionVisitor);
final PExpression ex = expressionVisitor.getExpression();
@@ -212,7 +226,8 @@ public void visitAssociativeExpression(
final LinkedList<ExpressionVisitor> ev = new LinkedList<ExpressionVisitor>();
for (final Expression ex : children) {
- final ExpressionVisitor e = new ExpressionVisitor(bounds);
+ final ExpressionVisitor e = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
ev.add(e);
ex.accept(e);
}
@@ -335,8 +350,10 @@ private PExpression recurseBCOMP(final List<ExpressionVisitor> list) {
// this long method is far easier to read than smaller ones
public void visitBinaryExpression(final BinaryExpression expression) { // NOPMD
final int tag = expression.getTag();
- final ExpressionVisitor visitorLeft = new ExpressionVisitor(bounds);
- final ExpressionVisitor visitorRight = new ExpressionVisitor(bounds);
+ final ExpressionVisitor visitorLeft = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
+ final ExpressionVisitor visitorRight = new ExpressionVisitor(bounds,
+ ff, typeEnvironment);
expression.getLeft().accept(visitorLeft);
expression.getRight().accept(visitorRight);
final PExpression exL = visitorLeft.getExpression();
@@ -563,7 +580,8 @@ public void visitAtomicExpression(final AtomicExpression expression) { // NOPMD
@Override
public void visitBoolExpression(final BoolExpression expression) {
final AConvertBoolExpression convertBoolExpression = new AConvertBoolExpression();
- final PredicateVisitor visitor = new PredicateVisitor(bounds);
+ final PredicateVisitor visitor = new PredicateVisitor(bounds, ff,
+ typeEnvironment);
expression.getPredicate().accept(visitor);
convertBoolExpression.setPredicate(visitor.getPredicate());
setExpression(convertBoolExpression);
@@ -613,7 +631,8 @@ public void visitSetExtension(final SetExtension expression) {
final ASetExtensionExpression setExtensionExpression = new ASetExtensionExpression();
final List<PExpression> list = new ArrayList<PExpression>();
for (final Expression e : members) {
- final ExpressionVisitor visitor = new ExpressionVisitor(bounds);
+ final ExpressionVisitor visitor = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
e.accept(visitor);
list.add(visitor.getExpression());
}
@@ -624,28 +643,36 @@ public void visitSetExtension(final SetExtension expression) {
@Override
public void visitExtendedExpression(ExtendedExpression expression) {
AExtendedExprExpression p = new AExtendedExprExpression();
- String symbol = expression.getExtension().getSyntaxSymbol();
+
+ IExpressionExtension extension = expression.getExtension();
+ String symbol = extension.getSyntaxSymbol();
+ Object origin = extension.getOrigin();
+
+
+ Theories.add(symbol, origin, ff, typeEnvironment);
+
p.setIdentifier(new TIdentifierLiteral(symbol));
Expression[] expressions = expression.getChildExpressions();
List<PExpression> childExprs = new ArrayList<PExpression>();
for (Expression e : expressions) {
- ExpressionVisitor v = new ExpressionVisitor(null);
+ ExpressionVisitor v = new ExpressionVisitor(
+ new LinkedList<String>(), ff, typeEnvironment);
e.accept(v);
childExprs.add(v.getExpression());
}
p.setExpressions(childExprs);
-
+
Predicate[] childPredicates = expression.getChildPredicates();
List<PPredicate> childPreds = new ArrayList<PPredicate>();
for (Predicate pd : childPredicates) {
- PredicateVisitor v = new PredicateVisitor(null);
+ PredicateVisitor v = new PredicateVisitor(null, ff, typeEnvironment);
pd.accept(v);
childPreds.add(v.getPredicate());
}
p.setPredicates(childPreds);
-
+
setExpression(p);
-
+
}
@SuppressWarnings("deprecation")
@@ -654,7 +681,8 @@ public void visitUnaryExpression(final UnaryExpression expression) { // NOPMD
// by
// bendisposto
final int tag = expression.getTag();
- final ExpressionVisitor visitor = new ExpressionVisitor(bounds);
+ final ExpressionVisitor visitor = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
expression.getChild().accept(visitor);
final PExpression exp = visitor.getExpression();
diff --git a/de.prob.core/src/de/prob/eventb/translator/PredicateVisitor.java b/de.prob.core/src/de/prob/eventb/translator/PredicateVisitor.java
index 98731cdc..1e922e40 100644
--- a/de.prob.core/src/de/prob/eventb/translator/PredicateVisitor.java
+++ b/de.prob.core/src/de/prob/eventb/translator/PredicateVisitor.java
@@ -17,7 +17,9 @@
import org.eventb.core.ast.Expression;
import org.eventb.core.ast.ExtendedPredicate;
import org.eventb.core.ast.Formula;
+import org.eventb.core.ast.FormulaFactory;
import org.eventb.core.ast.ISimpleVisitor;
+import org.eventb.core.ast.ITypeEnvironment;
import org.eventb.core.ast.LiteralPredicate;
import org.eventb.core.ast.MultiplePredicate;
import org.eventb.core.ast.Predicate;
@@ -25,6 +27,8 @@
import org.eventb.core.ast.RelationalPredicate;
import org.eventb.core.ast.SimplePredicate;
import org.eventb.core.ast.UnaryPredicate;
+import org.eventb.core.ast.extension.IPredicateExtension;
+import org.eventb.theory.core.TheoryElement;
import de.be4.classicalb.core.parser.node.AConjunctPredicate;
import de.be4.classicalb.core.parser.node.ADisjunctPredicate;
@@ -67,6 +71,10 @@ public class PredicateVisitor extends SimpleVisitorAdapter implements // NOPMD
private boolean predicateSet = false;
+ private final FormulaFactory ff;
+
+ private final ITypeEnvironment typeEnvironment;
+
public PPredicate getPredicate() {
return p;
}
@@ -79,22 +87,28 @@ public void setPredicate(final PPredicate p) {
predicateSet = true;
this.p = p;
}
- //public ClassifiedPragma(String name, Node attachedTo, List<String> arguments, List<String> warnings, SourcePosition start, SourcePosition end) {
-
- // new ClassifiedPragma("discharged", p, proof, Collections.emptyList(), new SourcePosition(-1, -1), new SourcePosition(-1, -1));
+ // public ClassifiedPragma(String name, Node attachedTo, List<String>
+ // arguments, List<String> warnings, SourcePosition start,
+ // SourcePosition end) {
+
+ // new ClassifiedPragma("discharged", p, proof, Collections.emptyList(),
+ // new SourcePosition(-1, -1), new SourcePosition(-1, -1));
+ }
+
+ public PredicateVisitor() {
+ this(null, null, null);
}
- public PredicateVisitor(final LinkedList<String> bounds) {
+ public PredicateVisitor(LinkedList<String> bounds, FormulaFactory ff,
+ ITypeEnvironment localEnv) {
super();
if (bounds == null) {
this.bounds = new LinkedList<String>();
} else {
this.bounds = bounds;
}
- }
-
- public PredicateVisitor() {
- this(null);
+ this.ff = ff;
+ this.typeEnvironment = localEnv;
}
@Override
@@ -106,7 +120,8 @@ public void visitQuantifiedPredicate(final QuantifiedPredicate predicate) {
final List<ExpressionVisitor> ev = new LinkedList<ExpressionVisitor>();
final BoundIdentDecl[] decls = predicate.getBoundIdentDecls();
for (final BoundIdentDecl boundIdentDecl : decls) {
- final ExpressionVisitor visitor = new ExpressionVisitor(bounds);
+ final ExpressionVisitor visitor = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
boundIdentDecl.accept(visitor);
ev.add(visitor);
bounds.addFirst(boundIdentDecl.getName());
@@ -119,7 +134,8 @@ public void visitQuantifiedPredicate(final QuantifiedPredicate predicate) {
}
// Recursively analyze the predicate (important, bounds are already set)
- final PredicateVisitor predicateVisitor = new PredicateVisitor(bounds);
+ final PredicateVisitor predicateVisitor = new PredicateVisitor(bounds,
+ ff, typeEnvironment);
predicate.getPredicate().accept(predicateVisitor);
switch (tag) {
@@ -164,7 +180,8 @@ public void visitAssociativePredicate(final AssociativePredicate predicate) {
final LinkedList<PredicateVisitor> pv = new LinkedList<PredicateVisitor>();
for (final Predicate pr : children) {
- final PredicateVisitor p = new PredicateVisitor(bounds);
+ final PredicateVisitor p = new PredicateVisitor(bounds, ff,
+ typeEnvironment);
pv.add(p);
pr.accept(p);
}
@@ -227,9 +244,11 @@ private PPredicate recurseEQV(final List<PredicateVisitor> list) {
public void visitBinaryPredicate(final BinaryPredicate predicate) {
final int tag = predicate.getTag();
- final PredicateVisitor subLeft = new PredicateVisitor(bounds);
+ final PredicateVisitor subLeft = new PredicateVisitor(bounds, ff,
+ typeEnvironment);
predicate.getLeft().accept(subLeft);
- final PredicateVisitor subRight = new PredicateVisitor(bounds);
+ final PredicateVisitor subRight = new PredicateVisitor(bounds, ff,
+ typeEnvironment);
predicate.getRight().accept(subRight);
switch (tag) {
@@ -271,9 +290,11 @@ public void visitRelationalPredicate(final RelationalPredicate predicate) { // N
// High complexity is ok
// EQUAL, NOTEQUAL, LT, LE, GT, GE, IN, NOTIN, SUBSET,
// NOTSUBSET, SUBSETEQ, NOTSUBSETEQ
- final ExpressionVisitor subLeft = new ExpressionVisitor(bounds);
+ final ExpressionVisitor subLeft = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
predicate.getLeft().accept(subLeft);
- final ExpressionVisitor subRight = new ExpressionVisitor(bounds);
+ final ExpressionVisitor subRight = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
predicate.getRight().accept(subRight);
final int tag = predicate.getTag();
@@ -366,7 +387,8 @@ public void visitSimplePredicate(final SimplePredicate predicate) {
throw new AssertionError(UNCOVERED_PREDICATE);
}
final AFinitePredicate finite = new AFinitePredicate();
- final ExpressionVisitor subEx = new ExpressionVisitor(bounds);
+ final ExpressionVisitor subEx = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
predicate.getExpression().accept(subEx);
finite.setSet(subEx.getExpression());
setPredicate(finite);
@@ -378,7 +400,8 @@ public void visitUnaryPredicate(final UnaryPredicate predicate) {
throw new AssertionError(UNCOVERED_PREDICATE);
}
final ANegationPredicate negationPredicate = new ANegationPredicate();
- final PredicateVisitor sub = new PredicateVisitor(bounds);
+ final PredicateVisitor sub = new PredicateVisitor(bounds, ff,
+ typeEnvironment);
predicate.getChild().accept(sub);
negationPredicate.setPredicate(sub.getPredicate());
setPredicate(negationPredicate);
@@ -390,7 +413,8 @@ public void visitMultiplePredicate(final MultiplePredicate predicate) {
final List<PExpression> expressions = new ArrayList<PExpression>(
subs.length);
for (Expression e : subs) {
- final ExpressionVisitor sub = new ExpressionVisitor(bounds);
+ final ExpressionVisitor sub = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
e.accept(sub);
expressions.add(sub.getExpression());
}
@@ -412,22 +436,28 @@ public void visitMultiplePredicate(final MultiplePredicate predicate) {
@Override
public void visitExtendedPredicate(ExtendedPredicate predicate) {
AExtendedPredPredicate p = new AExtendedPredPredicate();
- String symbol = predicate.getExtension().getSyntaxSymbol();
+ IPredicateExtension extension = predicate.getExtension();
+ String symbol = extension.getSyntaxSymbol();
+ Object origin = extension.getOrigin();
+ Theories.add(symbol, origin, ff, typeEnvironment);
+
p.setIdentifier(new TIdentifierLiteral(symbol));
Expression[] expressions = predicate.getChildExpressions();
List<PExpression> childExprs = new ArrayList<PExpression>();
for (Expression e : expressions) {
- ExpressionVisitor v = new ExpressionVisitor(null);
+ ExpressionVisitor v = new ExpressionVisitor(bounds, ff,
+ typeEnvironment);
e.accept(v);
childExprs.add(v.getExpression());
}
p.setExpressions(childExprs);
-
+
Predicate[] childPredicates = predicate.getChildPredicates();
List<PPredicate> childPreds = new ArrayList<PPredicate>();
for (Predicate pd : childPredicates) {
- PredicateVisitor v = new PredicateVisitor(null);
+ PredicateVisitor v = new PredicateVisitor(bounds, ff,
+ typeEnvironment);
pd.accept(v);
childPreds.add(v.getPredicate());
}
@@ -435,9 +465,4 @@ public void visitExtendedPredicate(ExtendedPredicate predicate) {
setPredicate(p);
}
-
-
-
-
-
}
diff --git a/de.prob.core/src/de/prob/eventb/translator/Theories.java b/de.prob.core/src/de/prob/eventb/translator/Theories.java
new file mode 100644
index 00000000..71df6777
--- /dev/null
+++ b/de.prob.core/src/de/prob/eventb/translator/Theories.java
@@ -0,0 +1,219 @@
+package de.prob.eventb.translator;
+
+import java.util.LinkedList;
+import java.util.Set;
+import java.util.Stack;
+
+import org.apache.commons.lang.NotImplementedException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eventb.core.ast.Expression;
+import org.eventb.core.ast.Formula;
+import org.eventb.core.ast.FormulaFactory;
+import org.eventb.core.ast.FreeIdentifier;
+import org.eventb.core.ast.GivenType;
+import org.eventb.core.ast.ITypeEnvironment;
+import org.eventb.core.ast.PowerSetType;
+import org.eventb.core.ast.Predicate;
+import org.eventb.core.ast.extension.IExpressionExtension;
+import org.eventb.core.basis.PORoot;
+import org.eventb.internal.core.ast.extension.datatype.Datatype;
+import org.eventb.internal.core.pog.POGStateRepository;
+import org.eventb.internal.core.tool.state.StateRepository;
+import org.eventb.theory.core.IDeployedTheoryRoot;
+import org.eventb.theory.core.ISCDirectOperatorDefinition;
+import org.eventb.theory.core.ISCNewOperatorDefinition;
+import org.eventb.theory.core.ISCOperatorArgument;
+import org.eventb.theory.core.ISCRecursiveDefinitionCase;
+import org.eventb.theory.core.ISCRecursiveOperatorDefinition;
+import org.eventb.theory.core.TheoryElement;
+import org.rodinp.core.RodinDBException;
+
+import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog;
+import de.be4.classicalb.core.parser.node.PExpression;
+import de.be4.classicalb.core.parser.node.PPredicate;
+import de.prob.prolog.output.IPrologTermOutput;
+
+public class Theories {
+
+ private static Stack<TranslateTheory> theories = new Stack<TranslateTheory>();
+
+ public static final ITypeEnvironment global_te = FormulaFactory
+ .getDefault().makeTypeEnvironment();
+
+ private static final class TranslateTheory {
+ public final ITypeEnvironment te;
+ public final FormulaFactory ff;
+ public final TheoryElement theory;
+ private final String name;
+
+ public TranslateTheory(String name, TheoryElement theory,
+ FormulaFactory ff, ITypeEnvironment te) {
+ this.name = name;
+ this.theory = theory;
+ this.ff = ff;
+ this.te = te;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof TranslateTheory) {
+ TranslateTheory that = (TranslateTheory) obj;
+ return this.theory.equals(that.theory);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return theory.hashCode();
+ }
+
+ @Override
+ public String toString() {
+ return "OP: " + name;
+ }
+ }
+
+ public static void add(String name, Object t, FormulaFactory ff,
+ ITypeEnvironment te) {
+ if (t instanceof TheoryElement) {
+ TheoryElement tx = (TheoryElement) t;
+ theories.push(new TranslateTheory(name, tx, ff, te));
+ }
+ if (t instanceof Datatype) {
+ Datatype dt = (Datatype) t;
+
+
+
+
+
+
+
+ Set<IExpressionExtension> constructors = dt.getConstructors();
+ for (IExpressionExtension c : constructors) {
+ String symbol = c.getSyntaxSymbol();
+ Object origin = c.getOrigin();
+ System.out.println(origin.getClass());
+
+ }
+ }
+ }
+
+ public static void translate(IPrologTermOutput pto) throws RodinDBException {
+ while (!theories.isEmpty()) {
+ TranslateTheory theory = theories.pop();
+ printTranslation(theory, pto);
+ }
+ }
+
+ private static void printTranslation(TranslateTheory t,
+ IPrologTermOutput pto) throws RodinDBException {
+
+ if (t.theory instanceof ISCNewOperatorDefinition) {
+ printOperator(t.name, (ISCNewOperatorDefinition) t.theory, t.ff,
+ t.te, pto);
+ return;
+ }
+
+ throw new NotImplementedException(
+ "Implementation missing for theory type "
+ + t.getClass().getSimpleName());
+
+ }
+
+ private static void printOperator(String name,
+ ISCNewOperatorDefinition theory, FormulaFactory ff,
+ ITypeEnvironment te, IPrologTermOutput prologOutput)
+ throws RodinDBException {
+
+ prologOutput.openTerm("operator");
+ prologOutput.printAtom(name);
+
+ // Arguments
+ prologOutput.openList();
+ ISCOperatorArgument[] operatorArguments = theory.getOperatorArguments();
+ for (ISCOperatorArgument argument : operatorArguments) {
+ FreeIdentifier identifier = argument.getIdentifier(ff);
+ te.add(identifier);
+ String arg = identifier.getName();
+ Expression type = identifier.getType().toExpression(ff);
+ prologOutput.openTerm("argument");
+ prologOutput.printAtom(arg);
+ printExpression(ff, te, prologOutput, type);
+ prologOutput.closeTerm();
+ }
+ prologOutput.closeList();
+
+ ITypeEnvironment environment = ff.makeTypeEnvironment();
+
+ environment.addAll(global_te);
+ environment.addAll(te);
+
+ // WD Condition
+ Predicate wdCondition = theory.getWDCondition(ff, environment);
+ printPredicate(ff, environment, prologOutput, wdCondition);
+
+ // Direct Definitions
+ prologOutput.openList();
+ processDefinitions(ff, environment, prologOutput,
+ theory.getDirectOperatorDefinitions());
+ prologOutput.closeList();
+
+ // Recursive Definitions
+ prologOutput.openList();
+ ISCRecursiveOperatorDefinition[] definitions = theory
+ .getRecursiveOperatorDefinitions();
+ for (ISCRecursiveOperatorDefinition definition : definitions) {
+ ISCRecursiveDefinitionCase[] recursiveDefinitionCases = definition
+ .getRecursiveDefinitionCases();
+ for (ISCRecursiveDefinitionCase c : recursiveDefinitionCases) {
+ Expression ex = c.getExpression(ff, environment);
+ printExpression(ff, environment, prologOutput, ex);
+ }
+ }
+ prologOutput.closeList();
+
+ prologOutput.closeTerm();
+ }
+
+ private static void processDefinitions(FormulaFactory ff,
+ ITypeEnvironment te, IPrologTermOutput prologOutput,
+ ISCDirectOperatorDefinition[] directOperatorDefinitions)
+ throws RodinDBException {
+ for (ISCDirectOperatorDefinition def : directOperatorDefinitions) {
+ Formula scFormula = def.getSCFormula(ff, te);
+
+ if (scFormula instanceof Predicate) {
+ Predicate pp = (Predicate) scFormula;
+ printPredicate(ff, te, prologOutput, pp);
+ }
+ if (scFormula instanceof Expression) {
+ Expression pp = (Expression) scFormula;
+ printExpression(ff, te, prologOutput, pp);
+ }
+
+ }
+ }
+
+ private static void printExpression(FormulaFactory ff, ITypeEnvironment te,
+ IPrologTermOutput prologOutput, Expression pp) {
+ ExpressionVisitor visitor = new ExpressionVisitor(
+ new LinkedList<String>(), ff, te);
+ pp.accept(visitor);
+ PExpression ex = visitor.getExpression();
+ ASTProlog pv = new ASTProlog(prologOutput, null);
+ ex.apply(pv);
+ }
+
+ private static void printPredicate(FormulaFactory ff, ITypeEnvironment te,
+ IPrologTermOutput prologOutput, Predicate pp) {
+ PredicateVisitor visitor = new PredicateVisitor(
+ new LinkedList<String>(), ff, te);
+ pp.accept(visitor);
+ PPredicate predicate = visitor.getPredicate();
+ ASTProlog pv = new ASTProlog(prologOutput, null);
+ predicate.apply(pv);
+ }
+
+}
diff --git a/de.prob.core/src/de/prob/eventb/translator/TranslatorFactory.java b/de.prob.core/src/de/prob/eventb/translator/TranslatorFactory.java
index 6e018094..8f7d0c95 100644
--- a/de.prob.core/src/de/prob/eventb/translator/TranslatorFactory.java
+++ b/de.prob.core/src/de/prob/eventb/translator/TranslatorFactory.java
@@ -34,10 +34,6 @@ public class TranslatorFactory {
public static void translate(final IEventBRoot root,
final IPrologTermOutput pto) throws TranslationFailedException {
-
-
-
-
if (root instanceof IMachineRoot) {
final ISCMachineRoot scRoot = ((IMachineRoot) root)
.getSCMachineRoot();
diff --git a/de.prob.core/src/de/prob/eventb/translator/flow/FlowAnalysis.java b/de.prob.core/src/de/prob/eventb/translator/flow/FlowAnalysis.java
index 7ea22f90..5da4e45f 100644
--- a/de.prob.core/src/de/prob/eventb/translator/flow/FlowAnalysis.java
+++ b/de.prob.core/src/de/prob/eventb/translator/flow/FlowAnalysis.java
@@ -55,7 +55,7 @@ public void printGraph(final IPrologTermOutput pout) {
pout.printAtom(evt.toString());
pout.openList();
final Predicate predicate = evt.getGuardsAfterAssignment();
- PredicateVisitor pv = new PredicateVisitor(new LinkedList<String>());
+ PredicateVisitor pv = new PredicateVisitor(new LinkedList<String>(),FF,typeEnvironment);
predicate.accept(pv);
PPredicate p = pv.getPredicate();
p.apply(prolog);
diff --git a/de.prob.core/src/de/prob/eventb/translator/flow/WeakestPrecondition.java b/de.prob.core/src/de/prob/eventb/translator/flow/WeakestPrecondition.java
index 2f5ccfda..38c5e50f 100644
--- a/de.prob.core/src/de/prob/eventb/translator/flow/WeakestPrecondition.java
+++ b/de.prob.core/src/de/prob/eventb/translator/flow/WeakestPrecondition.java
@@ -2,6 +2,7 @@
import java.util.LinkedList;
+import org.eventb.core.ast.FormulaFactory;
import org.eventb.core.ast.Predicate;
import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog;
@@ -48,7 +49,9 @@ public void getSyntaxTree(final IPrologTermOutput pout) {
pout.openList();
// pout.openTerm("entry");
// pout.printAtom(ReverseTranslate.reverseTranslate(p.toString()));
- PredicateVisitor pv = new PredicateVisitor(new LinkedList<String>());
+ PredicateVisitor pv = new PredicateVisitor(new LinkedList<String>(),
+ FormulaFactory.getDefault(), FormulaFactory.getDefault()
+ .makeTypeEnvironment());
wps.accept(pv);
PPredicate predicate = pv.getPredicate();
predicate.apply(prolog);
diff --git a/de.prob.core/src/de/prob/eventb/translator/internal/EventBTranslator.java b/de.prob.core/src/de/prob/eventb/translator/internal/EventBTranslator.java
index 54eb5661..b3452f62 100644
--- a/de.prob.core/src/de/prob/eventb/translator/internal/EventBTranslator.java
+++ b/de.prob.core/src/de/prob/eventb/translator/internal/EventBTranslator.java
@@ -27,6 +27,7 @@
import de.prob.core.translator.TranslationFailedException;
import de.prob.eventb.translator.AbstractComponentTranslator;
import de.prob.eventb.translator.ContextTranslator;
+import de.prob.eventb.translator.Theories;
import de.prob.prolog.output.IPrologTermOutput;
public abstract class EventBTranslator implements ITranslator {
@@ -143,6 +144,11 @@ protected void printProlog(
pout.openList();
printProofInformation(refinementChainTranslators, contextTranslators,
pout);
+ try {
+ Theories.translate(pout);
+ } catch (RodinDBException e) {
+ e.printStackTrace();
+ }
pout.closeList();
pout.printVariable("_Error");
pout.closeTerm();
diff --git a/de.prob.core/src/de/prob/eventb/translator/internal/ModelTranslator.java b/de.prob.core/src/de/prob/eventb/translator/internal/ModelTranslator.java
index 75137456..661f598c 100644
--- a/de.prob.core/src/de/prob/eventb/translator/internal/ModelTranslator.java
+++ b/de.prob.core/src/de/prob/eventb/translator/internal/ModelTranslator.java
@@ -252,7 +252,7 @@ private AVariantModelClause processVariant() throws RodinDBException,
final AVariantModelClause var;
if (variant.length == 1) {
final ExpressionVisitor visitor = new ExpressionVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(),ff,te);
variant[0].getExpression(ff, te).accept(visitor);
var = new AVariantModelClause(visitor.getExpression());
} else if (variant.length == 0) {
@@ -391,7 +391,7 @@ private void extractGuards(final ISCEvent revent,
final ISCGuard[] guards = revent.getSCGuards();
for (final ISCGuard guard : guards) {
final PredicateVisitor visitor = new PredicateVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(),ff,localEnv);
final Predicate guardPredicate = guard.getPredicate(ff, localEnv);
// System.out.println("GUARD: " + guard.getLabel() + " -> "
// + guardPredicate);
@@ -432,7 +432,7 @@ private List<PWitness> extractWitnesses(final ISCEvent revent,
witnesses.length);
for (final ISCWitness witness : witnesses) {
final PredicateVisitor visitor = new PredicateVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(),ff,localEnv);
final Predicate pp = witness.getPredicate(ff, localEnv);
pp.accept(visitor);
final PPredicate predicate = visitor.getPredicate();
@@ -449,7 +449,7 @@ private List<PSubstitution> extractActions(final ISCEvent revent,
final ISCAction[] actions = revent.getSCActions();
final List<PSubstitution> actionList = new ArrayList<PSubstitution>();
for (final ISCAction action : actions) {
- final AssignmentVisitor visitor = new AssignmentVisitor();
+ final AssignmentVisitor visitor = new AssignmentVisitor(ff,localEnv);
action.getAssignment(ff, localEnv).accept(visitor);
final PSubstitution substitution = visitor.getSubstitution();
actionList.add(substitution);
@@ -499,7 +499,7 @@ private List<PPredicate> getPredicateList(final ISCInvariant[] predicates,
// level, not in an abstract machine
if (!isDefinedInAbstraction(evPredicate)) {
final PredicateVisitor visitor = new PredicateVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(),ff,te);
evPredicate.getPredicate(ff, te).accept(visitor);
final PPredicate predicate = visitor.getPredicate();
list.add(predicate);
diff --git a/de.prob.core/src/de/prob/sap/util/FormulaUtils.java b/de.prob.core/src/de/prob/sap/util/FormulaUtils.java
index 551c1292..70c607f3 100644
--- a/de.prob.core/src/de/prob/sap/util/FormulaUtils.java
+++ b/de.prob.core/src/de/prob/sap/util/FormulaUtils.java
@@ -5,6 +5,7 @@
import java.util.LinkedList;
+import org.eventb.core.ast.FormulaFactory;
import org.eventb.core.ast.Predicate;
import de.be4.classicalb.core.parser.analysis.prolog.ASTProlog;
@@ -28,7 +29,7 @@ public final class FormulaUtils {
static public void printPredicate(final Predicate predicate,
final IPrologTermOutput pto) {
final PredicateVisitor visitor = new PredicateVisitor(
- new LinkedList<String>());
+ new LinkedList<String>(),FormulaFactory.getDefault(), FormulaFactory.getDefault().makeTypeEnvironment());
predicate.accept(visitor);
final PPredicate probPredicate = visitor.getPredicate();
final ASTProlog prolog = new ASTProlog(pto, null);
|
785d41a37f6c311084ebf2d23e83f4ceb4bb94ed
|
jhy$jsoup
|
Moved .wrap, .before, and .after from Element to Node for flexibility.
|
p
|
https://github.com/jhy/jsoup
|
diff --git a/src/main/java/org/jsoup/nodes/Element.java b/src/main/java/org/jsoup/nodes/Element.java
index 45fa23dbf4..2008195208 100644
--- a/src/main/java/org/jsoup/nodes/Element.java
+++ b/src/main/java/org/jsoup/nodes/Element.java
@@ -303,37 +303,31 @@ public Element prepend(String html) {
addChildren(0, fragment.childNodesAsArray());
return this;
}
-
+
/**
* Insert the specified HTML into the DOM before this element (i.e. as a preceeding sibling).
+ *
* @param html HTML to add before this element
* @return this element, for chaining
* @see #after(String)
*/
+ @Override
public Element before(String html) {
- addSiblingHtml(siblingIndex(), html);
- return this;
+ return (Element) super.before(html);
}
-
+
/**
* Insert the specified HTML into the DOM after this element (i.e. as a following sibling).
+ *
* @param html HTML to add after this element
* @return this element, for chaining
* @see #before(String)
*/
+ @Override
public Element after(String html) {
- addSiblingHtml(siblingIndex()+1, html);
- return this;
- }
-
- private void addSiblingHtml(int index, String html) {
- Validate.notNull(html);
- Validate.notNull(parentNode);
-
- Element fragment = Parser.parseBodyFragmentRelaxed(html, baseUri()).body();
- parentNode.addChildren(index, fragment.childNodesAsArray());
+ return (Element) super.after(html);
}
-
+
/**
* Remove all of the element's child nodes. Any attributes are left as-is.
* @return this element
@@ -344,42 +338,16 @@ public Element empty() {
}
/**
- Wrap the supplied HTML around this element.
- @param html HTML to wrap around this element, e.g. {@code <div class="head"></div>}. Can be arbitralily deep.
- @return this element, for chaining.
+ * Wrap the supplied HTML around this element.
+ *
+ * @param html HTML to wrap around this element, e.g. {@code <div class="head"></div>}. Can be arbitrarily deep.
+ * @return this element, for chaining.
*/
+ @Override
public Element wrap(String html) {
- Validate.notEmpty(html);
-
- Element wrapBody = Parser.parseBodyFragmentRelaxed(html, baseUri).body();
- Elements wrapChildren = wrapBody.children();
- Element wrap = wrapChildren.first();
- if (wrap == null) // nothing to wrap with; noop
- return null;
-
- Element deepest = getDeepChild(wrap);
- parentNode.replaceChild(this, wrap);
- deepest.addChildren(this);
-
- // remainder (unbalananced wrap, like <div></div><p></p> -- The <p> is remainder
- if (wrapChildren.size() > 1) {
- for (int i = 1; i < wrapChildren.size(); i++) { // skip first
- Element remainder = wrapChildren.get(i);
- remainder.parentNode.removeChild(remainder);
- wrap.appendChild(remainder);
- }
- }
- return this;
+ return (Element) super.wrap(html);
}
- private Element getDeepChild(Element el) {
- List<Element> children = el.children();
- if (children.size() > 0)
- return getDeepChild(children.get(0));
- else
- return el;
- }
-
/**
* Get sibling elements.
* @return sibling elements
diff --git a/src/main/java/org/jsoup/nodes/Node.java b/src/main/java/org/jsoup/nodes/Node.java
index 136de50806..ec6d6bf952 100644
--- a/src/main/java/org/jsoup/nodes/Node.java
+++ b/src/main/java/org/jsoup/nodes/Node.java
@@ -2,6 +2,8 @@
import org.jsoup.helper.StringUtil;
import org.jsoup.helper.Validate;
+import org.jsoup.parser.Parser;
+import org.jsoup.select.Elements;
import org.jsoup.select.NodeTraversor;
import org.jsoup.select.NodeVisitor;
@@ -230,6 +232,73 @@ public void remove() {
Validate.notNull(parentNode);
parentNode.removeChild(this);
}
+
+ /**
+ * Insert the specified HTML into the DOM before this node (i.e. as a preceeding sibling).
+ * @param html HTML to add before this element
+ * @return this node, for chaining
+ * @see #after(String)
+ */
+ public Node before(String html) {
+ addSiblingHtml(siblingIndex(), html);
+ return this;
+ }
+
+ /**
+ * Insert the specified HTML into the DOM after this node (i.e. as a following sibling).
+ * @param html HTML to add after this element
+ * @return this node, for chaining
+ * @see #before(String)
+ */
+ public Node after(String html) {
+ addSiblingHtml(siblingIndex()+1, html);
+ return this;
+ }
+
+ private void addSiblingHtml(int index, String html) {
+ Validate.notNull(html);
+ Validate.notNull(parentNode);
+
+ Element fragment = Parser.parseBodyFragmentRelaxed(html, baseUri()).body();
+ parentNode.addChildren(index, fragment.childNodesAsArray());
+ }
+
+ /**
+ Wrap the supplied HTML around this node.
+ @param html HTML to wrap around this element, e.g. {@code <div class="head"></div>}. Can be arbitrarily deep.
+ @return this node, for chaining.
+ */
+ public Node wrap(String html) {
+ Validate.notEmpty(html);
+
+ Element wrapBody = Parser.parseBodyFragmentRelaxed(html, baseUri).body();
+ Elements wrapChildren = wrapBody.children();
+ Element wrap = wrapChildren.first();
+ if (wrap == null) // nothing to wrap with; noop
+ return null;
+
+ Element deepest = getDeepChild(wrap);
+ parentNode.replaceChild(this, wrap);
+ deepest.addChildren(this);
+
+ // remainder (unbalanced wrap, like <div></div><p></p> -- The <p> is remainder
+ if (wrapChildren.size() > 1) {
+ for (int i = 1; i < wrapChildren.size(); i++) { // skip first
+ Element remainder = wrapChildren.get(i);
+ remainder.parentNode.removeChild(remainder);
+ wrap.appendChild(remainder);
+ }
+ }
+ return this;
+ }
+
+ private Element getDeepChild(Element el) {
+ List<Element> children = el.children();
+ if (children.size() > 0)
+ return getDeepChild(children.get(0));
+ else
+ return el;
+ }
/**
* Replace this node in the DOM with the supplied node.
diff --git a/src/test/java/org/jsoup/nodes/TextNodeTest.java b/src/test/java/org/jsoup/nodes/TextNodeTest.java
index abf93dbaf3..b91684775c 100644
--- a/src/test/java/org/jsoup/nodes/TextNodeTest.java
+++ b/src/test/java/org/jsoup/nodes/TextNodeTest.java
@@ -56,4 +56,14 @@ public class TextNodeTest {
assertEquals("Hello there!", div.text());
assertTrue(tn.parent() == tail.parent());
}
+
+ @Test public void testSplitAnEmbolden() {
+ Document doc = Jsoup.parse("<div>Hello there</div>");
+ Element div = doc.select("div").first();
+ TextNode tn = (TextNode) div.childNode(0);
+ TextNode tail = tn.splitText(6);
+ tail.wrap("<b></b>");
+
+ assertEquals("Hello <b>there</b>", TextUtil.stripNewlines(div.html())); // not great that we get \n<b>there there... must correct
+ }
}
|
0dd95079938476608211f34c414b90f9eca45f77
|
camel
|
CAMEL-1712 Upgraded the camel-ibatis to JUnit4--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@785119 13f79535-47bb-0310-9956-ffa450edef68-
|
p
|
https://github.com/apache/camel
|
diff --git a/components/camel-ibatis/pom.xml b/components/camel-ibatis/pom.xml
index e512bfbff1e42..d243937f4e6e0 100644
--- a/components/camel-ibatis/pom.xml
+++ b/components/camel-ibatis/pom.xml
@@ -57,8 +57,7 @@
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- <type>test-jar</type>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisBatchConsumerTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisBatchConsumerTest.java
index c8869b8c8e4ea..c9ba157fd8338 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisBatchConsumerTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisBatchConsumerTest.java
@@ -19,12 +19,14 @@
import org.apache.camel.Exchange;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class IBatisBatchConsumerTest extends IBatisTestSupport {
+ @Test
public void testBatchConsumer() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(2);
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisPollingDelayRouteTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisPollingDelayRouteTest.java
index c6845708750d1..6bf1ef0aaf749 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisPollingDelayRouteTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisPollingDelayRouteTest.java
@@ -19,15 +19,19 @@
import java.sql.Connection;
import java.sql.Statement;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* @version $Revision$
*/
-public class IBatisPollingDelayRouteTest extends ContextTestSupport {
+public class IBatisPollingDelayRouteTest extends CamelTestSupport {
+ @Test
public void testSendAccountBean() throws Exception {
createTestData();
@@ -67,7 +71,8 @@ public void configure() throws Exception {
}
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// lets create the database...
@@ -78,7 +83,8 @@ protected void setUp() throws Exception {
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
Connection connection = createConnection();
Statement statement = connection.createStatement();
statement.execute("drop table ACCOUNT");
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForDeleteTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForDeleteTest.java
index 2b2327d0d7d13..953bfb04cba74 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForDeleteTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForDeleteTest.java
@@ -18,12 +18,14 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class IBatisQueryForDeleteTest extends IBatisTestSupport {
+ @Test
public void testDelete() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
@@ -42,7 +44,8 @@ public void testDelete() throws Exception {
rows = template.requestBody("ibatis:count?statementType=QueryForObject", null, Integer.class);
assertEquals("There should be 0 rows", 0, rows.intValue());
}
-
+
+ @Test
public void testDeleteNotFound() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForInsertTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForInsertTest.java
index 3a0d6e58ada09..b232df1c05cb1 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForInsertTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForInsertTest.java
@@ -18,12 +18,14 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class IBatisQueryForInsertTest extends IBatisTestSupport {
+ @Test
public void testInsert() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListTest.java
index 4286be054de30..ffdd7883105de 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListTest.java
@@ -20,12 +20,14 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class IBatisQueryForListTest extends IBatisTestSupport {
+ @Test
public void testQueryForList() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListWithSplitTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListWithSplitTest.java
index e6d1883088eae..c74ad19e7cd27 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListWithSplitTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForListWithSplitTest.java
@@ -18,12 +18,14 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class IBatisQueryForListWithSplitTest extends IBatisTestSupport {
+ @Test
public void testQueryForList() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(2);
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForObjectTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForObjectTest.java
index b5e8efb07fe50..8229dde693060 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForObjectTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForObjectTest.java
@@ -18,12 +18,14 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class IBatisQueryForObjectTest extends IBatisTestSupport {
+ @Test
public void testQueryForObject() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
@@ -37,6 +39,7 @@ public void testQueryForObject() throws Exception {
assertEquals("Claus", account.getFirstName());
}
+ @Test
public void testQueryForNotFound() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForUpdateTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForUpdateTest.java
index a5318c6d5ab71..838c3421265e5 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForUpdateTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueryForUpdateTest.java
@@ -18,12 +18,14 @@
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class IBatisQueryForUpdateTest extends IBatisTestSupport {
+ @Test
public void testUpdate() throws Exception {
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueueTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueueTest.java
index 89b74ccc022c1..85ed3088868e1 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueueTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisQueueTest.java
@@ -20,12 +20,16 @@
import java.sql.Statement;
import java.util.List;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
-public class IBatisQueueTest extends ContextTestSupport {
+public class IBatisQueueTest extends CamelTestSupport {
+ @Test
public void testConsume() throws Exception {
MockEndpoint endpoint = getMockEndpoint("mock:results");
@@ -76,7 +80,8 @@ public void configure() throws Exception {
}
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// lets create the database...
@@ -88,7 +93,8 @@ protected void setUp() throws Exception {
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
super.tearDown();
IBatisEndpoint endpoint = resolveMandatoryEndpoint("ibatis:Account", IBatisEndpoint.class);
Connection connection = endpoint.getSqlMapClient().getDataSource().getConnection();
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteEmptyResultSetTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteEmptyResultSetTest.java
index 52141b52714d8..ba443f5a2327b 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteEmptyResultSetTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteEmptyResultSetTest.java
@@ -20,15 +20,19 @@
import java.sql.Statement;
import java.util.ArrayList;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* @version $Revision$
*/
-public class IBatisRouteEmptyResultSetTest extends ContextTestSupport {
+public class IBatisRouteEmptyResultSetTest extends CamelTestSupport {
+ @Test
public void testRouteEmptyResultSet() throws Exception {
MockEndpoint endpoint = getMockEndpoint("mock:results");
endpoint.expectedMinimumMessageCount(1);
@@ -51,7 +55,8 @@ public void configure() throws Exception {
}
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// lets create the database...
@@ -62,7 +67,8 @@ protected void setUp() throws Exception {
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
Connection connection = createConnection();
Statement statement = connection.createStatement();
statement.execute("drop table ACCOUNT");
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java
index d7591985f8683..a964ab6679ffb 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisRouteTest.java
@@ -20,15 +20,19 @@
import java.sql.Statement;
import java.util.List;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
/**
* @version $Revision$
*/
-public class IBatisRouteTest extends ContextTestSupport {
+public class IBatisRouteTest extends CamelTestSupport {
+ @Test
public void testSendAccountBean() throws Exception {
MockEndpoint endpoint = getMockEndpoint("mock:results");
endpoint.expectedMinimumMessageCount(1);
@@ -68,7 +72,8 @@ public void configure() throws Exception {
}
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// lets create the database...
@@ -79,7 +84,8 @@ protected void setUp() throws Exception {
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
Connection connection = createConnection();
Statement statement = connection.createStatement();
statement.execute("drop table ACCOUNT");
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisTestSupport.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisTestSupport.java
index 6c0190c24ce37..518cb205dd70b 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisTestSupport.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisTestSupport.java
@@ -19,12 +19,16 @@
import java.sql.Connection;
import java.sql.Statement;
-import org.apache.camel.ContextTestSupport;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.After;
+import org.junit.Before;
-public class IBatisTestSupport extends ContextTestSupport {
+
+public class IBatisTestSupport extends CamelTestSupport {
@Override
- protected void setUp() throws Exception {
+ @Before
+ public void setUp() throws Exception {
super.setUp();
// lets create the database...
@@ -50,7 +54,8 @@ protected void setUp() throws Exception {
}
@Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() throws Exception {
Connection connection = createConnection();
Statement statement = connection.createStatement();
statement.execute("drop table ACCOUNT");
diff --git a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
index 91f415313f91d..2e00582db406a 100644
--- a/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
+++ b/components/camel-ibatis/src/test/java/org/apache/camel/component/ibatis/IBatisUnknownStatementTypeTest.java
@@ -17,15 +17,17 @@
package org.apache.camel.component.ibatis;
import org.apache.camel.CamelExecutionException;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.FailedToCreateProducerException;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
/**
* @version $Revision$
*/
-public class IBatisUnknownStatementTypeTest extends ContextTestSupport {
+public class IBatisUnknownStatementTypeTest extends CamelTestSupport {
+ @Test
public void testStatementTypeNotSet() throws Exception {
try {
template.sendBody("direct:start", "Hello");
|
727e12953e677fff6c14729a91ccf7a409c43644
|
Delta Spike
|
add resolved issues to our release notes
|
p
|
https://github.com/apache/deltaspike
|
diff --git a/deltaspike/readme/ReleaseNotes-0.5.txt b/deltaspike/readme/ReleaseNotes-0.5.txt
index ea682196b..3542ce53e 100644
--- a/deltaspike/readme/ReleaseNotes-0.5.txt
+++ b/deltaspike/readme/ReleaseNotes-0.5.txt
@@ -27,4 +27,50 @@ CDI integration in to ConstraintValidators. This allows you to
inject CDI objects, EJBs etc in to your validators.
+* The following issues got resolved in this release:
+
+
+Sub-task
+
+ [DELTASPIKE-16] - review and discuss builders (metadata implementations)
+ [DELTASPIKE-387] - Create new bean-validation module
+ [DELTASPIKE-388] - Add support for a ConstraintValidatorFactory that creates CDI enabled constraint validators
+
+Bug
+
+ [DELTASPIKE-380] - NPE in PartialBeanLifecycle if javassist not on classpath
+ [DELTASPIKE-381] - missing optional bean-lookup
+ [DELTASPIKE-384] - ViewConfigUtils.toNodeList() fails in EAR
+ [DELTASPIKE-385] - Spurious BeanManagerProvider warnings when used in EAR
+ [DELTASPIKE-394] - pom.xml files of the data-module aren't aligned with other modules
+ [DELTASPIKE-397] - MessageBundleInvocationHandler should ignore methods like hashCode() etc from Object.class
+ [DELTASPIKE-403] - MessageBundles are not PassivationCapable
+ [DELTASPIKE-405] - producer for JsfMessage<T> does not match CDI-1.1 rules
+ [DELTASPIKE-407] - Tests for Servlet module incorrectly packaged
+
+Improvement
+
+ [DELTASPIKE-332] - Discuss introducing BeanValidation support
+ [DELTASPIKE-360] - alternative LocaleResolver which is aware of supported locales
+ [DELTASPIKE-366] - basic test of properties usage in cdictrl openejb container
+ [DELTASPIKE-383] - use getProjectStageAwarePropertyValue in @ConfigProperty and other configuration places
+ [DELTASPIKE-390] - optional custom ConfigPreProcessor for @ViewMetaData
+ [DELTASPIKE-409] - Servlet module events should be deactivatable
+ [DELTASPIKE-410] - improve compatibility with mojarra
+
+New Feature
+
+ [DELTASPIKE-375] - Create servlet module maven structure
+ [DELTASPIKE-376] - Propagation of basic servlet events to the CDI event bus
+ [DELTASPIKE-377] - Supporting injection of basic servlet objects
+ [DELTASPIKE-378] - ProjectStage-aware and Property-aware configuration
+ [DELTASPIKE-382] - mask out passwords and other credentials in our Configuration logs
+ [DELTASPIKE-398] - BeanProvider handling for @Dependent scoped beans
+
+Task
+
+ [DELTASPIKE-60] - Review and discuss a generic DAO API
+ [DELTASPIKE-401] - change GlobalAlternativeTest to work on Weld-2, Weld-1 and OWB
+ [DELTASPIKE-402] - Provide a way to skip tests depending on the CDI Container being used.
+ [DELTASPIKE-408] - WildFly test profile
|
b63ee851571ea79c2a94aaabef8fb5ed8c3a2079
|
echo3$echo3
|
Combined column/row synchronization peers into single item (Render.Column.js and Render.Row.js are now Render.ArrayContainer.js). Shared functionality is an abstract base class.
|
p
|
https://github.com/echo3/echo3
|
diff --git a/src/client/echo/Render.ArrayContainer.js b/src/client/echo/Render.ArrayContainer.js
new file mode 100644
index 00000000..d0b56950
--- /dev/null
+++ b/src/client/echo/Render.ArrayContainer.js
@@ -0,0 +1,303 @@
+/**
+ * Abstract base class for column/row peers.
+ */
+EchoAppRender.ArrayContainerSync = Core.extend(EchoRender.ComponentSync, {
+
+ $abstract: {
+ cellElementNodeName: true,
+
+ renderChildLayoutData: function(child, cellElement) { }
+ },
+
+ element: null,
+ containerElement: null,
+ spacingPrototype: null,
+
+ processKeyPress: function(e) {
+ switch (e.keyCode) {
+ case this.prevFocusKey:
+ case this.nextFocusKey:
+ var focusPrevious = e.keyCode == this.prevFocusKey;
+ var focusedComponent = this.component.application.getFocusedComponent();
+ if (focusedComponent && focusedComponent.peer && focusedComponent.peer.getFocusFlags) {
+ var focusFlags = focusedComponent.peer.getFocusFlags();
+ if ((focusPrevious && focusFlags & this.prevFocusFlag) || (!focusPrevious && focusFlags & this.nextFocusFlag)) {
+ var focusChild = this.component.application.focusManager.findInParent(this.component, focusPrevious);
+ if (focusChild) {
+ this.component.application.setFocusedComponent(focusChild);
+ WebCore.DOM.preventEventDefault(e);
+ return false;
+ }
+ }
+ }
+ break;
+ }
+ return true;
+ },
+
+ renderAddChild: function(update, child, index) {
+ var cellElement = document.createElement(this.cellElementNodeName);
+ this._childIdToElementMap[child.renderId] = cellElement;
+ EchoRender.renderComponentAdd(update, child, cellElement);
+
+ this.renderChildLayoutData(child, cellElement);
+
+ if (index != null) {
+ var currentChildCount;
+ if (this.containerElement.childNodes.length >= 3 && this._cellSpacing) {
+ currentChildCount = (this.containerElement.childNodes.length + 1) / 2;
+ } else {
+ currentChildCount = this.containerElement.childNodes.length;
+ }
+ if (index == currentChildCount) {
+ index = null;
+ }
+ }
+ if (index == null) {
+ // Full render or append-at-end scenario
+
+ // Render spacing cell first if index != 0 and cell spacing enabled.
+ if (this._cellSpacing && this.containerElement.firstChild) {
+ this.containerElement.appendChild(this.spacingPrototype.cloneNode(false));
+ }
+
+ // Render child cell second.
+ this.containerElement.appendChild(cellElement);
+ } else {
+ // Partial render insert at arbitrary location scenario (but not at end)
+ var insertionIndex = this._cellSpacing ? index * 2 : index;
+ var beforeElement = this.containerElement.childNodes[insertionIndex];
+
+ // Render child cell first.
+ this.containerElement.insertBefore(cellElement, beforeElement);
+
+ // Then render spacing cell if required.
+ if (this._cellSpacing) {
+ this.containerElement.insertBefore(this.spacingPrototype.cloneNode(false), beforeElement);
+ }
+ }
+ },
+
+ renderRemoveChild: function(update, child) {
+ var childElement = this._childIdToElementMap[child.renderId];
+
+ if (this._cellSpacing) {
+ // If cell spacing is enabled, remove a spacing element, either before or after the removed child.
+ // In the case of a single child existing in the Row, no spacing element will be removed.
+ if (childElement.previousSibling) {
+ this.containerElement.removeChild(childElement.previousSibling);
+ } else if (childElement.nextSibling) {
+ this.containerElement.removeChild(childElement.nextSibling);
+ }
+ }
+ this.containerElement.removeChild(childElement);
+
+ delete this._childIdToElementMap[child.renderId];
+ },
+
+ renderUpdate: function(update) {
+ var fullRender = false;
+ if (update.hasUpdatedProperties() || update.hasUpdatedLayoutDataChildren()) {
+ // Full render
+ fullRender = true;
+ } else {
+ var removedChildren = update.getRemovedChildren();
+ if (removedChildren) {
+ // Remove children.
+ for (var i = 0; i < removedChildren.length; ++i) {
+ this.renderRemoveChild(update, removedChildren[i]);
+ }
+ }
+ var addedChildren = update.getAddedChildren();
+ if (addedChildren) {
+ // Add children.
+ for (var i = 0; i < addedChildren.length; ++i) {
+ this.renderAddChild(update, addedChildren[i], this.component.indexOf(addedChildren[i]));
+ }
+ }
+ }
+ if (fullRender) {
+ var element = this.element;
+ var containerElement = element.parentNode;
+ EchoRender.renderComponentDispose(update, update.parent);
+ containerElement.removeChild(element);
+ this.renderAdd(update, containerElement);
+ }
+
+ return fullRender;
+ }
+});
+
+/**
+ * Component rendering peer: Column
+ */
+EchoAppRender.ColumnSync = Core.extend(EchoAppRender.ArrayContainerSync, {
+
+ $load: function() {
+ EchoRender.registerPeer("Column", this);
+ },
+
+ cellElementNodeName: "div",
+ prevFocusKey: 38,
+ prevFocusFlag: EchoRender.ComponentSync.FOCUS_PERMIT_ARROW_UP,
+ nextFocusKey: 40,
+ nextFocusFlag: EchoRender.ComponentSync.FOCUS_PERMIT_ARROW_DOWN,
+
+ renderAdd: function(update, parentElement) {
+ this.element = this.containerElement = document.createElement("div");
+ this.element.id = this.component.renderId;
+ this.element.style.outlineStyle = "none";
+ this.element.tabIndex = "-1";
+
+ EchoAppRender.Border.render(this.component.render("border"), this.element);
+ EchoAppRender.Color.renderFB(this.component, this.element);
+ EchoAppRender.Font.render(this.component.render("font"), this.element);
+ EchoAppRender.Insets.render(this.component.render("insets"), this.element, "padding");
+
+ this._cellSpacing = EchoAppRender.Extent.toPixels(this.component.render("cellSpacing"), false);
+ if (this._cellSpacing) {
+ this.spacingPrototype = document.createElement("div");
+ this.spacingPrototype.style.height = this._cellSpacing + "px";
+ this.spacingPrototype.style.fontSize = "1px";
+ this.spacingPrototype.style.lineHeight = "0px";
+ }
+
+ this._childIdToElementMap = {};
+
+ var componentCount = this.component.getComponentCount();
+ for (var i = 0; i < componentCount; ++i) {
+ var child = this.component.getComponent(i);
+ this.renderAddChild(update, child);
+ }
+
+ WebCore.EventProcessor.add(this.element,
+ WebCore.Environment.QUIRK_IE_KEY_DOWN_EVENT_REPEAT ? "keydown" : "keypress",
+ Core.method(this, this._processKeyPress), false);
+
+ parentElement.appendChild(this.element);
+ },
+
+ renderChildLayoutData: function(child, cellElement) {
+ var layoutData = child.render("layoutData");
+ var insets;
+ if (layoutData) {
+ insets = layoutData.insets;
+ EchoAppRender.Color.render(layoutData.background, cellElement, "backgroundColor");
+ EchoAppRender.FillImage.render(layoutData.backgroundImage, cellElement);
+ EchoAppRender.Alignment.render(layoutData.alignment, cellElement, true, this.component);
+ if (layoutData.width) {
+ if (EchoAppRender.Extent.isPercent(layoutData.width)) {
+ cellElement.style.width = layoutData.width;
+ } else {
+ cellElement.style.width = EchoAppRender.Extent.toCssValue(layoutData.width, true);
+ }
+ }
+ }
+ if (!insets) {
+ insets = "0px";
+ }
+ EchoAppRender.Insets.render(insets, cellElement, "padding");
+ },
+
+ renderDispose: function(update) {
+ WebCore.EventProcessor.removeAll(this.element);
+ this.containerElement = null;
+ this.element = null;
+ this._childIdToElementMap = null;
+ this.spacingPrototype = null;
+ }
+});
+
+/**
+ * Component rendering peer: Row
+ */
+EchoAppRender.RowSync = Core.extend(EchoAppRender.ArrayContainerSync, {
+
+ $static: {
+
+ _createRowPrototype: function() {
+ var divElement = document.createElement("div");
+ divElement.style.outlineStyle = "none";
+ divElement.style.overflow = "hidden";
+ divElement.tabIndex = "-1";
+
+ var tableElement = document.createElement("table");
+ tableElement.style.borderCollapse = "collapse";
+ divElement.appendChild(tableElement);
+
+ var tbodyElement = document.createElement("tbody");
+ tableElement.appendChild(tbodyElement);
+
+ var trElement = document.createElement("tr");
+ tbodyElement.appendChild(trElement);
+
+ return divElement;
+ }
+ },
+
+ $load: function() {
+ this._rowPrototype = this._createRowPrototype();
+ EchoRender.registerPeer("Row", this);
+ },
+
+ cellElementNodeName: "td",
+ prevFocusKey: 37,
+ prevFocusFlag: EchoRender.ComponentSync.FOCUS_PERMIT_ARROW_LEFT,
+ nextFocusKey: 39,
+ nextFocusFlag: EchoRender.ComponentSync.FOCUS_PERMIT_ARROW_RIGHT,
+
+ renderAdd: function(update, parentElement) {
+ this.element = EchoAppRender.RowSync._rowPrototype.cloneNode(true);
+ this.element.id = this.component.renderId;
+
+ EchoAppRender.Border.render(this.component.render("border"), this.element);
+ EchoAppRender.Color.renderFB(this.component, this.element);
+ EchoAppRender.Font.render(this.component.render("font"), this.element);
+ EchoAppRender.Insets.render(this.component.render("insets"), this.element, "padding");
+ EchoAppRender.Alignment.render(this.component.render("alignment"), this.element, true, this.component);
+
+ // div table tbody tr
+ this.containerElement = this.element.firstChild.firstChild.firstChild;
+
+ this._cellSpacing = EchoAppRender.Extent.toPixels(this.component.render("cellSpacing"), false);
+ if (this._cellSpacing) {
+ this.spacingPrototype = document.createElement("td");
+ this.spacingPrototype.style.width = this._cellSpacing + "px";
+ }
+
+ this._childIdToElementMap = {};
+
+ var componentCount = this.component.getComponentCount();
+ for (var i = 0; i < componentCount; ++i) {
+ var child = this.component.getComponent(i);
+ this.renderAddChild(update, child);
+ }
+
+ WebCore.EventProcessor.add(this.element,
+ WebCore.Environment.QUIRK_IE_KEY_DOWN_EVENT_REPEAT ? "keydown" : "keypress",
+ Core.method(this, this._processKeyPress), false);
+
+ parentElement.appendChild(this.element);
+ },
+
+ renderChildLayoutData: function(child, cellElement) {
+ var layoutData = child.render("layoutData");
+ if (layoutData) {
+ EchoAppRender.Color.render(layoutData.background, cellElement, "backgroundColor");
+ EchoAppRender.FillImage.render(layoutData.backgroundImage, cellElement);
+ EchoAppRender.Insets.render(layoutData.insets, cellElement, "padding");
+ EchoAppRender.Alignment.render(layoutData.alignment, cellElement, true, this.component);
+ if (layoutData.height) {
+ cellElement.style.height = EchoAppRender.Extent.toPixels(layoutData.height, false) + "px";
+ }
+ }
+ },
+
+ renderDispose: function(update) {
+ WebCore.EventProcessor.removeAll(this.element);
+ this.element = null;
+ this.containerElement = null;
+ this._childIdToElementMap = null;
+ this.spacingPrototype = null;
+ }
+});
diff --git a/src/client/echo/Render.Column.js b/src/client/echo/Render.Column.js
deleted file mode 100644
index c1f66c7d..00000000
--- a/src/client/echo/Render.Column.js
+++ /dev/null
@@ -1,174 +0,0 @@
-/**
- * Component rendering peer: Column
- */
-EchoAppRender.ColumnSync = Core.extend(EchoRender.ComponentSync, {
-
- $load: function() {
- EchoRender.registerPeer("Column", this);
- },
-
- _processKeyPress: function(e) {
- switch (e.keyCode) {
- case 38:
- case 40:
- var focusPrevious = e.keyCode == 38;
- var focusedComponent = this.component.application.getFocusedComponent();
- if (focusedComponent && focusedComponent.peer && focusedComponent.peer.getFocusFlags) {
- var focusFlags = focusedComponent.peer.getFocusFlags();
- if ((focusPrevious && focusFlags & EchoRender.ComponentSync.FOCUS_PERMIT_ARROW_UP)
- || (!focusPrevious && focusFlags & EchoRender.ComponentSync.FOCUS_PERMIT_ARROW_DOWN)) {
- var focusChild = this.component.application.focusManager.findInParent(this.component, focusPrevious);
- if (focusChild) {
- this.component.application.setFocusedComponent(focusChild);
- WebCore.DOM.preventEventDefault(e);
- return false;
- }
- }
- }
- break;
- }
- return true;
- },
-
- renderAdd: function(update, parentElement) {
- this._divElement = document.createElement("div");
- this._divElement.id = this.component.renderId;
- this._divElement.style.outlineStyle = "none";
- this._divElement.tabIndex = "-1";
-
- EchoAppRender.Border.render(this.component.render("border"), this._divElement);
- EchoAppRender.Color.renderFB(this.component, this._divElement);
- EchoAppRender.Font.render(this.component.render("font"), this._divElement);
- EchoAppRender.Insets.render(this.component.render("insets"), this._divElement, "padding");
-
- this._cellSpacing = EchoAppRender.Extent.toPixels(this.component.render("cellSpacing"), false);
- if (this._cellSpacing) {
- this._spacingPrototype = document.createElement("div");
- this._spacingPrototype.style.height = this._cellSpacing + "px";
- this._spacingPrototype.style.fontSize = "1px";
- this._spacingPrototype.style.lineHeight = "0px";
- }
-
- this._childIdToElementMap = {};
-
- var componentCount = this.component.getComponentCount();
- for (var i = 0; i < componentCount; ++i) {
- var child = this.component.getComponent(i);
- this._renderAddChild(update, child);
- }
-
- WebCore.EventProcessor.add(this._divElement,
- WebCore.Environment.QUIRK_IE_KEY_DOWN_EVENT_REPEAT ? "keydown" : "keypress",
- Core.method(this, this._processKeyPress), false);
-
- parentElement.appendChild(this._divElement);
- },
-
- _renderAddChild: function(update, child, index) {
- var divElement = document.createElement("div");
- this._childIdToElementMap[child.renderId] = divElement;
- EchoRender.renderComponentAdd(update, child, divElement);
-
- var layoutData = child.render("layoutData");
- if (layoutData) {
- EchoAppRender.Color.render(layoutData.background, divElement, "backgroundColor");
- EchoAppRender.FillImage.render(layoutData.backgroundImage, divElement);
- EchoAppRender.Insets.render(layoutData.insets, divElement, "padding");
- EchoAppRender.Alignment.render(layoutData.alignment, divElement, true, this.component);
- if (layoutData.height) {
- divElement.style.height = EchoAppRender.Extent.toPixels(layoutData.height, false) + "px";
- }
- }
-
- if (index != null) {
- var currentChildCount;
- if (this._divElement.childNodes.length >= 3 && this._cellSpacing) {
- currentChildCount = (this._divElement.childNodes.length + 1) / 2;
- } else {
- currentChildCount = this._divElement.childNodes.length;
- }
- if (index == currentChildCount) {
- index = null;
- }
- }
- if (index == null) {
- // Full render or append-at-end scenario
-
- // Render spacing div first if index != 0 and cell spacing enabled.
- if (this._cellSpacing && this._divElement.firstChild) {
- this._divElement.appendChild(this._spacingPrototype.cloneNode(false));
- }
-
- // Render child div second.
- this._divElement.appendChild(divElement);
- } else {
- // Partial render insert at arbitrary location scenario (but not at end)
- var insertionIndex = this._cellSpacing ? index * 2 : index;
- var beforeElement = this._divElement.childNodes[insertionIndex];
-
- // Render child div first.
- this._divElement.insertBefore(divElement, beforeElement);
-
- // Then render spacing div if required.
- if (this._cellSpacing) {
- this._divElement.insertBefore(this._spacingPrototype.cloneNode(false), beforeElement);
- }
- }
- },
-
- _renderRemoveChild: function(update, child) {
- var childElement = this._childIdToElementMap[child.renderId];
-
- if (this._cellSpacing) {
- // If cell spacing is enabled, remove a spacing element, either before or after the removed child.
- // In the case of a single child existing in the column, no spacing element will be removed.
- if (childElement.previousSibling) {
- this._divElement.removeChild(childElement.previousSibling);
- } else if (childElement.nextSibling) {
- this._divElement.removeChild(childElement.nextSibling);
- }
- }
- this._divElement.removeChild(childElement);
-
- delete this._childIdToElementMap[child.renderId];
- },
-
- renderDispose: function(update) {
- WebCore.EventProcessor.removeAll(this._divElement);
- this._divElement = null;
- this._childIdToElementMap = null;
- this._spacingPrototype = null;
- },
-
- renderUpdate: function(update) {
- var fullRender = false;
- if (update.hasUpdatedProperties() || update.hasUpdatedLayoutDataChildren()) {
- // Full render
- fullRender = true;
- } else {
- var removedChildren = update.getRemovedChildren();
- if (removedChildren) {
- // Remove children.
- for (var i = 0; i < removedChildren.length; ++i) {
- this._renderRemoveChild(update, removedChildren[i]);
- }
- }
- var addedChildren = update.getAddedChildren();
- if (addedChildren) {
- // Add children.
- for (var i = 0; i < addedChildren.length; ++i) {
- this._renderAddChild(update, addedChildren[i], this.component.indexOf(addedChildren[i]));
- }
- }
- }
- if (fullRender) {
- var element = this._divElement;
- var containerElement = element.parentNode;
- EchoRender.renderComponentDispose(update, update.parent);
- containerElement.removeChild(element);
- this.renderAdd(update, containerElement);
- }
-
- return fullRender;
- }
-});
diff --git a/src/client/echo/Render.Row.js b/src/client/echo/Render.Row.js
deleted file mode 100644
index 81481302..00000000
--- a/src/client/echo/Render.Row.js
+++ /dev/null
@@ -1,208 +0,0 @@
-/**
- * Component rendering peer: Row
- */
-EchoAppRender.RowSync = Core.extend(EchoRender.ComponentSync, {
-
- $static: {
-
- _createRowPrototype: function() {
- var divElement = document.createElement("div");
- divElement.style.outlineStyle = "none";
- divElement.style.overflow = "hidden";
- divElement.tabIndex = "-1";
-
- var tableElement = document.createElement("table");
- tableElement.style.borderCollapse = "collapse";
- divElement.appendChild(tableElement);
-
- var tbodyElement = document.createElement("tbody");
- tableElement.appendChild(tbodyElement);
-
- var trElement = document.createElement("tr");
- tbodyElement.appendChild(trElement);
-
- return divElement;
- }
- },
-
- $load: function() {
- this._rowPrototype = this._createRowPrototype();
- EchoRender.registerPeer("Row", this);
- },
-
- _processKeyPress: function(e) {
- switch (e.keyCode) {
- case 37:
- case 39:
- var focusPrevious = e.keyCode == 37;
- var focusedComponent = this.component.application.getFocusedComponent();
- if (focusedComponent && focusedComponent.peer && focusedComponent.peer.getFocusFlags) {
- var focusFlags = focusedComponent.peer.getFocusFlags();
- if ((focusPrevious && focusFlags & EchoRender.ComponentSync.FOCUS_PERMIT_ARROW_LEFT)
- || (!focusPrevious && focusFlags & EchoRender.ComponentSync.FOCUS_PERMIT_ARROW_RIGHT)) {
- var focusChild = this.component.application.focusManager.findInParent(this.component, focusPrevious);
- if (focusChild) {
- this.component.application.setFocusedComponent(focusChild);
- WebCore.DOM.preventEventDefault(e);
- return false;
- }
- }
- }
- break;
- }
- return true;
- },
-
- renderAdd: function(update, parentElement) {
- this._divElement = EchoAppRender.RowSync._rowPrototype.cloneNode(true);
- this._divElement.id = this.component.renderId;
-
- EchoAppRender.Border.render(this.component.render("border"), this._divElement);
- EchoAppRender.Color.renderFB(this.component, this._divElement);
- EchoAppRender.Font.render(this.component.render("font"), this._divElement);
- EchoAppRender.Insets.render(this.component.render("insets"), this._divElement, "padding");
- EchoAppRender.Alignment.render(this.component.render("alignment"), this._divElement, true, this.component);
-
- // div table tbody tr
- this._trElement = this._divElement.firstChild.firstChild.firstChild;
-
- this._cellSpacing = EchoAppRender.Extent.toPixels(this.component.render("cellSpacing"), false);
- if (this._cellSpacing) {
- this._spacingPrototype = document.createElement("td");
- this._spacingPrototype.style.width = this._cellSpacing + "px";
- }
-
- this._childIdToElementMap = {};
-
- var componentCount = this.component.getComponentCount();
- for (var i = 0; i < componentCount; ++i) {
- var child = this.component.getComponent(i);
- this._renderAddChild(update, child);
- }
-
- WebCore.EventProcessor.add(this._divElement,
- WebCore.Environment.QUIRK_IE_KEY_DOWN_EVENT_REPEAT ? "keydown" : "keypress",
- Core.method(this, this._processKeyPress), false);
-
- parentElement.appendChild(this._divElement);
- },
-
- _renderAddChild: function(update, child, index) {
- var tdElement = document.createElement("td");
- this._childIdToElementMap[child.renderId] = tdElement;
- EchoRender.renderComponentAdd(update, child, tdElement);
-
- var layoutData = child.render("layoutData");
- var insets;
- if (layoutData) {
- insets = layoutData.insets;
- EchoAppRender.Color.render(layoutData.background, tdElement, "backgroundColor");
- EchoAppRender.FillImage.render(layoutData.backgroundImage, tdElement);
- EchoAppRender.Alignment.render(layoutData.alignment, tdElement, true, this.component);
- if (layoutData.width) {
- if (EchoAppRender.Extent.isPercent(layoutData.width)) {
- tdElement.style.width = layoutData.width;
- } else {
- tdElement.style.width = EchoAppRender.Extent.toCssValue(layoutData.width, true);
- }
- }
- }
- if (!insets) {
- insets = "0px";
- }
- EchoAppRender.Insets.render(insets, tdElement, "padding");
-
- if (index != null) {
- var currentChildCount;
- if (this._trElement.childNodes.length >= 3 && this._cellSpacing) {
- currentChildCount = (this._trElement.childNodes.length + 1) / 2;
- } else {
- currentChildCount = this._trElement.childNodes.length;
- }
- if (index == currentChildCount) {
- index = null;
- }
- }
- if (index == null) {
- // Full render or append-at-end scenario
-
- // Render spacing td first if index != 0 and cell spacing enabled.
- if (this._cellSpacing && this._trElement.firstChild) {
- this._trElement.appendChild(this._spacingPrototype.cloneNode(false));
- }
-
- // Render child td second.
- this._trElement.appendChild(tdElement);
- } else {
- // Partial render insert at arbitrary location scenario (but not at end)
- var insertionIndex = this._cellSpacing ? index * 2 : index;
- var beforeElement = this._trElement.childNodes[insertionIndex];
-
- // Render child td first.
- this._trElement.insertBefore(tdElement, beforeElement);
-
- // Then render spacing td if required.
- if (this._cellSpacing) {
- this._trElement.insertBefore(this._spacingPrototype.cloneNode(false), beforeElement);
- }
- }
- },
-
- _renderRemoveChild: function(update, child) {
- var childElement = this._childIdToElementMap[child.renderId];
-
- if (this._cellSpacing) {
- // If cell spacing is enabled, remove a spacing element, either before or after the removed child.
- // In the case of a single child existing in the Row, no spacing element will be removed.
- if (childElement.previousSibling) {
- this._trElement.removeChild(childElement.previousSibling);
- } else if (childElement.nextSibling) {
- this._trElement.removeChild(childElement.nextSibling);
- }
- }
- this._trElement.removeChild(childElement);
-
- delete this._childIdToElementMap[child.renderId];
- },
-
- renderDispose: function(update) {
- WebCore.EventProcessor.removeAll(this._divElement);
- this._divElement = null;
- this._trElement = null;
- this._childIdToElementMap = null;
- this._spacingPrototype = null;
- },
-
- renderUpdate: function(update) {
- var fullRender = false;
- if (update.hasUpdatedProperties() || update.hasUpdatedLayoutDataChildren()) {
- // Full render
- fullRender = true;
- } else {
- var removedChildren = update.getRemovedChildren();
- if (removedChildren) {
- // Remove children.
- for (var i = 0; i < removedChildren.length; ++i) {
- var child = removedChildren[i];
- this._renderRemoveChild(update, child);
- }
- }
- var addedChildren = update.getAddedChildren();
- if (addedChildren) {
- // Add children.
- for (var i = 0; i < addedChildren.length; ++i) {
- this._renderAddChild(update, addedChildren[i], this.component.indexOf(addedChildren[i]));
- }
- }
- }
- if (fullRender) {
- var element = this._divElement;
- var containerElement = element.parentNode;
- EchoRender.renderComponentDispose(update, update.parent);
- containerElement.removeChild(element);
- this.renderAdd(update, containerElement);
- }
-
- return fullRender;
- }
-});
diff --git a/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/AbstractArrayContainerSynchronizePeer.java b/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/AbstractArrayContainerSynchronizePeer.java
new file mode 100644
index 00000000..3b54d286
--- /dev/null
+++ b/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/AbstractArrayContainerSynchronizePeer.java
@@ -0,0 +1,59 @@
+/*
+ * This file is part of the Echo Web Application Framework (hereinafter "Echo").
+ * Copyright (C) 2002-2008 NextApp, Inc.
+ *
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ */
+
+package nextapp.echo.webcontainer.sync.component;
+
+import nextapp.echo.app.util.Context;
+import nextapp.echo.webcontainer.AbstractComponentSynchronizePeer;
+import nextapp.echo.webcontainer.ServerMessage;
+import nextapp.echo.webcontainer.Service;
+import nextapp.echo.webcontainer.WebContainerServlet;
+import nextapp.echo.webcontainer.service.JavaScriptService;
+
+/**
+ * Abstract Base Synchronization peer for <code>Column</code>s and <code>Row</code>s.
+ */
+abstract class AbstractArrayContainerSynchronizePeer extends AbstractComponentSynchronizePeer {
+
+ private static final Service ARRAY_CONTAINER_SERVICE = JavaScriptService.forResource("Echo.ArrayContainer",
+ "/nextapp/echo/webcontainer/resource/Render.ArrayContainer.js");
+
+ static {
+ WebContainerServlet.getServiceRegistry().add(ARRAY_CONTAINER_SERVICE);
+ }
+
+ /**
+ * @see nextapp.echo.webcontainer.ComponentSynchronizePeer#init(nextapp.echo.app.util.Context)
+ */
+ public void init(Context context) {
+ super.init(context);
+ ServerMessage serverMessage = (ServerMessage) context.get(ServerMessage.class);
+ serverMessage.addLibrary(ARRAY_CONTAINER_SERVICE.getId());
+ }
+}
diff --git a/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/ColumnPeer.java b/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/ColumnPeer.java
index d36e8772..7208cb98 100644
--- a/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/ColumnPeer.java
+++ b/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/ColumnPeer.java
@@ -30,24 +30,11 @@
package nextapp.echo.webcontainer.sync.component;
import nextapp.echo.app.Column;
-import nextapp.echo.app.util.Context;
-import nextapp.echo.webcontainer.AbstractComponentSynchronizePeer;
-import nextapp.echo.webcontainer.ServerMessage;
-import nextapp.echo.webcontainer.Service;
-import nextapp.echo.webcontainer.WebContainerServlet;
-import nextapp.echo.webcontainer.service.JavaScriptService;
/**
* Synchronization peer for <code>Column</code>s.
*/
-public class ColumnPeer extends AbstractComponentSynchronizePeer {
-
- private static final Service COLUMN_SERVICE = JavaScriptService.forResource("Echo.Column",
- "/nextapp/echo/webcontainer/resource/Render.Column.js");
-
- static {
- WebContainerServlet.getServiceRegistry().add(COLUMN_SERVICE);
- }
+public class ColumnPeer extends AbstractArrayContainerSynchronizePeer {
/**
* @see nextapp.echo.webcontainer.ComponentSynchronizePeer#getClientComponentType(boolean)
@@ -62,13 +49,4 @@ public String getClientComponentType(boolean shortType) {
public Class getComponentClass() {
return Column.class;
}
-
- /**
- * @see nextapp.echo.webcontainer.ComponentSynchronizePeer#init(nextapp.echo.app.util.Context)
- */
- public void init(Context context) {
- super.init(context);
- ServerMessage serverMessage = (ServerMessage) context.get(ServerMessage.class);
- serverMessage.addLibrary(COLUMN_SERVICE.getId());
- }
}
diff --git a/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/RowPeer.java b/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/RowPeer.java
index 77838aba..cb32b738 100644
--- a/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/RowPeer.java
+++ b/src/server-java/webcontainer/nextapp/echo/webcontainer/sync/component/RowPeer.java
@@ -30,24 +30,11 @@
package nextapp.echo.webcontainer.sync.component;
import nextapp.echo.app.Row;
-import nextapp.echo.app.util.Context;
-import nextapp.echo.webcontainer.AbstractComponentSynchronizePeer;
-import nextapp.echo.webcontainer.ServerMessage;
-import nextapp.echo.webcontainer.Service;
-import nextapp.echo.webcontainer.WebContainerServlet;
-import nextapp.echo.webcontainer.service.JavaScriptService;
/**
* Synchronization peer for <code>Row</code>s.
*/
-public class RowPeer extends AbstractComponentSynchronizePeer {
-
- private static final Service ROW_SERVICE = JavaScriptService.forResource("Echo.Row",
- "/nextapp/echo/webcontainer/resource/Render.Row.js");
-
- static {
- WebContainerServlet.getServiceRegistry().add(ROW_SERVICE);
- }
+public class RowPeer extends AbstractArrayContainerSynchronizePeer {
/**
* @see nextapp.echo.webcontainer.ComponentSynchronizePeer#getClientComponentType(boolean)
@@ -62,13 +49,4 @@ public String getClientComponentType(boolean shortType) {
public Class getComponentClass() {
return Row.class;
}
-
- /**
- * @see nextapp.echo.webcontainer.ComponentSynchronizePeer#init(nextapp.echo.app.util.Context)
- */
- public void init(Context context) {
- super.init(context);
- ServerMessage serverMessage = (ServerMessage) context.get(ServerMessage.class);
- serverMessage.addLibrary(ROW_SERVICE.getId());
- }
}
|
62b7a6dfa2676ee4386cc8b4e81ce8a5d08bc8f3
|
camel
|
Fixed tests.--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@1062115 13f79535-47bb-0310-9956-ffa450edef68-
|
c
|
https://github.com/apache/camel
|
diff --git a/components/camel-script/pom.xml b/components/camel-script/pom.xml
index ba5507fae016b..4f8f0b4bf3ee5 100644
--- a/components/camel-script/pom.xml
+++ b/components/camel-script/pom.xml
@@ -105,6 +105,7 @@
</dependency>
<!-- testing -->
+ <!-- TODO: use by language test, which we should refactor into camel-test JAR -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
@@ -115,9 +116,8 @@
<dependency>
<groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
+ <artifactId>camel-test</artifactId>
<scope>test</scope>
- <optional>true</optional>
</dependency>
<dependency>
diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/BeanShellScriptRouteTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/BeanShellScriptRouteTest.java
index 64894c37996a4..715f17f3432b4 100644
--- a/components/camel-script/src/test/java/org/apache/camel/builder/script/BeanShellScriptRouteTest.java
+++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/BeanShellScriptRouteTest.java
@@ -19,17 +19,19 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.ScriptTestHelper;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
import static org.apache.camel.builder.script.ScriptBuilder.script;
/**
* Unit test for a BeanSheel script
*/
-public class BeanShellScriptRouteTest extends ContextTestSupport {
+public class BeanShellScriptRouteTest extends CamelTestSupport {
+ @Test
public void testSendMatchingMessage() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
@@ -45,6 +47,7 @@ public void testSendMatchingMessage() throws Exception {
assertMockEndpointsSatisfied();
}
+ @Test
public void testSendNonMatchingMessage() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/GroovyScriptRouteTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/GroovyScriptRouteTest.java
index 8101931071682..3dfa21e06e9ba 100644
--- a/components/camel-script/src/test/java/org/apache/camel/builder/script/GroovyScriptRouteTest.java
+++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/GroovyScriptRouteTest.java
@@ -16,29 +16,32 @@
*/
package org.apache.camel.builder.script;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.ScriptTestHelper;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
/**
* Unit test for a Groovy script based on end-user question.
*/
-public class GroovyScriptRouteTest extends ContextTestSupport {
+@Ignore("May fail on CI server on JDK 1.6")
+public class GroovyScriptRouteTest extends CamelTestSupport {
+ @Test
public void testGroovyScript() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
}
- // TODO: fails on some JDL1.6 boxes
-// MockEndpoint mock = getMockEndpoint("mock:result");
-// mock.expectedBodiesReceived("Hello World");
-// mock.expectedHeaderReceived("foo", "Hello World");
-//
-// template.sendBodyAndHeader("seda:a", "Hello World", "foo", "London");
-//
-// mock.assertIsSatisfied();
+ MockEndpoint mock = getMockEndpoint("mock:result");
+ mock.expectedBodiesReceived("Hello World");
+ mock.expectedHeaderReceived("foo", "Hello World");
+
+ template.sendBodyAndHeader("seda:a", "Hello World", "foo", "London");
+
+ mock.assertIsSatisfied();
}
protected RouteBuilder createRouteBuilder() throws Exception {
diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java
index 6624a9b34a753..7b1fb1c441dd7 100644
--- a/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java
+++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/JavaScriptExpressionTest.java
@@ -19,24 +19,23 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.ScriptTestHelper;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
/**
* Tests a routing expression using JavaScript
*/
-public class JavaScriptExpressionTest extends ContextTestSupport {
+public class JavaScriptExpressionTest extends CamelTestSupport {
+ @Test
public void testSendMatchingMessage() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
}
- // TODO Currently, this test fails because the JavaScript expression in createRouteBuilder
- // below returns false
- // To fix that, we need to figure out how to get the expression to return the right value
MockEndpoint mock = getMockEndpoint("mock:result");
mock.expectedMessageCount(1);
@@ -50,6 +49,7 @@ public void testSendMatchingMessage() throws Exception {
assertMockEndpointsSatisfied();
}
+ @Test
public void testSendNonMatchingMessage() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/Jsr223Test.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/Jsr223Test.java
index 894a133fe4440..627f33278263b 100644
--- a/components/camel-script/src/test/java/org/apache/camel/builder/script/Jsr223Test.java
+++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/Jsr223Test.java
@@ -20,8 +20,8 @@
import javax.script.ScriptEngineManager;
import junit.framework.TestCase;
-
import org.apache.camel.ScriptTestHelper;
+import org.junit.Test;
/**
* @version $Revision$
@@ -29,6 +29,7 @@
public class Jsr223Test extends TestCase {
private String [] scriptNames = {"beanshell", "groovy", "js", "python", "ruby", "javascript"};
+ @Test
public void testLanguageNames() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java
index ca03ebdb4ddcc..fdbd802caf16d 100644
--- a/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java
+++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/PythonExpressionTest.java
@@ -19,15 +19,17 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.ScriptTestHelper;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Test;
/**
* Tests a routing expression using Python
*/
-public class PythonExpressionTest extends ContextTestSupport {
-
+public class PythonExpressionTest extends CamelTestSupport {
+
+ @Test
public void testSendMatchingMessage() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
@@ -43,6 +45,7 @@ public void testSendMatchingMessage() throws Exception {
assertMockEndpointsSatisfied();
}
+ @Test
public void testSendNonMatchingMessage() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
diff --git a/components/camel-script/src/test/java/org/apache/camel/builder/script/RubyExpressionTest.java b/components/camel-script/src/test/java/org/apache/camel/builder/script/RubyExpressionTest.java
index edd2d93519136..aaeb97d18d601 100644
--- a/components/camel-script/src/test/java/org/apache/camel/builder/script/RubyExpressionTest.java
+++ b/components/camel-script/src/test/java/org/apache/camel/builder/script/RubyExpressionTest.java
@@ -19,15 +19,19 @@
import java.util.HashMap;
import java.util.Map;
-import org.apache.camel.ContextTestSupport;
import org.apache.camel.ScriptTestHelper;
import org.apache.camel.builder.RouteBuilder;
+import org.apache.camel.test.junit4.CamelTestSupport;
+import org.junit.Ignore;
+import org.junit.Test;
/**
* Tests a routing expression using Ruby
*/
-public class RubyExpressionTest extends ContextTestSupport {
+@Ignore("May fail on CI server on JDK 1.6")
+public class RubyExpressionTest extends CamelTestSupport {
+ @Test
public void testSendMatchingMessage() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
@@ -43,6 +47,7 @@ public void testSendMatchingMessage() throws Exception {
assertMockEndpointsSatisfied();
}
+ @Test
public void testSendNonMatchingMessage() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
diff --git a/components/camel-script/src/test/java/org/apache/camel/language/script/JavaScriptLanguageTest.java b/components/camel-script/src/test/java/org/apache/camel/language/script/JavaScriptLanguageTest.java
index 7a6a2ec66f22a..a7358aa1d9bc0 100644
--- a/components/camel-script/src/test/java/org/apache/camel/language/script/JavaScriptLanguageTest.java
+++ b/components/camel-script/src/test/java/org/apache/camel/language/script/JavaScriptLanguageTest.java
@@ -18,12 +18,14 @@
import org.apache.camel.LanguageTestSupport;
import org.apache.camel.ScriptTestHelper;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class JavaScriptLanguageTest extends LanguageTestSupport {
-
+
+ @Test
public void testLanguageExpressions() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
diff --git a/components/camel-script/src/test/java/org/apache/camel/language/script/PythonLanguageTest.java b/components/camel-script/src/test/java/org/apache/camel/language/script/PythonLanguageTest.java
index cfbce63899845..ee8e04a57cae9 100644
--- a/components/camel-script/src/test/java/org/apache/camel/language/script/PythonLanguageTest.java
+++ b/components/camel-script/src/test/java/org/apache/camel/language/script/PythonLanguageTest.java
@@ -18,12 +18,14 @@
import org.apache.camel.LanguageTestSupport;
import org.apache.camel.ScriptTestHelper;
+import org.junit.Test;
/**
* @version $Revision$
*/
public class PythonLanguageTest extends LanguageTestSupport {
-
+
+ @Test
public void testLanguageExpressions() throws Exception {
if (!ScriptTestHelper.canRunTestOnThisPlatform()) {
return;
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultJMXAgentTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultJMXAgentTest.java
index c75fb27e666d6..28d748ea9242f 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultJMXAgentTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/DefaultJMXAgentTest.java
@@ -18,7 +18,6 @@
import java.lang.management.ManagementFactory;
import java.util.List;
-
import javax.management.MBeanServer;
import javax.management.MBeanServerConnection;
import javax.management.MBeanServerFactory;
@@ -61,11 +60,15 @@ protected void releaseMBeanServers() {
}
public void testQueryMbeans() throws Exception {
- int routes = mbsc.queryNames(new ObjectName("org.apache.camel" + ":type=routes,*"), null).size();
- int processors = mbsc.queryNames(new ObjectName("org.apache.camel" + ":type=processors,*"), null).size();
+ // whats the numbers before, because the JVM can have left overs when unit testing
+ int before = mbsc.queryNames(new ObjectName("org.apache.camel" + ":type=consumers,*"), null).size();
+
+ // start route should enlist the consumer to JMX
+ context.startRoute("foo");
+
+ int after = mbsc.queryNames(new ObjectName("org.apache.camel" + ":type=consumers,*"), null).size();
- assertTrue("Should contain routes", routes > 0);
- assertTrue("Should contain processors", processors > 0);
+ assertTrue("Should have added consumer to JMX, before: " + before + ", after: " + after, after > before);
}
@Override
diff --git a/components/camel-spring/src/test/java/org/apache/camel/spring/DisableJmxAgentTest.java b/components/camel-spring/src/test/java/org/apache/camel/spring/DisableJmxAgentTest.java
index da146df47b06a..bb38e1dbd43cd 100644
--- a/components/camel-spring/src/test/java/org/apache/camel/spring/DisableJmxAgentTest.java
+++ b/components/camel-spring/src/test/java/org/apache/camel/spring/DisableJmxAgentTest.java
@@ -36,8 +36,15 @@ protected AbstractXmlApplicationContext createApplicationContext() {
@Override
public void testQueryMbeans() throws Exception {
- assertEquals(0, mbsc.queryNames(new ObjectName("org.apache.camel" + ":type=routes,*"), null).size());
- assertEquals(0, mbsc.queryNames(new ObjectName("org.apache.camel" + ":type=processors,*"), null).size());
+ // whats the numbers before, because the JVM can have left overs when unit testing
+ int before = mbsc.queryNames(new ObjectName("org.apache.camel" + ":type=consumers,*"), null).size();
+
+ // start route should enlist the consumer to JMX if JMX was enabled
+ context.startRoute("foo");
+
+ int after = mbsc.queryNames(new ObjectName("org.apache.camel" + ":type=consumers,*"), null).size();
+
+ assertEquals("Should not have added consumer to JMX", before, after);
}
}
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/defaultJmxConfig.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/defaultJmxConfig.xml
index a17858b5d3c8c..252998f2de2a6 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/defaultJmxConfig.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/defaultJmxConfig.xml
@@ -24,7 +24,7 @@
<!-- START SNIPPET: example -->
<camelContext xmlns="http://camel.apache.org/schema/spring">
- <route>
+ <route id="foo" autoStartup="false">
<from uri="seda:start"/>
<to uri="mock:result"/>
</route>
diff --git a/components/camel-spring/src/test/resources/org/apache/camel/spring/disableJmxConfig.xml b/components/camel-spring/src/test/resources/org/apache/camel/spring/disableJmxConfig.xml
index d5758c1b83f62..3a3a1c663b448 100644
--- a/components/camel-spring/src/test/resources/org/apache/camel/spring/disableJmxConfig.xml
+++ b/components/camel-spring/src/test/resources/org/apache/camel/spring/disableJmxConfig.xml
@@ -26,7 +26,7 @@
<camelContext xmlns="http://camel.apache.org/schema/spring">
<jmxAgent id="agent" disabled="true"/>
- <route>
+ <route id="foo" autoStartup="false">
<from uri="seda:start"/>
<to uri="mock:result"/>
</route>
|
c556f1fbabca3faedb55f3e05531d2ca9daa517a
|
Delta Spike
|
DELTASPIKE-289 JavaDoc + make unit tests fit api packages
|
p
|
https://github.com/apache/deltaspike
|
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
index 1337b29cc..abeb04145 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
@@ -170,6 +170,11 @@ public void destroyAllActive(ContextualStorage storage)
}
}
+ /**
+ * Make sure that the Context is really active.
+ * @throws ContextNotActiveException if there is no active
+ * Context for the current Thread.
+ */
protected void checkActive()
{
if (!isActive())
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/DefaultWindowContext.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/DefaultWindowContext.java
index ac27fea1f..bdd6cfde2 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/DefaultWindowContext.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/DefaultWindowContext.java
@@ -92,9 +92,11 @@ public boolean closeCurrentWindowContext()
@Override
public synchronized void destroy()
{
- Map<String, ContextualStorage> windowContexts = windowBeanHolder.newStorageMap();
+ // we replace the old windowBeanHolder beans with a new storage Map
+ // an afterwards destroy the old Beans without having to care about any syncs.
+ Map<String, ContextualStorage> oldWindowContextStorages = windowBeanHolder.forceNewStorage();
- for (ContextualStorage contextualStorage : windowContexts.values())
+ for (ContextualStorage contextualStorage : oldWindowContextStorages.values())
{
destroyAllActive(contextualStorage);
}
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowBeanHolder.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowBeanHolder.java
index 791b1c352..fbdd27bc4 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowBeanHolder.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/scope/window/WindowBeanHolder.java
@@ -27,13 +27,18 @@
import org.apache.deltaspike.core.util.context.ContextualStorage;
/**
- * This holder will store the window Ids for the current
+ * This holder will store the window Ids and it's beans for the current
* Session. We use standard SessionScoped bean to not need
* to treat async-supported and similar headache.
*/
@SessionScoped
public class WindowBeanHolder implements Serializable
{
+ /**
+ * key: the windowId for the browser tab or window
+ * value: the {@link ContextualStorage} which holds all the
+ * {@link javax.enterprise.inject.spi.Bean}s.
+ */
private volatile Map<String, ContextualStorage> storageMap = new ConcurrentHashMap<String, ContextualStorage>();
public Map<String, ContextualStorage> getStorageMap()
@@ -44,6 +49,8 @@ public Map<String, ContextualStorage> getStorageMap()
/**
* This method will return the ContextualStorage or create a new one
* if no one is yet assigned to the current windowId.
+ * @param beanManager we need the CDI {@link BeanManager} for serialisation.
+ * @param windowId the windowId for the current browser tab or window.
*/
public ContextualStorage getContextualStorage(BeanManager beanManager, String windowId)
{
@@ -63,7 +70,17 @@ public ContextualStorage getContextualStorage(BeanManager beanManager, String wi
return contextualStorage;
}
- public Map<String, ContextualStorage> newStorageMap()
+ /**
+ *
+ * This method will replace the storageMap and with
+ * a new empty one.
+ * This method can be used to properly destroy the WindowBeanHolder beans
+ * without having to sync heavily. Any
+ * {@link javax.enterprise.inject.spi.Bean#destroy(Object, javax.enterprise.context.spi.CreationalContext)}
+ * should be performed on the returned old storage map.
+ * @return the old storageMap.
+ */
+ public Map<String, ContextualStorage> forceNewStorage()
{
Map<String, ContextualStorage> oldStorageMap = storageMap;
storageMap = new ConcurrentHashMap<String, ContextualStorage>();
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/AbstractContextTest.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/AbstractContextTest.java
similarity index 98%
rename from deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/AbstractContextTest.java
rename to deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/AbstractContextTest.java
index f8e464a11..360ab8090 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/AbstractContextTest.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/AbstractContextTest.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.deltaspike.test.core.api.context;
+package org.apache.deltaspike.test.core.api.util.context;
import javax.enterprise.inject.spi.Extension;
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyBean.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyBean.java
similarity index 89%
rename from deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyBean.java
rename to deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyBean.java
index 7498572f6..ba5712203 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyBean.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyBean.java
@@ -16,12 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.deltaspike.test.core.api.context;
+package org.apache.deltaspike.test.core.api.util.context;
import java.io.Serializable;
-import org.apache.deltaspike.test.core.api.context.DummyScoped;
-
/**
*/
@DummyScoped
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyContext.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyContext.java
similarity index 97%
rename from deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyContext.java
rename to deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyContext.java
index 4a1df5642..31efeb773 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyContext.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyContext.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.deltaspike.test.core.api.context;
+package org.apache.deltaspike.test.core.api.util.context;
import javax.enterprise.inject.spi.BeanManager;
import java.lang.annotation.Annotation;
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyScopeExtension.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyScopeExtension.java
similarity index 95%
rename from deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyScopeExtension.java
rename to deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyScopeExtension.java
index cd81a35a2..9163c6633 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyScopeExtension.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyScopeExtension.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.deltaspike.test.core.api.context;
+package org.apache.deltaspike.test.core.api.util.context;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyScoped.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyScoped.java
similarity index 95%
rename from deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyScoped.java
rename to deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyScoped.java
index a33b4db8a..f8fea08f3 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/context/DummyScoped.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/core/api/util/context/DummyScoped.java
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.deltaspike.test.core.api.context;
+package org.apache.deltaspike.test.core.api.util.context;
import javax.enterprise.context.NormalScope;
import java.lang.annotation.Documented;
diff --git a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
index 4a2c818dc..2be1e05fd 100644
--- a/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
+++ b/deltaspike/core/impl/src/test/java/org/apache/deltaspike/test/util/ArchiveUtils.java
@@ -23,9 +23,9 @@
import java.util.List;
import org.apache.deltaspike.test.category.WebProfileCategory;
-import org.apache.deltaspike.test.core.api.context.DummyContext;
-import org.apache.deltaspike.test.core.api.context.DummyScopeExtension;
-import org.apache.deltaspike.test.core.api.context.DummyScoped;
+import org.apache.deltaspike.test.core.api.util.context.DummyContext;
+import org.apache.deltaspike.test.core.api.util.context.DummyScopeExtension;
+import org.apache.deltaspike.test.core.api.util.context.DummyScoped;
import org.apache.deltaspike.test.utils.ShrinkWrapArchiveUtil;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.jboss.shrinkwrap.api.spec.JavaArchive;
diff --git a/deltaspike/core/impl/src/test/resources/META-INF/services/javax.enterprise.inject.spi.Extension b/deltaspike/core/impl/src/test/resources/META-INF/services/javax.enterprise.inject.spi.Extension
index 1abc48a63..bd37f1edf 100644
--- a/deltaspike/core/impl/src/test/resources/META-INF/services/javax.enterprise.inject.spi.Extension
+++ b/deltaspike/core/impl/src/test/resources/META-INF/services/javax.enterprise.inject.spi.Extension
@@ -22,4 +22,4 @@
# used arquillian-containerx connectors implement this properly!
# registers the DummyScope for the AbstractContextTest
-org.apache.deltaspike.test.core.api.context.DummyScopeExtension
+org.apache.deltaspike.test.core.api.util.context.DummyScopeExtension
|
725819d618d7f1bb614ca64968c08f60cf52d989
|
Search_api
|
Issue #2100231 by drunken monkey: Renamed "Workflow" tab to "Filters".
|
a
|
https://github.com/lucidworks/drupal_search_api
|
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 81bf5ca9..8f0ca26b 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,5 +1,6 @@
Search API 1.x, dev (xx/xx/xxxx):
---------------------------------
+- #2100231 by drunken monkey: Renamed "Workflow" tab to "Filters".
- #2100193 by drunken monkey: Turned operations in overview into D8 dropbuttons.
- #2100199 by drunken monkey: Merged index tabs for a cleaner look.
- #2115127 by drunken monkey: Fixed cron indexing logic to keep the right order.
diff --git a/README.txt b/README.txt
index 6ea62520..2e2f581f 100644
--- a/README.txt
+++ b/README.txt
@@ -90,7 +90,7 @@ IMPORTANT: Access checks
results are displayed – either by only indexing such items, or by filtering
appropriately at search time.
For search on general site content (item type "Node"), this is already
- supported by the Search API. To enable this, go to the index's "Workflow" tab
+ supported by the Search API. To enable this, go to the index's "Filters" tab
and activate the "Node access" data alteration. This will add the necessary
field, "Node access information", to the index (which you have to leave as
"indexed"). If both this field and "Published" are set to be indexed, access
@@ -171,8 +171,8 @@ form at the bottom of the page. For instance, you might want to index the
author's username to the indexed data of a node, and you need to add the "Body"
entity to the node when you want to index the actual text it contains.
-- Index workflow
- (Configuration > Search API > [Index name] > Workflow)
+- Indexing workflow
+ (Configuration > Search API > [Index name] > Filters)
This page lets you customize how the created index works, and what metadata will
be available, by selecting data alterations and processors (see the glossary for
diff --git a/includes/callback.inc b/includes/callback.inc
index c05260e9..ea161fbd 100644
--- a/includes/callback.inc
+++ b/includes/callback.inc
@@ -26,7 +26,7 @@ interface SearchApiAlterCallbackInterface {
/**
* Check whether this data-alter callback is applicable for a certain index.
*
- * This can be used for hiding the callback on the index's "Workflow" tab. To
+ * This can be used for hiding the callback on the index's "Filters" tab. To
* avoid confusion, you should only use criteria that are immutable, such as
* the index's entity type. Also, since this is only used for UI purposes, you
* should not completely rely on this to ensure certain index configurations
diff --git a/includes/processor.inc b/includes/processor.inc
index 1774bf19..1b41f3d8 100644
--- a/includes/processor.inc
+++ b/includes/processor.inc
@@ -27,7 +27,7 @@ interface SearchApiProcessorInterface {
/**
* Check whether this processor is applicable for a certain index.
*
- * This can be used for hiding the processor on the index's "Workflow" tab. To
+ * This can be used for hiding the processor on the index's "Filters" tab. To
* avoid confusion, you should only use criteria that are immutable, such as
* the index's item type. Also, since this is only used for UI purposes, you
* should not completely rely on this to ensure certain index configurations
diff --git a/search_api.admin.inc b/search_api.admin.inc
index 8f95dee9..0630818b 100644
--- a/search_api.admin.inc
+++ b/search_api.admin.inc
@@ -1034,8 +1034,7 @@ function search_api_admin_index_edit_submit(array $form, array &$form_state) {
}
/**
- * Edit an index' workflow (data alter callbacks, pre-/postprocessors, and their
- * order).
+ * Form constructor for editing an index's data alterations and processors.
*
* @param SearchApiIndex $index
* The index to edit.
@@ -1378,8 +1377,7 @@ function search_api_admin_index_workflow_submit(array $form, array &$form_state)
$index->save();
$index->reindex();
- drupal_set_message(t("The search index' workflow was successfully edited. " .
- 'All content was scheduled for re-indexing so the new settings can take effect.'));
+ drupal_set_message(t("The indexing workflow was successfully edited. All content was scheduled for re-indexing so the new settings can take effect."));
}
else {
drupal_set_message(t('No values were changed.'));
@@ -1792,7 +1790,7 @@ function search_api_admin_index_fields_submit(array $form, array &$form_state) {
$form_state['redirect'] = 'admin/config/search/search_api/index/' . $index->machine_name . '/fields';
}
else {
- drupal_set_message(t('Please set up the index workflow.'));
+ drupal_set_message(t('Please set up the indexing workflow.'));
$form_state['redirect'] = 'admin/config/search/search_api/index/' . $index->machine_name . '/workflow';
}
return;
diff --git a/search_api.module b/search_api.module
index eed68519..d5307e44 100644
--- a/search_api.module
+++ b/search_api.module
@@ -133,8 +133,8 @@ function search_api_menu() {
'weight' => -4,
);
$items[$pre . '/index/%search_api_index/workflow'] = array(
- 'title' => 'Workflow',
- 'description' => 'Edit index workflow.',
+ 'title' => 'Filters',
+ 'description' => 'Edit indexing workflow.',
'page callback' => 'drupal_get_form',
'page arguments' => array('search_api_admin_index_workflow', 5),
'access arguments' => array('administer search_api'),
diff --git a/search_api.test b/search_api.test
index a000b1aa..9e098aab 100644
--- a/search_api.test
+++ b/search_api.test
@@ -244,7 +244,7 @@ class SearchApiWebTest extends DrupalWebTestCase {
'callbacks[search_api_alter_add_aggregation][settings][fields][search_api_aggregation_1][fields][parent:body]' => 1,
);
$this->drupalPost(NULL, $values, t('Save configuration'));
- $this->assertText(t("The search index' workflow was successfully edited. All content was scheduled for re-indexing so the new settings can take effect."), 'Workflow successfully edited.');
+ $this->assertText(t("The indexing workflow was successfully edited. All content was scheduled for re-indexing so the new settings can take effect."), 'Workflow successfully edited.');
$this->drupalGet("admin/config/search/search_api/index/$id");
$this->assertTitle('Search API test index | Drupal', 'Correct title when viewing index.');
|
eee27a89faa533249f7b3aad7af23c0fd61dfc6e
|
Valadoc
|
signals: collect default implementations
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/src/driver/0.16.x/treebuilder.vala b/src/driver/0.16.x/treebuilder.vala
index 54458a12b0..5e342a20bc 100644
--- a/src/driver/0.16.x/treebuilder.vala
+++ b/src/driver/0.16.x/treebuilder.vala
@@ -1291,6 +1291,7 @@ element);
get_access_modifier (element),
comment,
get_cname (element),
+ (element.default_handler != null)? get_cname (element.default_handler) : null,
Vala.GDBusModule.get_dbus_name_for_member (element),
Vala.GDBusServerModule.is_dbus_visible (element),
element.is_virtual,
diff --git a/src/driver/0.18.x/treebuilder.vala b/src/driver/0.18.x/treebuilder.vala
index 43ec86038b..81b5d34aae 100644
--- a/src/driver/0.18.x/treebuilder.vala
+++ b/src/driver/0.18.x/treebuilder.vala
@@ -1283,6 +1283,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
get_access_modifier (element),
comment,
get_cname (element),
+ (element.default_handler != null)? get_cname (element.default_handler) : null,
Vala.GDBusModule.get_dbus_name_for_member (element),
Vala.GDBusServerModule.is_dbus_visible (element),
element.is_virtual,
diff --git a/src/driver/0.20.x/treebuilder.vala b/src/driver/0.20.x/treebuilder.vala
index 06c5845642..a855505157 100644
--- a/src/driver/0.20.x/treebuilder.vala
+++ b/src/driver/0.20.x/treebuilder.vala
@@ -1285,6 +1285,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
get_access_modifier (element),
comment,
get_cname (element),
+ (element.default_handler != null)? get_cname (element.default_handler) : null,
Vala.GDBusModule.get_dbus_name_for_member (element),
Vala.GDBusServerModule.is_dbus_visible (element),
element.is_virtual,
diff --git a/src/driver/0.22.x/treebuilder.vala b/src/driver/0.22.x/treebuilder.vala
index 32f9b849ca..03cfe05c0b 100644
--- a/src/driver/0.22.x/treebuilder.vala
+++ b/src/driver/0.22.x/treebuilder.vala
@@ -1285,6 +1285,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
get_access_modifier (element),
comment,
get_cname (element),
+ (element.default_handler != null)? get_cname (element.default_handler) : null,
Vala.GDBusModule.get_dbus_name_for_member (element),
Vala.GDBusServerModule.is_dbus_visible (element),
element.is_virtual,
diff --git a/src/driver/0.24.x/treebuilder.vala b/src/driver/0.24.x/treebuilder.vala
index 7210711440..76e52c0cd5 100644
--- a/src/driver/0.24.x/treebuilder.vala
+++ b/src/driver/0.24.x/treebuilder.vala
@@ -1285,6 +1285,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
get_access_modifier (element),
comment,
get_cname (element),
+ (element.default_handler != null)? get_cname (element.default_handler) : null,
Vala.GDBusModule.get_dbus_name_for_member (element),
Vala.GDBusServerModule.is_dbus_visible (element),
element.is_virtual,
diff --git a/src/driver/0.26.x/treebuilder.vala b/src/driver/0.26.x/treebuilder.vala
index f703e02530..f37b1532cd 100644
--- a/src/driver/0.26.x/treebuilder.vala
+++ b/src/driver/0.26.x/treebuilder.vala
@@ -1285,6 +1285,7 @@ public class Valadoc.Drivers.TreeBuilder : Vala.CodeVisitor {
get_access_modifier (element),
comment,
get_cname (element),
+ (element.default_handler != null)? get_cname (element.default_handler) : null,
Vala.GDBusModule.get_dbus_name_for_member (element),
Vala.GDBusModule.is_dbus_visible (element),
element.is_virtual,
diff --git a/src/libvaladoc/api/signal.vala b/src/libvaladoc/api/signal.vala
index 646e71cfb7..4bbbb2320e 100644
--- a/src/libvaladoc/api/signal.vala
+++ b/src/libvaladoc/api/signal.vala
@@ -28,6 +28,7 @@ using Valadoc.Content;
* Represents an signal.
*/
public class Valadoc.Api.Signal : Member, Callable {
+ private string? default_impl_cname;
private string? dbus_name;
private string? cname;
@@ -42,11 +43,12 @@ public class Valadoc.Api.Signal : Member, Callable {
public Signal (Node parent, SourceFile file, string name, SymbolAccessibility accessibility,
- SourceComment? comment, string? cname, string? dbus_name, bool is_dbus_visible,
+ SourceComment? comment, string? cname, string? default_impl_cname, string? dbus_name, bool is_dbus_visible,
bool is_virtual, void* data)
{
base (parent, file, name, accessibility, comment, data);
+ this.default_impl_cname = default_impl_cname;
this.dbus_name = dbus_name;
this.cname = cname;
@@ -61,6 +63,10 @@ public class Valadoc.Api.Signal : Member, Callable {
return cname;
}
+ public string? get_default_impl_cname () {
+ return default_impl_cname;
+ }
+
/**
* Returns the dbus-name.
*/
|
034047b601b9069b2ddef56a8476f13f9138d5e4
|
apache$hama
|
[HAMA-596]:Optimize memory usage of graph job
git-svn-id: https://svn.apache.org/repos/asf/hama/trunk@1383326 13f79535-47bb-0310-9956-ffa450edef68
|
p
|
https://github.com/apache/hama
|
diff --git a/CHANGES.txt b/CHANGES.txt
index d30a8c1dc..7dc4dfc75 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -13,6 +13,7 @@ Release 0.6 (unreleased changes)
IMPROVEMENTS
+ HAMA-596: Optimize memory usage of graph job (tjungblut)
HAMA-599: Improvement of network-based runtime partitioner (edwardyoon)
Release 0.5 - April 10, 2012
diff --git a/core/src/main/java/org/apache/hama/bsp/BSPPeerImpl.java b/core/src/main/java/org/apache/hama/bsp/BSPPeerImpl.java
index c88a2a66a..00e51272a 100644
--- a/core/src/main/java/org/apache/hama/bsp/BSPPeerImpl.java
+++ b/core/src/main/java/org/apache/hama/bsp/BSPPeerImpl.java
@@ -344,10 +344,15 @@ public final void initInput() throws IOException {
/**
* @return the size of assigned split
*/
+ @Override
public long getSplitSize() {
return splitSize;
}
+ /**
+ * @return the position in the input stream.
+ */
+ @Override
public long getPos() throws IOException {
return in.getPos();
}
diff --git a/core/src/main/java/org/apache/hama/bsp/LocalBSPRunner.java b/core/src/main/java/org/apache/hama/bsp/LocalBSPRunner.java
index 97113ec04..93400f1fe 100644
--- a/core/src/main/java/org/apache/hama/bsp/LocalBSPRunner.java
+++ b/core/src/main/java/org/apache/hama/bsp/LocalBSPRunner.java
@@ -20,11 +20,10 @@
import java.io.DataInputStream;
import java.io.IOException;
import java.net.InetSocketAddress;
-import java.util.LinkedList;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CyclicBarrier;
-import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorCompletionService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadPoolExecutor;
@@ -64,9 +63,6 @@ public class LocalBSPRunner implements JobSubmissionProtocol {
private static String WORKING_DIR = "/tmp/hama-bsp/";
private volatile ThreadPoolExecutor threadPool;
- @SuppressWarnings("rawtypes")
- private static final LinkedList<Future<BSPPeerImpl>> FUTURE_LIST = new LinkedList<Future<BSPPeerImpl>>();
-
private String jobFile;
private String jobName;
@@ -145,16 +141,19 @@ public JobStatus submitJob(BSPJobID jobID, String jobFile) throws IOException {
}
threadPool = (ThreadPoolExecutor) Executors.newFixedThreadPool(numBspTask);
+ @SuppressWarnings("rawtypes")
+ ExecutorCompletionService<BSPPeerImpl> completionService = new ExecutorCompletionService<BSPPeerImpl>(
+ threadPool);
peerNames = new String[numBspTask];
for (int i = 0; i < numBspTask; i++) {
peerNames[i] = "local:" + i;
- FUTURE_LIST.add(threadPool.submit(new BSPRunner(new Configuration(conf),
- job, i, splits)));
+ completionService.submit(new BSPRunner(new Configuration(conf), job, i,
+ splits));
globalCounters.incrCounter(JobInProgress.JobCounter.LAUNCHED_TASKS, 1L);
}
- new Thread(new ThreadObserver(currentJobStatus)).start();
+ new Thread(new ThreadObserver(numBspTask, completionService)).start();
return currentJobStatus;
}
@@ -233,7 +232,6 @@ public BSPRunner(Configuration conf, BSPJob job, int id, RawSplit[] splits) {
}
- // deprecated until 0.5.0, then it will be removed.
@SuppressWarnings("unchecked")
public void run() throws Exception {
@@ -287,29 +285,34 @@ public BSPPeerImpl call() throws Exception {
}
// this thread observes the status of the runners.
+ @SuppressWarnings("rawtypes")
class ThreadObserver implements Runnable {
- final JobStatus status;
+ private final ExecutorCompletionService<BSPPeerImpl> completionService;
+ private final int numTasks;
+
+ public ThreadObserver(int numTasks,
- public ThreadObserver(JobStatus currentJobStatus) {
- this.status = currentJobStatus;
+ ExecutorCompletionService<BSPPeerImpl> completionService) {
+ this.numTasks = numTasks;
+ this.completionService = completionService;
}
- @SuppressWarnings("rawtypes")
@Override
public void run() {
boolean success = true;
- for (Future<BSPPeerImpl> future : FUTURE_LIST) {
+
+ for (int i = 0; i < numTasks; i++) {
try {
- BSPPeerImpl bspPeerImpl = future.get();
- currentJobStatus.getCounter().incrAllCounters(
- bspPeerImpl.getCounters());
- } catch (InterruptedException e) {
- LOG.error("Exception during BSP execution!", e);
- success = false;
- } catch (ExecutionException e) {
+ Future<BSPPeerImpl> take = completionService.take();
+ if (take != null) {
+ currentJobStatus.getCounter().incrAllCounters(
+ take.get().getCounters());
+ }
+ } catch (Exception e) {
LOG.error("Exception during BSP execution!", e);
success = false;
+ break;
}
}
if (success) {
@@ -321,7 +324,6 @@ public void run() {
}
threadPool.shutdownNow();
}
-
}
public static class LocalMessageManager<M extends Writable> extends
diff --git a/core/src/main/java/org/apache/hama/bsp/message/MemoryQueue.java b/core/src/main/java/org/apache/hama/bsp/message/MemoryQueue.java
index df10493c7..451cea7ef 100644
--- a/core/src/main/java/org/apache/hama/bsp/message/MemoryQueue.java
+++ b/core/src/main/java/org/apache/hama/bsp/message/MemoryQueue.java
@@ -17,10 +17,10 @@
*/
package org.apache.hama.bsp.message;
+import java.util.ArrayDeque;
import java.util.Collection;
import java.util.Deque;
import java.util.Iterator;
-import java.util.LinkedList;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Writable;
@@ -31,7 +31,7 @@
*/
public final class MemoryQueue<M extends Writable> implements MessageQueue<M> {
- private final Deque<M> deque = new LinkedList<M>();
+ private final Deque<M> deque = new ArrayDeque<M>();
private Configuration conf;
@Override
diff --git a/graph/src/main/java/org/apache/hama/graph/Edge.java b/graph/src/main/java/org/apache/hama/graph/Edge.java
index 64220d7a9..f14f0da19 100644
--- a/graph/src/main/java/org/apache/hama/graph/Edge.java
+++ b/graph/src/main/java/org/apache/hama/graph/Edge.java
@@ -27,7 +27,6 @@ public final class Edge<VERTEX_ID extends Writable, EDGE_VALUE_TYPE extends Writ
private final VERTEX_ID destinationVertexID;
private final EDGE_VALUE_TYPE cost;
- String destinationPeerName;
public Edge(VERTEX_ID sourceVertexID, EDGE_VALUE_TYPE cost) {
this.destinationVertexID = sourceVertexID;
@@ -38,32 +37,16 @@ public Edge(VERTEX_ID sourceVertexID, EDGE_VALUE_TYPE cost) {
}
}
- public Edge(VERTEX_ID sourceVertexID, String destinationPeer,
- EDGE_VALUE_TYPE cost) {
- this.destinationVertexID = sourceVertexID;
- destinationPeerName = destinationPeer;
- if (cost instanceof NullWritable) {
- this.cost = null;
- } else {
- this.cost = cost;
- }
- }
-
public VERTEX_ID getDestinationVertexID() {
return destinationVertexID;
}
- public String getDestinationPeerName() {
- return destinationPeerName;
- }
-
public EDGE_VALUE_TYPE getValue() {
return cost;
}
@Override
public String toString() {
- return this.destinationVertexID + ":" + this.getValue() + " (resides on "
- + destinationPeerName + ")";
+ return this.destinationVertexID + ":" + this.getValue();
}
}
diff --git a/graph/src/main/java/org/apache/hama/graph/GraphJobMessage.java b/graph/src/main/java/org/apache/hama/graph/GraphJobMessage.java
index 06ea4c072..70b469f1b 100644
--- a/graph/src/main/java/org/apache/hama/graph/GraphJobMessage.java
+++ b/graph/src/main/java/org/apache/hama/graph/GraphJobMessage.java
@@ -107,7 +107,6 @@ public void write(DataOutput out) throws IOException {
out.writeInt(outEdges.size());
for (Object e : outEdges) {
Edge<?, ?> edge = (Edge<?, ?>) e;
- out.writeUTF(edge.getDestinationPeerName());
edge.getDestinationVertexID().write(out);
if (edge.getValue() != null) {
out.writeBoolean(true);
@@ -136,7 +135,7 @@ public void readFields(DataInput in) throws IOException {
map = new MapWritable();
map.readFields(in);
} else if (isPartitioningMessage()) {
- Vertex<Writable, Writable, Writable> vertex = GraphJobRunner
+ Vertex<Writable, Writable, Writable> vertex = GraphJobRunnerBase
.newVertexInstance(VERTEX_CLASS, null);
Writable vertexId = ReflectionUtils.newInstance(VERTEX_ID_CLASS, null);
vertexId.readFields(in);
@@ -150,7 +149,6 @@ public void readFields(DataInput in) throws IOException {
int size = in.readInt();
vertex.setEdges(new ArrayList<Edge<Writable, Writable>>(size));
for (int i = 0; i < size; i++) {
- String destination = in.readUTF();
Writable edgeVertexID = ReflectionUtils.newInstance(VERTEX_ID_CLASS,
null);
edgeVertexID.readFields(in);
@@ -160,7 +158,7 @@ public void readFields(DataInput in) throws IOException {
edgeValue.readFields(in);
}
vertex.getEdges().add(
- new Edge<Writable, Writable>(edgeVertexID, destination, edgeValue));
+ new Edge<Writable, Writable>(edgeVertexID, edgeValue));
}
this.vertex = vertex;
} else if (isVerticesSizeMessage()) {
diff --git a/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java b/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
index 85580f7c0..cd15d87bc 100644
--- a/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
+++ b/graph/src/main/java/org/apache/hama/graph/GraphJobRunner.java
@@ -48,6 +48,7 @@ public final class GraphJobRunner<V extends Writable, E extends Writable, M exte
public final void setup(
BSPPeer<Writable, Writable, Writable, Writable, GraphJobMessage> peer)
throws IOException, SyncException, InterruptedException {
+ this.peer = peer;
this.conf = peer.getConfiguration();
// Choose one as a master to collect global updates
this.masterTask = peer.getPeerName(0);
@@ -116,8 +117,9 @@ public final void setup(
.newInstance(conf.getClass(GraphJob.VERTEX_GRAPH_INPUT_READER,
VertexInputReader.class), conf);
- loadVertices(peer, repairNeeded, runtimePartitioning, partitioner, reader, this);
-
+ loadVertices(peer, repairNeeded, runtimePartitioning, partitioner, reader,
+ this);
+
for (String peerName : peer.getAllPeerNames()) {
peer.send(peerName, new GraphJobMessage(new IntWritable(vertices.size())));
}
@@ -130,7 +132,7 @@ public final void setup(
numberVertices += msg.getVerticesSize().get();
}
}
-
+
// TODO refactor this to a single step
for (Entry<V, Vertex<V, E, M>> e : vertices.entrySet()) {
LinkedList<M> msgIterator = new LinkedList<M>();
diff --git a/graph/src/main/java/org/apache/hama/graph/GraphJobRunnerBase.java b/graph/src/main/java/org/apache/hama/graph/GraphJobRunnerBase.java
index a741ca40c..8b8fe9430 100644
--- a/graph/src/main/java/org/apache/hama/graph/GraphJobRunnerBase.java
+++ b/graph/src/main/java/org/apache/hama/graph/GraphJobRunnerBase.java
@@ -89,6 +89,8 @@ public abstract class GraphJobRunnerBase<V extends Writable, E extends Writable,
protected Class<E> edgeValueClass;
protected Class<Vertex<V, E, M>> vertexClass;
+ protected BSPPeer<Writable, Writable, Writable, Writable, GraphJobMessage> peer;
+
@SuppressWarnings("unchecked")
protected void loadVertices(
BSPPeer<Writable, Writable, Writable, Writable, GraphJobMessage> peer,
@@ -107,7 +109,6 @@ protected void loadVertices(
LOG.debug("vertex class: " + vertexClass);
boolean selfReference = conf.getBoolean("hama.graph.self.ref", false);
Vertex<V, E, M> vertex = newVertexInstance(vertexClass, conf);
- vertex.setPeer(peer);
vertex.runner = graphJobRunner;
long startPos = peer.getPos();
@@ -127,27 +128,17 @@ protected void loadVertices(
vertex.setEdges(new ArrayList<Edge<V, E>>(0));
}
if (selfReference) {
- vertex.addEdge(new Edge<V, E>(vertex.getVertexID(), peer.getPeerName(),
- null));
+ vertex.addEdge(new Edge<V, E>(vertex.getVertexID(), null));
}
if (runtimePartitioning) {
int partition = partitioner.getPartition(vertex.getVertexID(),
vertex.getValue(), peer.getNumPeers());
- // set the destination name for the edge now
- for (Edge<V, E> edge : vertex.getEdges()) {
- int edgePartition = partitioner.getPartition(
- edge.getDestinationVertexID(), (M) edge.getValue(),
- peer.getNumPeers());
- edge.destinationPeerName = peer.getPeerName(edgePartition);
- }
peer.send(peer.getPeerName(partition), new GraphJobMessage(vertex));
} else {
- // FIXME need to set destination names
vertex.setup(conf);
vertices.put(vertex.getVertexID(), vertex);
}
vertex = newVertexInstance(vertexClass, conf);
- vertex.setPeer(peer);
vertex.runner = graphJobRunner;
if (runtimePartitioning) {
@@ -157,7 +148,6 @@ protected void loadVertices(
GraphJobMessage msg = null;
while ((msg = peer.getCurrentMessage()) != null) {
Vertex<V, E, M> messagedVertex = (Vertex<V, E, M>) msg.getVertex();
- messagedVertex.setPeer(peer);
messagedVertex.runner = graphJobRunner;
messagedVertex.setup(conf);
vertices.put(messagedVertex.getVertexID(), messagedVertex);
@@ -173,7 +163,6 @@ protected void loadVertices(
GraphJobMessage msg = null;
while ((msg = peer.getCurrentMessage()) != null) {
Vertex<V, E, M> messagedVertex = (Vertex<V, E, M>) msg.getVertex();
- messagedVertex.setPeer(peer);
messagedVertex.runner = graphJobRunner;
messagedVertex.setup(conf);
vertices.put(messagedVertex.getVertexID(), messagedVertex);
@@ -238,8 +227,9 @@ protected void loadVertices(
int i = 0;
int syncs = 0;
for (V v : keys) {
+ Vertex<V, E, M> vertex2 = vertices.get(v);
for (Edge<V, E> e : vertices.get(v).getEdges()) {
- peer.send(e.getDestinationPeerName(),
+ peer.send(vertex2.getDestinationPeerName(e),
new GraphJobMessage(e.getDestinationVertexID()));
}
@@ -251,16 +241,11 @@ protected void loadVertices(
V vertexName = (V) msg.getVertexId();
if (!vertices.containsKey(vertexName)) {
Vertex<V, E, M> newVertex = newVertexInstance(vertexClass, conf);
- newVertex.setPeer(peer);
newVertex.setVertexID(vertexName);
newVertex.runner = graphJobRunner;
if (selfReference) {
- int partition = partitioner.getPartition(
- newVertex.getVertexID(), newVertex.getValue(),
- peer.getNumPeers());
- String target = peer.getPeerName(partition);
newVertex.setEdges(Collections.singletonList(new Edge<V, E>(
- newVertex.getVertexID(), target, null)));
+ newVertex.getVertexID(), null)));
} else {
newVertex.setEdges(new ArrayList<Edge<V, E>>(0));
}
@@ -278,15 +263,11 @@ protected void loadVertices(
V vertexName = (V) msg.getVertexId();
if (!vertices.containsKey(vertexName)) {
Vertex<V, E, M> newVertex = newVertexInstance(vertexClass, conf);
- newVertex.setPeer(peer);
newVertex.setVertexID(vertexName);
newVertex.runner = graphJobRunner;
if (selfReference) {
- int partition = partitioner.getPartition(newVertex.getVertexID(),
- newVertex.getValue(), peer.getNumPeers());
- String target = peer.getPeerName(partition);
newVertex.setEdges(Collections.singletonList(new Edge<V, E>(
- newVertex.getVertexID(), target, null)));
+ newVertex.getVertexID(), null)));
} else {
newVertex.setEdges(new ArrayList<Edge<V, E>>(0));
}
@@ -477,4 +458,8 @@ public final IntWritable getNumLastAggregatedVertices(int index) {
return globalAggregatorIncrement[index];
}
+ public BSPPeer<Writable, Writable, Writable, Writable, GraphJobMessage> getPeer() {
+ return peer;
+ }
+
}
diff --git a/graph/src/main/java/org/apache/hama/graph/Vertex.java b/graph/src/main/java/org/apache/hama/graph/Vertex.java
index ae54fbc27..0a8d0e3ef 100644
--- a/graph/src/main/java/org/apache/hama/graph/Vertex.java
+++ b/graph/src/main/java/org/apache/hama/graph/Vertex.java
@@ -30,16 +30,16 @@
public abstract class Vertex<V extends Writable, E extends Writable, M extends Writable>
implements VertexInterface<V, E, M> {
+ GraphJobRunner<?, ?, ?> runner;
+
private V vertexID;
private M value;
- protected GraphJobRunner<V, E, M> runner;
- private BSPPeer<Writable, Writable, Writable, Writable, GraphJobMessage> peer;
private List<Edge<V, E>> edges;
private boolean votedToHalt = false;
public Configuration getConf() {
- return peer.getConfiguration();
+ return runner.getPeer().getConfiguration();
}
@Override
@@ -53,10 +53,28 @@ public void setup(Configuration conf) {
@Override
public void sendMessage(Edge<V, E> e, M msg) throws IOException {
- peer.send(e.getDestinationPeerName(),
+ runner.getPeer().send(getDestinationPeerName(e),
new GraphJobMessage(e.getDestinationVertexID(), msg));
}
+ /**
+ * @return the destination peer name of the destination of the given directed
+ * edge.
+ */
+ public String getDestinationPeerName(Edge<V, E> edge) {
+ return getDestinationPeerName(edge.getDestinationVertexID());
+ }
+
+ /**
+ * @return the destination peer name of the given vertex id, determined by the
+ * partitioner.
+ */
+ public String getDestinationPeerName(V vertexId) {
+ return runner.getPeer().getPeerName(
+ getPartitioner().getPartition(vertexId, value,
+ runner.getPeer().getNumPeers()));
+ }
+
@Override
public void sendMessageToNeighbors(M msg) throws IOException {
final List<Edge<V, E>> outEdges = this.getEdges();
@@ -68,9 +86,10 @@ public void sendMessageToNeighbors(M msg) throws IOException {
@Override
public void sendMessage(V destinationVertexID, M msg) throws IOException {
int partition = getPartitioner().getPartition(destinationVertexID, msg,
- peer.getNumPeers());
- String destPeer = peer.getAllPeerNames()[partition];
- peer.send(destPeer, new GraphJobMessage(destinationVertexID, msg));
+ runner.getPeer().getNumPeers());
+ String destPeer = runner.getPeer().getAllPeerNames()[partition];
+ runner.getPeer().send(destPeer,
+ new GraphJobMessage(destinationVertexID, msg));
}
@Override
@@ -84,7 +103,7 @@ public void setEdges(List<Edge<V, E>> list) {
public void addEdge(Edge<V, E> edge) {
if (edges == null) {
- this.edges = new ArrayList<Edge<V, E>>();
+ this.edges = new ArrayList<Edge<V, E>>(1);
}
this.edges.add(edge);
}
@@ -138,23 +157,22 @@ public IntWritable getNumLastAggregatedVertices(int index) {
}
public int getNumPeers() {
- return peer.getNumPeers();
+ return runner.getPeer().getNumPeers();
}
/**
* Gives access to the BSP primitives and additional features by a peer.
*/
public BSPPeer<Writable, Writable, Writable, Writable, GraphJobMessage> getPeer() {
- return peer;
+ return runner.getPeer();
}
+ /**
+ * @return the configured partitioner instance to message vertices.
+ */
+ @SuppressWarnings("unchecked")
public Partitioner<V, M> getPartitioner() {
- return runner.getPartitioner();
- }
-
- void setPeer(
- BSPPeer<Writable, Writable, Writable, Writable, GraphJobMessage> peer) {
- this.peer = peer;
+ return (Partitioner<V, M>) runner.getPartitioner();
}
@Override
|
8d7fa596f1ee1b6a16dc5ba6a098682f0fecdfc0
|
coremedia$jangaroo-tools
|
Perforce is up again; submitting collected Jangaroo changes:
New syntax supported:
* Unary operator "~" (BITNOT)
* keywords "use", "namespace"
* "use namespace" directive
* namespaced member declarations
* namespaced property access: bean.namespace::property
* include and import without semicolon
* hex literals (0xFFFFFFFF) are now parsed as Long (Number in JS anyway)
* object literals in initializers (used to lead to "invalid label" in runtime). Adding brackets may fix other non-working initializers, too.
* "new MyClass" without brackets
* "delete bean.property" now is a boolean expression, not a statement
* ?: expressions allow object literals (but not for condition, which makes no sense and leads to syntactic ambigiouties)
* "dynamic" modifier, without making "dynamic" a keyword!
* added grace to duplicate declarations: seems to be "worst practice" to reuse catch variable.
Runtime:
* ignore imports at class member level
* ignore other syntax than imports on top level (e.g. "use namespace ...", annotation, ...)
New semantics supported:
* multiple catch clauses of different exception types are transformed to catch(e){if(is(e,Type1){...}else if (is(e,Type2){...}else{...}}
* include "file", now unit-tested!
* function-syntax type casts, now unit-tested!
* integer names for object literals ("{ 1: 'foo', 2: 'bar'}").
Fixes:
* operator precedence now according to reference
* annotation comment output: added missing braces output
* moved type cast detection from analyze phase to generate-code phase, because references to members declared after their usage were not detected (added unit test)
* refactored injection of code in BlockStatement: it is now done through a CodeGenerator call-back instead of as special cases inside BlockStatement. This pattern is used if a preceding construct has to generate code inside the following code block (parameter initializer, super call).
* simplified DotExpr code: it's arg2 is always an IdeExpr, centralized this type cast!
* added some more generics
Open issues:
* one the way to support other compilation units besides "class": "namespace" and "function" should also be possible!
[git-p4: depot-paths = "//coremedia/jangaroo/": change = 147255]
|
a
|
https://github.com/coremedia/jangaroo-tools
|
diff --git a/jooc/src/it-helper/it-parent/pom.xml b/jooc/src/it-helper/it-parent/pom.xml
index 521e1aecd..c322fabe3 100644
--- a/jooc/src/it-helper/it-parent/pom.xml
+++ b/jooc/src/it-helper/it-parent/pom.xml
@@ -126,6 +126,7 @@
enableassertions="${jooc.assert}">
<include name="**/*.as"/>
<exclude name="error/**/*.as"/>
+ <exclude name="**/*_fragment.as"/>
<src path="target/joo"/>
</jooc>
diff --git a/jooc/src/main/cup/net/jangaroo/jooc/joo.cup b/jooc/src/main/cup/net/jangaroo/jooc/joo.cup
index b0bac5484..bba1f81c4 100644
--- a/jooc/src/main/cup/net/jangaroo/jooc/joo.cup
+++ b/jooc/src/main/cup/net/jangaroo/jooc/joo.cup
@@ -16,7 +16,7 @@
/*
* JangarooScript LALR(1) Grammar for the CUP parser generator
*
- * Author: Andreas Gawecki
+ * Authors: Andreas Gawecki, Frank Wienberg
*/
package net.jangaroo.jooc;
@@ -79,12 +79,13 @@ terminal JooSymbol EACH, ELSE, ENUM, EXTENDS;
terminal JooSymbol FINAL, FINALLY, FOR, FUNCTION;
terminal JooSymbol GET, GOTO;
terminal JooSymbol IF, IMPLEMENTS, IMPORT, IN, INSTANCEOF, INTERFACE, INTERNAL, IS;
-terminal JooSymbol NEW;
+terminal JooSymbol NAMESPACE, NEW;
terminal JooSymbol OVERRIDE;
terminal JooSymbol PACKAGE, PRIVATE, PROTECTED, PUBLIC;
terminal JooSymbol REST, RETURN;
terminal JooSymbol SET, STATIC, SUPER, SWITCH, SYNCHRONIZED;
terminal JooSymbol THIS, THROW, THROWS, TRANSIENT, TRY, TYPEOF;
+terminal JooSymbol USE;
terminal JooSymbol VAR, VOID, VOLATILE;
terminal JooSymbol WHILE, WITH;
@@ -92,9 +93,10 @@ terminal JooSymbol PLUSPLUS, MINUSMINUS, PLUS, MINUS, NOT, DIV, MOD, MUL;
terminal JooSymbol LSHIFT, RSHIFT, URSHIFT;
terminal JooSymbol LT, GT, LTEQ, GTEQ;
terminal JooSymbol EQ, EQEQ, EQEQEQ, NOTEQ, NOTEQEQ;
-terminal JooSymbol AND, XOR, OR, ANDAND, OROR;
+terminal JooSymbol AND, BITNOT, XOR, OR, ANDAND, OROR;
terminal JooSymbol QUESTION, COLON, SEMICOLON, COMMA, DOT;
terminal JooSymbol MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ;
+terminal JooSymbol NAMESPACESEP;
terminal JooSymbol LSHIFTEQ, RSHIFTEQ, URSHIFTEQ;
terminal JooSymbol ANDEQ, XOREQ, OREQ;
terminal JooSymbol LPAREN, RPAREN, LBRACE, RBRACE, LBRACK, RBRACK;
@@ -124,6 +126,7 @@ nonterminal ArrayList classBodyDeclarations;
nonterminal Declaration classBodyDeclaration;
nonterminal ClassDeclaration classDeclaration;
nonterminal CompilationUnit compilationUnit;
+nonterminal IdeDeclaration compilationUnitDeclaration;
nonterminal JooSymbol constOrVar;
nonterminal Expr expr;
nonterminal Expr exprOrObjectLiteral;
@@ -137,7 +140,7 @@ nonterminal Node directive;
nonterminal Directives directives;
nonterminal Expr lvalue;
nonterminal MethodDeclaration methodDeclaration;
-nonterminal Declaration memberDeclaration;
+nonterminal IdeDeclaration memberDeclaration;
nonterminal JooSymbol modifier;
nonterminal ArrayList modifiers;
nonterminal Arguments nonEmptyArguments;
@@ -163,6 +166,7 @@ nonterminal Parameter parameter;
nonterminal Parameters parameters;
nonterminal ParenthesizedExpr parenthesizedExpr;
nonterminal Ide qualifiedIde;
+nonterminal Ide namespacedIde;
nonterminal Statement statement;
nonterminal Statement labelableStatement;
nonterminal ArrayList statements;
@@ -174,23 +178,43 @@ nonterminal Type type;
nonterminal TypeList typeList;
nonterminal VariableDeclaration variableDeclaration;
+// TODO: check precedences with spec; they are from reference http://hell.org.ua/Docs/oreilly/web2/action/ch05_01.htm
+/* 1 */
+precedence left COMMA;
+/* 2 */
precedence right EQ, MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ, LSHIFTEQ, RSHIFTEQ, URSHIFTEQ, ANDEQ, XOREQ, OREQ;
+/* 3 */
precedence right QUESTION, COLON;
-precedence left AS; // TODO: where do they belong?
+/* 4 */
precedence left OROR;
+/* 5 */
precedence left ANDAND;
+/* 6 */
precedence left OR;
+/* 7 */
precedence left XOR;
+/* 8 */
precedence left AND;
+/* 9 */
precedence left EQEQ, NOTEQ, EQEQEQ, NOTEQEQ;
-precedence left LT, GT, LTEQ, GTEQ, INSTANCEOF, IS, TYPEOF, NOT, IN;
+/* 10 */
+precedence left LT, LTEQ, GT, GTEQ;
+precedence left INSTANCEOF, IS, IN;
+precedence left AS;
+/* 11 */
precedence left LSHIFT, RSHIFT, URSHIFT;
+/* 12 */
precedence left PLUS, MINUS;
+/* 13 */
precedence left MUL, DIV, MOD;
-precedence left PREFIX_PLUSPLUS, PREFIX_MINUSMINUS, PREFIX_PLUS, PREFIX_MINUS;
-precedence nonassoc PLUSPLUS, MINUSMINUS; /* postfix */
-
-precedence left DOT, LPAREN, LBRACK;
+/* 14 */
+precedence right PREFIX_PLUSPLUS, PREFIX_MINUSMINUS, PREFIX_PLUS, PREFIX_MINUS,
+ BITNOT, NOT, NEW, DELETE, TYPEOF, VOID;
+/* 15 */
+precedence left DOT, LPAREN, LBRACK, LBRACE;
+/* 16 */
+precedence left PLUSPLUS, MINUSMINUS; /* postfix */
+precedence right NAMESPACESEP;
start with compilationUnit;
@@ -257,10 +281,19 @@ commaExpr ::=
;
compilationUnit ::=
- packageDeclaration:p LBRACE:lb directives:ds classDeclaration:c RBRACE:rb
+ packageDeclaration:p LBRACE:lb directives:ds compilationUnitDeclaration:c RBRACE:rb
{: RESULT = new CompilationUnit(p,lb,ds,c,rb); :}
;
+compilationUnitDeclaration ::=
+ classDeclaration:cd
+ {: RESULT = cd; :}
+ | modifiers:m NAMESPACE:n ide:ide EQ:eq STRING_LITERAL:l SEMICOLON:s
+ {: RESULT = new FieldDeclaration((JooSymbol[])m.toArray(new JooSymbol[0]), n, ide, null, new Initializer(eq, new LiteralExpr(l)), s); :}
+ | memberDeclaration:md
+ {: RESULT = md; :}
+ ;
+
constOrVar ::=
CONST:c
{: RESULT = c; :}
@@ -269,14 +302,18 @@ constOrVar ::=
;
directive ::=
- IMPORT:i qualifiedIde:ide SEMICOLON:s
- {: RESULT = new ImportDirective(i,new IdeType(ide), s); :}
- | IMPORT:i qualifiedIde:ide DOT:dot MUL:all SEMICOLON:s
- {: RESULT = new ImportDirective(i,new IdeType(new QualifiedIde(ide,dot,all)), s); :}
+ IMPORT:i qualifiedIde:ide
+ {: RESULT = new ImportDirective(i,new IdeType(ide)); :}
+ | IMPORT:i qualifiedIde:ide DOT:dot MUL:all
+ {: RESULT = new ImportDirective(i,new IdeType(new QualifiedIde(ide,dot,all))); :}
| LBRACK:lb ide:ide RBRACK:rb
{: RESULT = new Annotation(lb, ide, rb); :}
| LBRACK:lb ide:ide LPAREN:lb2 annotationFields:af RPAREN:rb2 RBRACK:rb
- {: RESULT = new Annotation(lb, ide, af, rb); :}
+ {: RESULT = new Annotation(lb, ide, lb2, af, rb2, rb); :}
+ | USE:u NAMESPACE:n qualifiedIde:namespace
+ {: RESULT = new UseNamespaceDirective(u, n, namespace); :}
+ | SEMICOLON:s
+ {: RESULT = new EmptyDeclaration(s); :}
;
nonEmptyAnnotationFields ::=
@@ -330,6 +367,8 @@ expr ::=
{: RESULT = e; :}
| NEW:n type:t LPAREN:lp arguments:args RPAREN:rp
{: RESULT = new NewExpr(n,t,lp,args,rp); :}
+ | NEW:n type:t
+ {: RESULT = new NewExpr(n,t); :}
| PLUSPLUS:op expr:e
{: RESULT = new PrefixOpExpr(op,e); :} %prec PREFIX_PLUSPLUS
| MINUSMINUS:op expr:e
@@ -340,8 +379,12 @@ expr ::=
{: RESULT = new PrefixOpExpr(op,e); :} %prec PREFIX_MINUS
| NOT:op expr:e
{: RESULT = new PrefixOpExpr(op,e); :}
+ | BITNOT:op expr:e
+ {: RESULT = new PrefixOpExpr(op,e); :}
| TYPEOF:op expr:e
{: RESULT = new PrefixOpExpr(op,e); :}
+ | DELETE:op expr:e
+ {: RESULT = new PrefixOpExpr(op,e); :}
| expr:expr LPAREN:lp arguments:args RPAREN:rp
{: RESULT = new ApplyExpr(expr,lp,args,rp); :}
| expr:e AS:as type:t
@@ -422,7 +465,7 @@ expr ::=
{: RESULT = new AssignmentOpExpr(lv,op,e); :}
| lvalue:lv OREQ:op expr:e
{: RESULT = new AssignmentOpExpr(lv,op,e); :}
- | expr:cond QUESTION:q expr:e1 COLON:c expr:e2
+ | expr:cond QUESTION:q exprOrObjectLiteral:e1 COLON:c exprOrObjectLiteral:e2
{: RESULT = new ConditionalExpr(cond,q,e1,c,e2); :}
;
@@ -471,11 +514,11 @@ implements ::=
;
lvalue ::=
- ide:ide
+ namespacedIde:ide
{: RESULT = new TopLevelIdeExpr(ide); :}
- | expr:e DOT:d ide:ide
+ | expr:e DOT:d namespacedIde:ide
{: RESULT = new DotExpr(e,d,ide); :}
- | SUPER:s DOT:d ide:ide
+ | SUPER:s DOT:d namespacedIde:ide
{: RESULT = new DotExpr(new SuperExpr(s),d,ide); :}
| expr:expr LBRACK:lb arguments:args RBRACK:rb
{: RESULT = new ArrayIndexExpr(expr,lb,args,rb); :}
@@ -514,6 +557,9 @@ modifier ::=
{: RESULT = s; :}
| OVERRIDE:s
{: RESULT = s; :}
+ /* maybe a namespace: */
+ | ide:ide
+ {: RESULT = ide.ide; :}
;
modifiers ::=
@@ -550,6 +596,8 @@ objectField ::=
{: RESULT = new ObjectField(new IdeExpr(name),c,value); :}
| STRING_LITERAL:l COLON:c exprOrObjectLiteral:value
{: RESULT = new ObjectField(new LiteralExpr(l),c,value); :}
+ | INT_LITERAL:l COLON:c exprOrObjectLiteral:value
+ {: RESULT = new ObjectField(new LiteralExpr(l),c,value); :}
;
objectFields ::=
@@ -646,6 +694,13 @@ qualifiedIde ::=
{: RESULT = new QualifiedIde(prefix, d, ide); :}
;
+namespacedIde ::=
+ ide:ide
+ {: RESULT = ide; :}
+ | modifier:namespace NAMESPACESEP:sep IDE:ide
+ {: RESULT = new NamespacedIde(namespace, sep, ide); :}
+ ;
+
labelableStatement ::=
IF:i parenthesizedExpr:cond statement:ts ELSE:e statement:es
{: RESULT = new IfStatement(i,cond,ts,e,es); :}
@@ -694,8 +749,6 @@ statement ::=
{: RESULT = new ContinueStatement(c,ide,s); :}
| RETURN:r optExprOrObjectLiteral:e SEMICOLON:s
{: RESULT = new ReturnStatement(r,e,s); :}
- | DELETE:d lvalue:e SEMICOLON:s
- {: RESULT = new DeleteStatement(d,e,s); :}
| ASSERT:a LPAREN:lp exprOrObjectLiteral:e RPAREN:rp SEMICOLON:s
{: RESULT = new AssertStatement(a,lp,e,rp,s); :}
| THROW:t commaExpr:e SEMICOLON:s
diff --git a/jooc/src/main/java/net/jangaroo/jooc/Annotation.java b/jooc/src/main/java/net/jangaroo/jooc/Annotation.java
index 02d347146..e8cff8bad 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/Annotation.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/Annotation.java
@@ -23,17 +23,21 @@ public class Annotation extends NodeImplBase {
JooSymbol leftBracket;
Ide ide;
+ JooSymbol leftBrace;
ObjectFields annotationFields;
+ JooSymbol rightBrace;
JooSymbol rightBracket;
public Annotation(JooSymbol leftBracket, Ide ide, JooSymbol rightBracket) {
- this(leftBracket, ide, null, rightBracket);
+ this(leftBracket, ide, null, null, null, rightBracket);
}
- public Annotation(JooSymbol leftBracket, Ide ide, ObjectFields annotationFields, JooSymbol rightBracket) {
+ public Annotation(JooSymbol leftBracket, Ide ide, JooSymbol leftBrace, ObjectFields annotationFields, JooSymbol rightBrace, JooSymbol rightBracket) {
this.leftBracket = leftBracket;
this.ide = ide;
+ this.leftBrace = leftBrace;
this.annotationFields = annotationFields;
+ this.rightBrace = rightBrace;
this.rightBracket = rightBracket;
}
@@ -46,7 +50,9 @@ public void generateCode(JsWriter out) throws IOException {
out.writeSymbol(leftBracket);
ide.generateCode(out);
if (annotationFields!=null) {
+ out.writeSymbol(leftBrace);
annotationFields.generateCode(out);
+ out.writeSymbol(rightBrace);
}
out.writeSymbol(rightBracket);
out.endComment();
diff --git a/jooc/src/main/java/net/jangaroo/jooc/ApplyExpr.java b/jooc/src/main/java/net/jangaroo/jooc/ApplyExpr.java
index 22704d445..2a07f1838 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/ApplyExpr.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/ApplyExpr.java
@@ -26,7 +26,7 @@ class ApplyExpr extends Expr {
public static final boolean ASSUME_UNDECLARED_UPPER_CASE_FUNCTIONS_CALLS_ARE_TYPE_CASTS = Boolean.valueOf("true");
Expr fun;
- boolean isType;
+ Scope scope;
JooSymbol lParen;
Arguments args;
JooSymbol rParen;
@@ -39,7 +39,8 @@ public ApplyExpr(Expr fun, JooSymbol lParen, Arguments args, JooSymbol rParen) {
}
public void generateCode(JsWriter out) throws IOException {
- if (isType) {
+ // leave out constructor function if called as type cast function!
+ if (isTypeCast()) {
out.beginComment();
fun.generateCode(out);
out.endComment();
@@ -49,6 +50,26 @@ public void generateCode(JsWriter out) throws IOException {
generateArgsCode(out);
}
+ private boolean isTypeCast() {
+ if (scope!=null && fun instanceof IdeExpr) {
+ // TODO: make it work correctly for fully qualified identifiers!
+ String name = ((IdeExpr)fun).ide.getName();
+ // special case: it is a type cast to the current class:
+ if (scope.getClassDeclaration()!=null && scope.getClassDeclaration().getName().equals(name)) {
+ return true;
+ }
+ // heuristic for types: start with upper case letter.
+ // otherwise, it is most likely an imported package-namespaced function.
+ if (Character.isUpperCase(name.charAt(0))) {
+ Scope declScope = scope.findScopeThatDeclares(name);
+ return declScope == null
+ ? ASSUME_UNDECLARED_UPPER_CASE_FUNCTIONS_CALLS_ARE_TYPE_CASTS
+ : declScope.getDeclaration() == scope.getPackageDeclaration();
+ }
+ }
+ return false;
+ }
+
protected void generateArgsCode(JsWriter out) throws IOException {
out.writeSymbol(lParen);
if (args != null)
@@ -58,20 +79,8 @@ protected void generateArgsCode(JsWriter out) throws IOException {
public Expr analyze(Node parentNode, AnalyzeContext context) {
super.analyze(parentNode, context);
- // leave out constructor function if called as type cast function!
- if (fun instanceof IdeExpr) {
- // TODO: make it work for fully qualified identifiers!
- Ide funIde = ((IdeExpr)fun).ide;
- // heuristic for types: start with upper case letter.
- // otherwise, it is most likely an imported package-namespaced function.
- if (Character.isUpperCase(funIde.getName().charAt(0))) {
- Scope scope = context.getScope().findScopeThatDeclares(funIde);
- isType = scope == null
- ? ASSUME_UNDECLARED_UPPER_CASE_FUNCTIONS_CALLS_ARE_TYPE_CASTS
- : scope.getDeclaration() == context.getScope().getPackageDeclaration();
- }
- }
fun = fun.analyze(this, context);
+ scope = context.getScope();
if (args != null)
args.analyze(this, context);
return this;
diff --git a/jooc/src/main/java/net/jangaroo/jooc/BlockStatement.java b/jooc/src/main/java/net/jangaroo/jooc/BlockStatement.java
index d72922734..184a7a12e 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/BlockStatement.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/BlockStatement.java
@@ -17,6 +17,7 @@
import java.io.IOException;
import java.util.List;
+import java.util.ArrayList;
/**
* @author Andreas Gawecki
@@ -26,8 +27,7 @@ class BlockStatement extends Statement {
JooSymbol lBrace;
List<Node> statements;
JooSymbol rBrace;
- boolean addSuperCall;
- Parameters params;
+ List<CodeGenerator> blockStartCodeGenerators = new ArrayList<CodeGenerator>(3);
public BlockStatement(JooSymbol lBrace, List<Node> statements, JooSymbol rBrace) {
this.lBrace = lBrace;
@@ -35,26 +35,19 @@ public BlockStatement(JooSymbol lBrace, List<Node> statements, JooSymbol rBrace)
this.rBrace = rBrace;
}
+ public void addBlockStartCodeGenerator(CodeGenerator blockStartCodeGenerator) {
+ blockStartCodeGenerators.add(blockStartCodeGenerator);
+ }
+
public void generateCode(JsWriter out) throws IOException {
out.writeSymbol(lBrace);
- if (params!=null) {
- params.generateParameterInitializerCode(out);
- }
- if (addSuperCall) {
- out.write("this[$super]();");
+ for (CodeGenerator codeGenerator : blockStartCodeGenerators) {
+ codeGenerator.generateCode(out);
}
generateCode(statements, out);
out.writeSymbol(rBrace);
}
- public void generateCodeWithSuperCall() {
- addSuperCall = true;
- }
-
- public void setParameters(Parameters params) {
- this.params = params;
- }
-
public Node analyze(Node parentNode, AnalyzeContext context) {
super.analyze(parentNode, context);
analyze(this, statements, context);
diff --git a/jooc/src/main/java/net/jangaroo/jooc/Catch.java b/jooc/src/main/java/net/jangaroo/jooc/Catch.java
index 17cba0312..66defcc26 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/Catch.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/Catch.java
@@ -16,6 +16,7 @@
package net.jangaroo.jooc;
import java.io.IOException;
+import java.util.List;
/**
* @author Andreas Gawecki
@@ -26,22 +27,78 @@ class Catch extends KeywordStatement {
Parameter param;
JooSymbol rParen;
BlockStatement block;
+ private boolean first;
public Catch(JooSymbol symCatch, JooSymbol lParen, Parameter param, JooSymbol rParen, BlockStatement block) {
super(symCatch);
this.lParen = lParen;
this.param = param;
+ // It is "worst practice" to redeclare catch variables in AS3:
+ param.allowDuplicates = true;
this.rParen = rParen;
this.block = block;
}
public void generateCode(JsWriter out) throws IOException {
- super.generateCode(out);
- out.writeSymbol(lParen);
- param.generateCode(out);
- out.writeSymbol(rParen);
- block.generateCode(out);
- }
+ List<Catch> catches = ((TryStatement)parentNode).catches;
+ Catch firstCatch = catches.get(0);
+ boolean isFirst = equals(firstCatch);
+ boolean isLast = equals(catches.get(catches.size()-1));
+ TypeRelation typeRelation = param.getOptTypeRelation();
+ boolean hasCondition = typeRelation != null && typeRelation.getType().getSymbol().sym!=sym.MUL;
+ if (!hasCondition && !isLast) {
+ Jooc.error(rParen, "Only last catch clause may be untyped.");
+ }
+ final JooSymbol errorVar = firstCatch.param.getIde().ide;
+ final JooSymbol localErrorVar = param.getIde().ide;
+ // in the following, always take care to write whitespace only once!
+ out.writeSymbolWhitespace(symKeyword);
+ if (isFirst) {
+ out.writeSymbolToken(symKeyword); // "catch"
+ // "(localErrorVar)":
+ out.writeSymbol(lParen, !hasCondition);
+ out.writeSymbol(errorVar, !hasCondition);
+ if (!hasCondition && typeRelation!=null) {
+ // can only be ": *", add as comment:
+ typeRelation.generateCode(out);
+ }
+ out.writeSymbol(rParen, !hasCondition);
+ if (hasCondition || !isLast) {
+ // a catch block always needs a brace, so generate one for conditions:
+ out.writeToken("{");
+ }
+ } else {
+ // transform catch(ide:Type){...} into else if is(e,Type)){var ide=e;...}
+ out.writeToken("else");
+ }
+ if (hasCondition) {
+ out.writeToken("if(is");
+ out.writeSymbol(lParen);
+ out.writeSymbolWhitespace(localErrorVar);
+ out.writeSymbolToken(errorVar);
+ out.writeSymbolWhitespace(typeRelation.symRelation);
+ out.writeToken(",");
+ typeRelation.getType().generateCode(out);
+ out.writeSymbol(rParen);
+ out.writeToken(")");
+ }
+ if (!localErrorVar.getText().equals(errorVar.getText())) {
+ block.addBlockStartCodeGenerator(new CodeGenerator() {
+ public void generateCode(JsWriter out) throws IOException {
+ out.writeToken("var");
+ out.writeSymbolToken(localErrorVar);
+ out.writeToken("=");
+ out.writeSymbolToken(errorVar);
+ out.writeToken(";");
+ }
+ });
+ }
+ block.generateCode(out);
+ if (isLast && !(isFirst && !hasCondition)) {
+ // last catch clause causes the JS catch block:
+ out.writeToken("}");
+ }
+ }
public Node analyze(Node parentNode, AnalyzeContext context) {
super.analyze(parentNode, context);
@@ -50,4 +107,7 @@ public Node analyze(Node parentNode, AnalyzeContext context) {
return this;
}
+ public void setFirst(boolean first) {
+ this.first = first;
+ }
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/ClassDeclaration.java b/jooc/src/main/java/net/jangaroo/jooc/ClassDeclaration.java
index d63245a25..73442de1d 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/ClassDeclaration.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/ClassDeclaration.java
@@ -54,7 +54,7 @@ public MethodDeclaration getConstructorDeclaration() {
public ClassDeclaration(JooSymbol[] modifiers, JooSymbol cls, Ide ide, Extends ext, Implements impl, ClassBody body) {
super(modifiers,
- MODIFIER_ABSTRACT|MODIFIER_FINAL|MODIFIERS_SCOPE|MODIFIER_STATIC,
+ MODIFIER_ABSTRACT|MODIFIER_FINAL|MODIFIERS_SCOPE|MODIFIER_STATIC|MODIFIER_DYNAMIC,
ide);
this.symClass = cls;
this.optExtends = ext;
@@ -174,7 +174,7 @@ public String getSuperClassPath() {
Type type = getSuperClassType();
//TODO: scope class declarations, implement getSuperClassDeclaration()
IdeType ideType = (IdeType) type;
- return toPath(ideType.getIde().getQualifiedName());
+ return ideType.getIde().getQualifiedNameStr();
}
public void addBoundMethodCandidate(String memberName) {
diff --git a/jooc/src/main/java/net/jangaroo/jooc/CodeGenerator.java b/jooc/src/main/java/net/jangaroo/jooc/CodeGenerator.java
new file mode 100644
index 000000000..acb27759b
--- /dev/null
+++ b/jooc/src/main/java/net/jangaroo/jooc/CodeGenerator.java
@@ -0,0 +1,14 @@
+package net.jangaroo.jooc;
+
+import java.io.IOException;
+
+/**
+ * Created by IntelliJ IDEA.
+ * User: fwienber
+ * Date: 03.03.2009
+ * Time: 23:45:22
+ * To change this template use File | Settings | File Templates.
+ */
+public interface CodeGenerator {
+ void generateCode(JsWriter out) throws IOException;
+}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/CompilationUnit.java b/jooc/src/main/java/net/jangaroo/jooc/CompilationUnit.java
index 24ddbca46..710832d1a 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/CompilationUnit.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/CompilationUnit.java
@@ -24,6 +24,7 @@
/**
* @author Andreas Gawecki
+ * @author Frank Wienberg
*/
public class CompilationUnit extends NodeImplBase implements CodeGenerator {
@@ -31,14 +32,10 @@ public PackageDeclaration getPackageDeclaration() {
return packageDeclaration;
}
- public ClassDeclaration getClassDeclaration() {
- return classDeclaration;
- }
-
PackageDeclaration packageDeclaration;
JooSymbol lBrace;
Directives directives;
- ClassDeclaration classDeclaration;
+ IdeDeclaration primaryDeclaration;
JooSymbol rBrace;
@@ -46,11 +43,11 @@ public ClassDeclaration getClassDeclaration() {
protected JsWriter out;
- public CompilationUnit(PackageDeclaration packageDeclaration, JooSymbol lBrace, Directives directives, ClassDeclaration classDeclaration, JooSymbol rBrace) {
+ public CompilationUnit(PackageDeclaration packageDeclaration, JooSymbol lBrace, Directives directives, IdeDeclaration primaryDeclaration, JooSymbol rBrace) {
this.packageDeclaration = packageDeclaration;
this.lBrace = lBrace;
this.directives = directives;
- this.classDeclaration = classDeclaration;
+ this.primaryDeclaration = primaryDeclaration;
this.rBrace = rBrace;
}
@@ -65,7 +62,7 @@ public File getSourceFile() {
public void writeOutput(CompilationUnitSinkFactory writerFactory,
boolean verbose) throws Jooc.CompilerError {
CompilationUnitSink sink = writerFactory.createSink(
- packageDeclaration, classDeclaration,
+ packageDeclaration, primaryDeclaration,
sourceFile, verbose);
sink.writeOutput(this);
@@ -78,7 +75,7 @@ public void generateCode(JsWriter out) throws IOException {
if (directives!=null) {
directives.generateCode(out);
}
- classDeclaration.generateCode(out);
+ primaryDeclaration.generateCode(out);
out.writeSymbolWhitespace(rBrace);
out.write(");");
}
@@ -117,7 +114,7 @@ public Node analyze(Node parentNode, AnalyzeContext context) {
if (directives!=null) {
directives.analyze(this, context);
}
- classDeclaration.analyze(this, context);
+ primaryDeclaration.analyze(this, context);
context.leaveScope(packageDeclaration);
context.leaveScope(globalObject);
return this;
diff --git a/jooc/src/main/java/net/jangaroo/jooc/Declaration.java b/jooc/src/main/java/net/jangaroo/jooc/Declaration.java
index ed0e05150..e57597e42 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/Declaration.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/Declaration.java
@@ -21,6 +21,7 @@
* @author Andreas Gawecki
*/
abstract class Declaration extends NodeImplBase {
+ public static final String DYNAMIC = "dynamic";
public JooSymbol[] getSymModifiers() {
return symModifiers;
@@ -43,9 +44,10 @@ public JooSymbol[] getSymModifiers() {
protected static final int MODIFIER_FINAL = 2*MODIFIER_ABSTRACT;
protected static final int MODIFIER_OVERRIDE = 2*MODIFIER_FINAL;
protected static final int MODIFIER_DYNAMIC = 2*MODIFIER_OVERRIDE;
+ protected static final int MODIFIER_NAMESPACE = 2*MODIFIER_DYNAMIC;
protected static final int MODIFIERS_SCOPE =
- MODIFIER_PRIVATE|MODIFIER_PROTECTED|MODIFIER_PUBLIC|MODIFIER_INTERNAL;
+ MODIFIER_PRIVATE|MODIFIER_PROTECTED|MODIFIER_PUBLIC|MODIFIER_INTERNAL|MODIFIER_NAMESPACE;
protected Declaration(JooSymbol[] modifiers, int allowedModifiers) {
this.symModifiers = modifiers;
@@ -70,6 +72,7 @@ protected void computeModifiers() {
case sym.ABSTRACT: flag = MODIFIER_ABSTRACT; break;
case sym.FINAL: flag = MODIFIER_FINAL; break;
case sym.OVERRIDE: flag = MODIFIER_OVERRIDE; break;
+ case sym.IDE: flag = DYNAMIC.equals(modifier.getText()) ? MODIFIER_DYNAMIC : MODIFIER_NAMESPACE; break;
default: Jooc.error(modifier, "internal compiler error: invalid modifier '" + modifier.getText() + "'");
}
if ((allowedModifiers & flag) == 0)
diff --git a/jooc/src/main/java/net/jangaroo/jooc/Directives.java b/jooc/src/main/java/net/jangaroo/jooc/Directives.java
index 24304f71c..ad963c620 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/Directives.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/Directives.java
@@ -18,7 +18,7 @@
import java.io.IOException;
/**
- * @author Andreas Gawecki
+ * @author Frank Wienberg
*/
class Directives extends NodeImplBase {
diff --git a/jooc/src/main/java/net/jangaroo/jooc/DotExpr.java b/jooc/src/main/java/net/jangaroo/jooc/DotExpr.java
index 3c0136299..1555dfe2d 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/DotExpr.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/DotExpr.java
@@ -28,18 +28,22 @@ public DotExpr(Expr expr, JooSymbol symDot, Ide ide) {
super(expr, symDot, new IdeExpr(ide));
}
+ public IdeExpr getArg2() {
+ return (IdeExpr)arg2;
+ }
+
public Expr analyze(Node parentNode, AnalyzeContext context) {
this.classDeclaration = context.getCurrentClass();
// check candidates for instance methods declared in same file, accessed as function:
- if (this.classDeclaration !=null && arg2 instanceof IdeExpr) {
- String property = ((IdeExpr)arg2).ide.getName();
+ if (this.classDeclaration !=null) {
+ String property = getArg2().ide.getName();
// check and handle instance methods declared in same file, accessed as function:
if (arg1 instanceof ThisExpr
&& !(parentNode instanceof DotExpr)
&& !(parentNode instanceof ApplyExpr)
- && !(parentNode instanceof DeleteStatement)
&& !(parentNode instanceof AssignmentOpExpr && ((AssignmentOpExpr)parentNode).arg1== this)
- && !(parentNode instanceof PrefixOpExpr && ((PrefixOpExpr)parentNode).op.sym==sym.TYPEOF)) {
+ && !(parentNode instanceof PrefixOpExpr &&
+ (((PrefixOpExpr)parentNode).op.sym==sym.TYPEOF || ((PrefixOpExpr)parentNode).op.sym==sym.DELETE))) {
this.classDeclaration.addBoundMethodCandidate(property);
} else {
QualifiedIde fqie = getFullyQualifiedIde();
@@ -66,22 +70,19 @@ public Expr analyze(Node parentNode, AnalyzeContext context) {
}
private QualifiedIde getFullyQualifiedIde() {
- if (arg2 instanceof IdeExpr) {
- Ide prefixIde =
- arg1 instanceof IdeExpr && !(arg1 instanceof ThisExpr || arg1 instanceof SuperExpr) ? ((IdeExpr)arg1).ide
- : arg1 instanceof DotExpr ? ((DotExpr)arg1).getFullyQualifiedIde()
- : null;
- if (prefixIde!=null) {
- return new QualifiedIde(prefixIde, op, ((IdeExpr)arg2).ide.getSymbol());
- }
+ Ide prefixIde =
+ arg1 instanceof IdeExpr && !(arg1 instanceof ThisExpr || arg1 instanceof SuperExpr) ? ((IdeExpr)arg1).ide
+ : arg1 instanceof DotExpr ? ((DotExpr)arg1).getFullyQualifiedIde()
+ : null;
+ if (prefixIde!=null) {
+ return new QualifiedIde(prefixIde, op, getArg2().ide.getSymbol());
}
return null;
}
public void generateCode(JsWriter out) throws IOException {
- if (classDeclaration!=null
- && arg2 instanceof IdeExpr) {
- String property = ((IdeExpr)arg2).ide.getName();
+ if (classDeclaration!=null) {
+ String property = getArg2().ide.getName();
// check and handle private instance members and super method access:
if ( arg1 instanceof ThisExpr && classDeclaration.isPrivateMember(property)
|| arg1 instanceof SuperExpr) {
@@ -89,15 +90,17 @@ public void generateCode(JsWriter out) throws IOException {
out.writeToken("this");
out.write("[");
// awkward, but we have to be careful if we add characters to tokens:
- out.writeSymbol(arg2.getSymbol(), "$", "");
+ out.writeSymbol(getArg2().getSymbol(), "$", "");
out.write("]");
return;
}
// check and handle private static member access:
if (arg1 instanceof IdeExpr && classDeclaration.isPrivateStaticMember(property)) {
String qualifiedName = ((IdeExpr)arg1).ide.getQualifiedNameStr();
+ // Found private static member access candidate qualifiedName+"."+property in class classDeclaration.getQualifiedNameStr()
if (qualifiedName.equals(classDeclaration.getName())
|| qualifiedName.equals(classDeclaration.getQualifiedNameStr())) {
+ // Found private static member access qualifiedName+"."+property
JooSymbol arg1Symbol = arg1.getSymbol();
// replace current class by "$jooPrivate":
arg1 = new IdeExpr(new Ide(new JooSymbol(net.jangaroo.jooc.sym.IDE, arg1Symbol.fileName, arg1Symbol.line,
diff --git a/jooc/src/main/java/net/jangaroo/jooc/EmptyDeclaration.java b/jooc/src/main/java/net/jangaroo/jooc/EmptyDeclaration.java
new file mode 100644
index 000000000..b57db6107
--- /dev/null
+++ b/jooc/src/main/java/net/jangaroo/jooc/EmptyDeclaration.java
@@ -0,0 +1,24 @@
+package net.jangaroo.jooc;
+
+import java.io.IOException;
+
+/**
+ * @author Frank Wienberg
+ */
+public class EmptyDeclaration extends Declaration {
+
+ private JooSymbol symSemicolon;
+
+ public EmptyDeclaration(JooSymbol symSemicolon) {
+ super(new JooSymbol[0], 0);
+ this.symSemicolon = symSemicolon;
+ }
+
+ public JooSymbol getSymbol() {
+ return symSemicolon;
+ }
+
+ public void generateCode(JsWriter out) throws IOException {
+ out.writeSymbolWhitespace(symSemicolon);
+ }
+}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/FieldDeclaration.java b/jooc/src/main/java/net/jangaroo/jooc/FieldDeclaration.java
index dc7db6fca..bd2e5b023 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/FieldDeclaration.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/FieldDeclaration.java
@@ -48,11 +48,11 @@ public void generateCode(JsWriter out) throws IOException {
out.write(':');
boolean isCompileTimeConstant = optInitializer.value.isCompileTimeConstant();
if (!isCompileTimeConstant) {
- out.write("function(){return ");
+ out.writeToken("function(){return(");
}
optInitializer.value.generateCode(out);
if (!isCompileTimeConstant) {
- out.write(";}");
+ out.writeToken(");}");
}
} else {
out.write(": undefined");
diff --git a/jooc/src/main/java/net/jangaroo/jooc/FunctionExpr.java b/jooc/src/main/java/net/jangaroo/jooc/FunctionExpr.java
index 5d8cdc242..19a2c2627 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/FunctionExpr.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/FunctionExpr.java
@@ -30,7 +30,7 @@ class FunctionExpr extends Expr {
TypeRelation optTypeRelation;
BlockStatement body;
- ClassDeclaration classDeclaration;
+ IdeDeclaration parentDeclaration;
private boolean thisUsed;
public FunctionExpr(JooSymbol symFun, Ide ide, JooSymbol lParen, Parameters params, JooSymbol rParen, TypeRelation optTypeRelation, BlockStatement body) {
@@ -43,13 +43,18 @@ public FunctionExpr(JooSymbol symFun, Ide ide, JooSymbol lParen, Parameters para
this.body = body;
}
- public ClassDeclaration getClassDeclaration() {
- return classDeclaration;
+ public IdeDeclaration getParentDeclaration() {
+ return parentDeclaration;
}
public Expr analyze(Node parentNode, AnalyzeContext context) {
- classDeclaration = context.getCurrentClass();
- Debug.assertTrue(classDeclaration != null, "classDeclaration != null");
+ parentDeclaration = context.getCurrentClass();
+ if (parentDeclaration==null) {
+ Node declaration = context.getScope().getDeclaration();
+ if (declaration instanceof IdeDeclaration) {
+ parentDeclaration = (IdeDeclaration)declaration;
+ }
+ }
super.analyze(parentNode, context);
if (ide!=null) {
context.getScope().declareIde(ide.getName(), this);
diff --git a/jooc/src/main/java/net/jangaroo/jooc/IdeDeclaration.java b/jooc/src/main/java/net/jangaroo/jooc/IdeDeclaration.java
index 581151b73..20b6d22dd 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/IdeDeclaration.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/IdeDeclaration.java
@@ -25,6 +25,7 @@ public abstract class IdeDeclaration extends Declaration {
private static Pattern PRIVATE_MEMBER_NAME = Pattern.compile("^[$](\\p{Alpha}|[_$])(\\p{Alnum}|[_$])*$");
Ide ide;
+ boolean allowDuplicates = false;
protected IdeDeclaration(JooSymbol[] modifiers, int allowedModifiers, Ide ide) {
super(modifiers, allowedModifiers);
@@ -60,27 +61,19 @@ public String[] getQualifiedName() {
}
public String getQualifiedNameStr() {
- return QualifiedIde.constructQualifiedNameStr(getQualifiedName());
- }
-
- protected static String toPath(String[] qn) {
- StringBuffer result = new StringBuffer(20);
- for (int i = 0; i < qn.length; i++) {
- if (i > 0)
- result.append('.');
- result.append(qn[i]);
- }
- return result.toString();
- }
-
- public String getPath() {
- return toPath(getQualifiedName());
+ return QualifiedIde.constructQualifiedNameStr(getQualifiedName(), ".");
}
public Node analyze(Node parentNode, AnalyzeContext context) {
super.analyze(parentNode, context);
- if (context.getScope().declareIde(getName(), this)!=null)
- Jooc.error(getSymbol(), "duplicate declaration of identifier '" + getName() + "'");
+ if (context.getScope().declareIde(getName(), this)!=null) {
+ String msg = "Duplicate declaration of identifier '" + getName() + "'";
+ if (allowDuplicates) {
+ Jooc.warning(getSymbol(), msg);
+ } else {
+ Jooc.error(getSymbol(), msg);
+ }
+ }
return this;
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/IdeExpr.java b/jooc/src/main/java/net/jangaroo/jooc/IdeExpr.java
index a4ffc384a..39c43cdc2 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/IdeExpr.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/IdeExpr.java
@@ -28,7 +28,14 @@ public IdeExpr(Ide ide) {
this.ide = ide;
}
- public void generateCode(JsWriter out) throws IOException {
+ @Override
+ public Expr analyze(Node parentNode, AnalyzeContext context) {
+ super.analyze(parentNode, context);
+ ide.analyze(this, context);
+ return this;
+ }
+
+ public void generateCode(JsWriter out) throws IOException {
ide.generateCode(out);
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/ImportDirective.java b/jooc/src/main/java/net/jangaroo/jooc/ImportDirective.java
index bdafc35f8..027d41699 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/ImportDirective.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/ImportDirective.java
@@ -24,12 +24,10 @@ public class ImportDirective extends NodeImplBase {
JooSymbol importKeyword;
Type type;
- JooSymbol semicolon;
- public ImportDirective(JooSymbol importKeyword, Type type, JooSymbol semicolon) {
+ public ImportDirective(JooSymbol importKeyword, Type type) {
this.importKeyword = importKeyword;
this.type = type;
- this.semicolon = semicolon;
}
@Override
@@ -56,7 +54,6 @@ public void generateCode(JsWriter out) throws IOException {
out.writeSymbol(importKeyword);
type.generateCode(out);
out.endString();
- out.writeSymbolWhitespace(semicolon);
out.writeToken(",");
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/JsWriter.java b/jooc/src/main/java/net/jangaroo/jooc/JsWriter.java
index 5e99d3ffa..7852a4503 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/JsWriter.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/JsWriter.java
@@ -279,7 +279,12 @@ private boolean isIdeChar(final char ch) {
}
public void writeSymbol(JooSymbol symbol) throws IOException {
- writeSymbolWhitespace(symbol);
+ writeSymbol(symbol, true);
+ }
+
+ public void writeSymbol(JooSymbol symbol, boolean withWhitespace) throws IOException {
+ if (withWhitespace)
+ writeSymbolWhitespace(symbol);
writeSymbolToken(symbol);
}
@@ -372,7 +377,7 @@ public String getMethodNameAsIde(MethodDeclaration methodDeclaration) {
}
public String getFunctionNameAsIde(FunctionExpr functionExpr) {
- ClassDeclaration classDeclaration = functionExpr.getClassDeclaration();
+ IdeDeclaration classDeclaration = functionExpr.getParentDeclaration();
String classNameAsIde = getQualifiedNameAsIde(classDeclaration);
JooSymbol sym = functionExpr.getSymbol();
return classNameAsIde + "$" + sym.getLine() + "_" + sym.getColumn();
diff --git a/jooc/src/main/java/net/jangaroo/jooc/MemberDeclaration.java b/jooc/src/main/java/net/jangaroo/jooc/MemberDeclaration.java
index c99c1a431..1d3ba2eea 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/MemberDeclaration.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/MemberDeclaration.java
@@ -15,23 +15,41 @@
package net.jangaroo.jooc;
+import java.math.BigInteger;
+
/**
* @author Andreas Gawecki
*/
public abstract class MemberDeclaration extends IdeDeclaration {
+ private JooSymbol namespace;
TypeRelation optTypeRelation;
public MemberDeclaration(JooSymbol[] modifiers, int allowedModifiers, Ide ide, TypeRelation optTypeRelation) {
super(modifiers, allowedModifiers, ide);
+ this.namespace = findNamespace(modifiers);
this.optTypeRelation = optTypeRelation;
}
+ private JooSymbol findNamespace(JooSymbol[] modifiers) {
+ for (JooSymbol modifier : modifiers) {
+ if (modifier.sym==sym.IDE && !DYNAMIC.equals(modifier.getText())) {
+ return modifier;
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getName() {
+ return NamespacedIde.getNamespacePrefix(namespace)+super.getName();
+ }
+
public TypeRelation getOptTypeRelation() {
return optTypeRelation;
}
public ClassDeclaration getClassDeclaration() {
- return (ClassDeclaration) getParentDeclaration();
+ return classDeclaration;
}
public boolean isField() {
@@ -49,7 +67,13 @@ public boolean isConstructor() {
public Node analyze(Node parentNode, AnalyzeContext context) {
super.analyze(parentNode, context);
if (isField() || isMethod()) {
- getClassDeclaration().registerMember(this);
+ ClassDeclaration classDeclaration = getClassDeclaration();
+ if (classDeclaration!=null) {
+ classDeclaration.registerMember(this);
+ }
+ }
+ if (namespace!=null) {
+ NamespacedIde.warnUndefinedNamespace(context, namespace);
}
return this;
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/MethodDeclaration.java b/jooc/src/main/java/net/jangaroo/jooc/MethodDeclaration.java
index 897e44c3a..7066a8315 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/MethodDeclaration.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/MethodDeclaration.java
@@ -73,13 +73,12 @@ public void setContainsSuperConstructorCall(boolean containsSuperConstructorCall
}
public boolean isAbstract() {
- return getClassDeclaration().isInterface() || super.isAbstract();
+ return classDeclaration!=null && classDeclaration.isInterface() || super.isAbstract();
}
public Node analyze(Node parentNode, AnalyzeContext context) {
- parentDeclaration = context.getCurrentClass();
- ClassDeclaration classDeclaration = getClassDeclaration();
- if (ide.getName().equals(classDeclaration.getName())) {
+ parentDeclaration = classDeclaration = context.getCurrentClass();
+ if (classDeclaration!=null && ide.getName().equals(classDeclaration.getName())) {
isConstructor = true;
classDeclaration.setConstructor(this);
allowedModifiers = MODIFIERS_SCOPE;
@@ -88,6 +87,9 @@ public Node analyze(Node parentNode, AnalyzeContext context) {
if (overrides() && isAbstract())
Jooc.error(this, "overriding methods are not allowed to be declared abstract");
if (isAbstract()) {
+ if (classDeclaration==null) {
+ Jooc.error(this, "package-scoped function "+getName()+" must not be abstract.");
+ }
if (!classDeclaration.isAbstract())
Jooc.error(this, classDeclaration.getName() + "is not declared abstract");
if (optBody instanceof BlockStatement)
@@ -129,7 +131,7 @@ public void generateCode(JsWriter out) throws IOException {
out.beginString();
writeModifiers(out);
String methodName = ide.getName();
- if (!isConstructor && !isStatic() && classDeclaration.isBoundMethod(methodName)) {
+ if (classDeclaration!=null && !isConstructor && !isStatic() && classDeclaration.isBoundMethod(methodName)) {
out.writeToken("bound");
}
out.writeToken(methodName);
@@ -155,13 +157,17 @@ public void generateCode(JsWriter out) throws IOException {
params.generateCode(out);
if (optBody instanceof BlockStatement) {
// inject into body for generating initilizers later:
- ((BlockStatement)optBody).setParameters(params);
+ ((BlockStatement)optBody).addBlockStartCodeGenerator(params.getParameterInitializerCodeGenerator());
}
}
out.writeSymbol(rParen);
if (optTypeRelation != null) optTypeRelation.generateCode(out);
if (isConstructor() && !containsSuperConstructorCall() && optBody instanceof BlockStatement) {
- ((BlockStatement)optBody).generateCodeWithSuperCall();
+ ((BlockStatement)optBody).addBlockStartCodeGenerator(new CodeGenerator() {
+ public void generateCode(JsWriter out) throws IOException {
+ out.writeToken("this[$super]();");
+ }
+ });
}
optBody.generateCode(out);
if (isAbstract()) {
diff --git a/jooc/src/main/java/net/jangaroo/jooc/NamespacedIde.java b/jooc/src/main/java/net/jangaroo/jooc/NamespacedIde.java
new file mode 100644
index 000000000..3a0e8ceb0
--- /dev/null
+++ b/jooc/src/main/java/net/jangaroo/jooc/NamespacedIde.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright 2008 CoreMedia AG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS
+ * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+package net.jangaroo.jooc;
+
+import java.io.IOException;
+
+/**
+ * @author Frank Wienberg
+ */
+public class NamespacedIde extends Ide {
+
+ private JooSymbol namespace;
+ private JooSymbol symNamespaceSep;
+
+
+ public NamespacedIde(JooSymbol namespace, JooSymbol symNamespaceSep, JooSymbol symIde) {
+ super(symIde);
+ this.namespace = namespace;
+ this.symNamespaceSep = symNamespaceSep;
+ }
+
+ static void warnUndefinedNamespace(AnalyzeContext context, JooSymbol namespace) {
+ if (namespace.sym==sym.IDE) { // all other symbols should be predefined namespaces like "public" etc.
+ String namespaceName = namespace.getText();
+ if (!context.getCurrentPackage().isNamespace(namespaceName) && context.getScope().findScopeThatDeclares(namespaceName)==null) {
+ Jooc.warning(namespace, "Undeclared namespace '"+ namespaceName +"', assuming it already is in scope.");
+ }
+ }
+ }
+ @Override
+ public Node analyze(Node parentNode, AnalyzeContext context) {
+ warnUndefinedNamespace(context, namespace);
+ return super.analyze(parentNode, context);
+ }
+
+ public void generateCode(JsWriter out) throws IOException {
+ // so far, namespaces are only comments:
+ out.beginComment();
+ out.writeSymbol(namespace);
+ out.writeSymbol(symNamespaceSep);
+ out.endComment();
+ out.writeSymbol(ide);
+ }
+
+ static String getNamespacePrefix(JooSymbol namespace) {
+ return namespace==null || namespace.sym!=sym.IDE ? "" : namespace.getText()+"::";
+ }
+
+ @Override
+ public String getName() {
+ return getNamespacePrefix(namespace)+super.getName();
+ }
+
+ public String[] getQualifiedName() {
+ return new String[]{namespace.getText(), ide.getText()};
+ }
+
+ @Override
+ public String getQualifiedNameStr() {
+ return QualifiedIde.constructQualifiedNameStr(getQualifiedName(), "::");
+ }
+
+ public JooSymbol getSymbol() {
+ return namespace;
+ }
+
+}
\ No newline at end of file
diff --git a/jooc/src/main/java/net/jangaroo/jooc/NewExpr.java b/jooc/src/main/java/net/jangaroo/jooc/NewExpr.java
index 9a9865bdf..49a43614a 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/NewExpr.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/NewExpr.java
@@ -28,6 +28,10 @@ class NewExpr extends Expr {
Arguments args;
JooSymbol rParen;
+ public NewExpr(JooSymbol symNew, Type type) {
+ this(symNew, type, null, null, null);
+ }
+
public NewExpr(JooSymbol symNew, Type type, JooSymbol lParen, Arguments args, JooSymbol rParen) {
this.symNew = symNew;
this.type = type;
@@ -46,9 +50,12 @@ public Expr analyze(Node parentNode, AnalyzeContext context) {
public void generateCode(JsWriter out) throws IOException {
out.writeSymbol(symNew);
type.generateCode(out);
- out.writeSymbol(lParen);
- if (args != null) args.generateCode(out);
- out.writeSymbol(rParen);
+ if (lParen!=null)
+ out.writeSymbol(lParen);
+ if (args != null)
+ args.generateCode(out);
+ if (rParen!=null)
+ out.writeSymbol(rParen);
}
public JooSymbol getSymbol() {
diff --git a/jooc/src/main/java/net/jangaroo/jooc/Node.java b/jooc/src/main/java/net/jangaroo/jooc/Node.java
index d4d9c345a..b525cd3fa 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/Node.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/Node.java
@@ -20,10 +20,10 @@
/**
* @author Andreas Gawecki
*/
-interface Node {
+interface Node extends CodeGenerator {
JooSymbol getSymbol();
- void generateCode(JsWriter out) throws IOException;
+
Node analyze(Node parentNode, AnalyzeContext context);
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/NodeImplBase.java b/jooc/src/main/java/net/jangaroo/jooc/NodeImplBase.java
index a421e144f..b30af2f0e 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/NodeImplBase.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/NodeImplBase.java
@@ -17,7 +17,6 @@
import java.io.IOException;
import java.util.Collection;
-import java.util.Iterator;
/**
* @author Andreas Gawecki
@@ -26,7 +25,7 @@ public abstract class NodeImplBase implements Node {
Node parentNode;
- void generateCode(Collection<Node> nodes, JsWriter out) throws IOException {
+ void generateCode(Collection<? extends Node> nodes, JsWriter out) throws IOException {
for (Node node : nodes) {
node.generateCode(out);
}
@@ -37,10 +36,8 @@ public Node analyze(Node parentNode, AnalyzeContext context) {
return this;
}
- public void analyze(Node parent, Collection/*<Node>*/ nodes, AnalyzeContext context) {
- Iterator iter = nodes.iterator();
- while (iter.hasNext()) {
- NodeImplBase node = (NodeImplBase) iter.next();
+ public void analyze(Node parent, Collection<? extends Node> nodes, AnalyzeContext context) {
+ for (Node node : nodes) {
node.analyze(parent, context);
}
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/PackageDeclaration.java b/jooc/src/main/java/net/jangaroo/jooc/PackageDeclaration.java
index 031f9afb8..bb5269e92 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/PackageDeclaration.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/PackageDeclaration.java
@@ -27,6 +27,12 @@ public class PackageDeclaration extends IdeDeclaration {
JooSymbol symPackage;
private List<String> packageImports = new ArrayList<String>();
+ private List<String> namespaces = new ArrayList<String>();
+
+ public PackageDeclaration(JooSymbol symPackage, Ide ide) {
+ super(new JooSymbol[0], 0, ide);
+ this.symPackage = symPackage;
+ }
public void addPackageImport(String packageName) {
packageImports.add(packageName);
@@ -36,9 +42,8 @@ public List<String> getPackageImports() {
return Collections.unmodifiableList(packageImports);
}
- public PackageDeclaration(JooSymbol symPackage, Ide ide) {
- super(new JooSymbol[0], 0, ide);
- this.symPackage = symPackage;
+ public void addNamespace(String namespace) {
+ namespaces.add(namespace);
}
public void generateCode(JsWriter out) throws IOException {
@@ -66,4 +71,8 @@ public boolean isFullyQualifiedIde(AnalyzeContext context, String dotExpr) {
return packageImports.contains(dotExpr.substring(0, dotExpr.lastIndexOf('.')))
|| context.getScope().findScopeThatDeclares(dotExpr) != null;
}
+
+ public boolean isNamespace(String namespace) {
+ return namespaces.contains(namespace);
+ }
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/Parameters.java b/jooc/src/main/java/net/jangaroo/jooc/Parameters.java
index 967cb1466..43666d9ac 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/Parameters.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/Parameters.java
@@ -67,33 +67,37 @@ public void generateCode(JsWriter out) throws IOException {
}
}
- public void generateParameterInitializerCode(JsWriter out) throws IOException {
- // first pass: generate conditionals and count parameters.
- int cnt = 0;
- StringBuilder code = new StringBuilder();
- for (Parameters parameters = this; parameters!=null; parameters = parameters.tail) {
- Parameter param = parameters.param;
- if (param.isRest()) {
- break;
+ public CodeGenerator getParameterInitializerCodeGenerator() {
+ return new CodeGenerator() {
+ public void generateCode(JsWriter out) throws IOException {
+ // first pass: generate conditionals and count parameters.
+ int cnt = 0;
+ StringBuilder code = new StringBuilder();
+ for (Parameters parameters = Parameters.this; parameters!=null; parameters = parameters.tail) {
+ Parameter param = parameters.param;
+ if (param.isRest()) {
+ break;
+ }
+ if (param.hasInitializer()) {
+ code.insert(0,"if(arguments.length<"+(cnt+1)+"){");
+ }
+ ++cnt;
+ }
+ out.write(code.toString());
+ // second pass: generate initializers and rest param code.
+ for (Parameters parameters = Parameters.this; parameters!=null; parameters = parameters.tail) {
+ Parameter param = parameters.param;
+ if (param.isRest()) {
+ param.generateRestParamCode(out, cnt);
+ break;
+ }
+ if (param.hasInitializer()) {
+ param.generateBodyInitializerCode(out);
+ out.write("}");
+ }
+ }
}
- if (param.hasInitializer()) {
- code.insert(0,"if(arguments.length<"+(cnt+1)+"){");
- }
- ++cnt;
- }
- out.write(code.toString());
- // second pass: generate initializers and rest param code.
- for (Parameters parameters = this; parameters!=null; parameters = parameters.tail) {
- Parameter param = parameters.param;
- if (param.isRest()) {
- param.generateRestParamCode(out, cnt);
- break;
- }
- if (param.hasInitializer()) {
- param.generateBodyInitializerCode(out);
- out.write("}");
- }
- }
+ };
}
public JooSymbol getSymbol() {
diff --git a/jooc/src/main/java/net/jangaroo/jooc/QualifiedIde.java b/jooc/src/main/java/net/jangaroo/jooc/QualifiedIde.java
index 97d780d56..d61ee8f7e 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/QualifiedIde.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/QualifiedIde.java
@@ -39,26 +39,29 @@ public void generateCode(JsWriter out) throws IOException {
}
public String[] getQualifiedName() {
- String[] prefixName = prefix.getQualifiedName();
+ return append(prefix.getQualifiedName(), ide.getText());
+ }
+
+ static String[] append(String[] prefixName, String ideText) {
String[] result = new String[prefixName.length+1];
System.arraycopy(prefixName, 0, result, 0, prefixName.length);
- result[prefixName.length] = ide.getText();
+ result[prefixName.length] = ideText;
return result;
}
@Override
public String getQualifiedNameStr() {
- return constructQualifiedNameStr(getQualifiedName());
+ return constructQualifiedNameStr(getQualifiedName(), ".");
}
public JooSymbol getSymbol() {
return prefix.getSymbol();
}
- static String constructQualifiedNameStr(String[] qualifiedName) {
+ static String constructQualifiedNameStr(String[] qualifiedName, String separator) {
StringBuilder sb = new StringBuilder(qualifiedName[0]);
for (int i = 1; i < qualifiedName.length; i++) {
- sb.append(".").append(qualifiedName[i]);
+ sb.append(separator).append(qualifiedName[i]);
}
return sb.toString();
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/Scope.java b/jooc/src/main/java/net/jangaroo/jooc/Scope.java
index 8b5efa166..c873dc553 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/Scope.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/Scope.java
@@ -151,15 +151,13 @@ public PackageDeclaration getPackageDeclaration() {
public ClassDeclaration getClassDeclaration() {
if (ideDeclaration instanceof ClassDeclaration)
return (ClassDeclaration) ideDeclaration;
- return parent.getClassDeclaration();
+ return parent==null ? null : parent.getClassDeclaration();
}
public MethodDeclaration getMethodDeclaration() {
if (ideDeclaration instanceof MethodDeclaration)
return (MethodDeclaration) ideDeclaration;
- if (parent == null)
- return null;
- return parent.getMethodDeclaration();
+ return parent == null ? null : parent.getMethodDeclaration();
}
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/TopLevelIdeExpr.java b/jooc/src/main/java/net/jangaroo/jooc/TopLevelIdeExpr.java
index 8d4f370f4..48c5642c3 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/TopLevelIdeExpr.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/TopLevelIdeExpr.java
@@ -64,9 +64,7 @@ private boolean addThis() {
String ideName = ide.getName();
while (currentDotExpr.parentNode instanceof DotExpr) {
currentDotExpr = (DotExpr)currentDotExpr.parentNode;
- if (!(currentDotExpr.arg2 instanceof IdeExpr))
- break;
- ideName += "." +((IdeExpr)currentDotExpr.arg2).ide.getName();
+ ideName += "." + currentDotExpr.getArg2().ide.getName();
declaringScope = scope.findScopeThatDeclares(ideName);
if (declaringScope!=null) {
// it has been defined in the meantime or is an imported qualified identifier:
@@ -83,8 +81,13 @@ private boolean addThis() {
Jooc.warning(ide.getSymbol(), warningMsg);
return !maybeInScope && ASSUME_UNDECLARED_IDENTIFIERS_ARE_MEMBERS;
} else if (declaringScope.getDeclaration() instanceof ClassDeclaration) {
- MemberDeclaration memberDeclaration = (MemberDeclaration)declaringScope.getIdeDeclaration(ide);
- return !memberDeclaration.isStatic() && !memberDeclaration.isConstructor();
+ Node ideDeclaration = declaringScope.getIdeDeclaration(ide);
+ if (ideDeclaration instanceof MemberDeclaration) {
+ MemberDeclaration memberDeclaration = (MemberDeclaration)ideDeclaration;
+ return !memberDeclaration.isStatic() && !memberDeclaration.isConstructor();
+ } else {
+ // must be an imported namespace.
+ }
}
}
return false;
diff --git a/jooc/src/main/java/net/jangaroo/jooc/TryStatement.java b/jooc/src/main/java/net/jangaroo/jooc/TryStatement.java
index 4db4add6d..8b2ea527a 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/TryStatement.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/TryStatement.java
@@ -16,7 +16,7 @@
package net.jangaroo.jooc;
import java.io.IOException;
-import java.util.ArrayList;
+import java.util.List;
/**
* @author Andreas Gawecki
@@ -24,15 +24,15 @@
class TryStatement extends KeywordStatement {
BlockStatement block;
- ArrayList catches;
+ List<Catch> catches;
JooSymbol symFinally;
BlockStatement finallyBlock;
- public TryStatement(JooSymbol symTry, BlockStatement block, ArrayList catches) {
+ public TryStatement(JooSymbol symTry, BlockStatement block, List<Catch> catches) {
this(symTry, block, catches, null, null);
}
- public TryStatement(JooSymbol symTry, BlockStatement block, ArrayList catches, JooSymbol symFinally, BlockStatement finallyBlock) {
+ public TryStatement(JooSymbol symTry, BlockStatement block, List<Catch> catches, JooSymbol symFinally, BlockStatement finallyBlock) {
super(symTry);
this.block = block;
this.catches = catches;
diff --git a/jooc/src/main/java/net/jangaroo/jooc/UseNamespaceDirective.java b/jooc/src/main/java/net/jangaroo/jooc/UseNamespaceDirective.java
new file mode 100644
index 000000000..007530b56
--- /dev/null
+++ b/jooc/src/main/java/net/jangaroo/jooc/UseNamespaceDirective.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2008 CoreMedia AG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS
+ * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+package net.jangaroo.jooc;
+
+import java.io.IOException;
+
+/**
+ * @author Frank Wienberg
+ */
+public class UseNamespaceDirective extends NodeImplBase {
+
+ JooSymbol useKeyword;
+ JooSymbol namespaceKeyword;
+ Ide namespace;
+
+ public UseNamespaceDirective(JooSymbol useKeyword, JooSymbol namespaceKeyword, Ide namespace) {
+ this.useKeyword = useKeyword;
+ this.namespaceKeyword = namespaceKeyword;
+ this.namespace = namespace;
+ }
+
+ @Override
+ public Node analyze(Node parentNode, AnalyzeContext context) {
+ PackageDeclaration packageDeclaration = context.getCurrentPackage();
+ if (packageDeclaration!=null) {
+ packageDeclaration.addNamespace(namespace.getQualifiedNameStr());
+ }
+ return super.analyze(parentNode, context);
+ }
+
+ public void generateCode(JsWriter out) throws IOException {
+ out.beginString();
+ out.writeSymbol(useKeyword);
+ out.writeSymbol(namespaceKeyword);
+ namespace.generateCode(out);
+ out.endString();
+ out.writeToken(",");
+ }
+
+ public JooSymbol getSymbol() {
+ return useKeyword;
+ }
+
+}
\ No newline at end of file
diff --git a/jooc/src/main/java/net/jangaroo/jooc/backend/AbstractCompilationUnitSinkFactory.java b/jooc/src/main/java/net/jangaroo/jooc/backend/AbstractCompilationUnitSinkFactory.java
index 926a1bf05..8507901fc 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/backend/AbstractCompilationUnitSinkFactory.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/backend/AbstractCompilationUnitSinkFactory.java
@@ -2,7 +2,7 @@
import net.jangaroo.jooc.Jooc;
import net.jangaroo.jooc.PackageDeclaration;
-import net.jangaroo.jooc.ClassDeclaration;
+import net.jangaroo.jooc.IdeDeclaration;
import java.io.File;
@@ -50,6 +50,6 @@ protected void createOutputDirs(File outputFile) {
}
public abstract CompilationUnitSink createSink(PackageDeclaration packageDeclaration,
- ClassDeclaration classDeclaration, File sourceFile,
+ IdeDeclaration primaryDeclaration, File sourceFile,
boolean verbose);
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/backend/CompilationUnitSinkFactory.java b/jooc/src/main/java/net/jangaroo/jooc/backend/CompilationUnitSinkFactory.java
index fae15fe25..858eaaf10 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/backend/CompilationUnitSinkFactory.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/backend/CompilationUnitSinkFactory.java
@@ -1,7 +1,7 @@
package net.jangaroo.jooc.backend;
import net.jangaroo.jooc.PackageDeclaration;
-import net.jangaroo.jooc.ClassDeclaration;
+import net.jangaroo.jooc.IdeDeclaration;
import java.io.File;
@@ -10,6 +10,6 @@
*/
public interface CompilationUnitSinkFactory {
CompilationUnitSink createSink(PackageDeclaration packageDeclaration,
- ClassDeclaration classDeclaration, File sourceFile,
+ IdeDeclaration primaryDeclaration, File sourceFile,
boolean verbose);
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/backend/MergedOutputCompilationUnitSinkFactory.java b/jooc/src/main/java/net/jangaroo/jooc/backend/MergedOutputCompilationUnitSinkFactory.java
index 590443ac5..e32d6d8f9 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/backend/MergedOutputCompilationUnitSinkFactory.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/backend/MergedOutputCompilationUnitSinkFactory.java
@@ -53,10 +53,10 @@ public void writeOutput(CodeGenerator codeGenerator) {
}
public CompilationUnitSink createSink(PackageDeclaration packageDeclaration,
- ClassDeclaration classDeclaration, File sourceFile,
+ IdeDeclaration primaryDeclaration, File sourceFile,
final boolean verbose) {
if (verbose)
- System.out.println("writing " + classDeclaration.getName() + " to file: '" + outputFile.getAbsolutePath() + "'");
+ System.out.println("writing " + primaryDeclaration.getName() + " to file: '" + outputFile.getAbsolutePath() + "'");
return sink;
}
diff --git a/jooc/src/main/java/net/jangaroo/jooc/backend/SingleFileCompilationUnitSinkFactory.java b/jooc/src/main/java/net/jangaroo/jooc/backend/SingleFileCompilationUnitSinkFactory.java
index aa768452d..8444359cb 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/backend/SingleFileCompilationUnitSinkFactory.java
+++ b/jooc/src/main/java/net/jangaroo/jooc/backend/SingleFileCompilationUnitSinkFactory.java
@@ -47,15 +47,15 @@ protected String getOutputFileName(File sourceFile, String[] packageName) {
}
public CompilationUnitSink createSink(PackageDeclaration packageDeclaration,
- ClassDeclaration classDeclaration, File sourceFile,
+ IdeDeclaration primaryDeclaration, File sourceFile,
final boolean verbose) {
final File outFile = getOutputFile(sourceFile, packageDeclaration.getQualifiedName());
String fileName = outFile.getName();
String classPart = fileName.substring(0, fileName.lastIndexOf('.'));
- String className = classDeclaration.getName();
+ String className = primaryDeclaration.getName();
if (!classPart.equals(className))
- Jooc.error(classDeclaration,
+ Jooc.error(primaryDeclaration,
"class name must be equal to file name: expected " + classPart + ", found " + className);
createOutputDirs(outFile);
diff --git a/jooc/src/main/jflex/net/jangaroo/jooc/joo.flex b/jooc/src/main/jflex/net/jangaroo/jooc/joo.flex
index 7766776c2..fa4fafc41 100644
--- a/jooc/src/main/jflex/net/jangaroo/jooc/joo.flex
+++ b/jooc/src/main/jflex/net/jangaroo/jooc/joo.flex
@@ -137,7 +137,7 @@ static int[] terminalsAllowedBeforeRegexpLiteral = {
String fileName = getFileName();
int lastSlashPos = Math.max(fileName.lastIndexOf('\\'), fileName.lastIndexOf('/'));
String dir = lastSlashPos>=0 ? fileName.substring(0,lastSlashPos+1) : "";
- return dir+includeString.substring("include \"".length(), includeString.length()-2);
+ return dir+includeString.substring("include \"".length(), includeString.length()-1);
}
static {
@@ -172,6 +172,7 @@ static int[] terminalsAllowedBeforeRegexpLiteral = {
defsym("interface", INTERFACE);
defsym("internal", INTERNAL);
defsym("is", IS);
+ defsym("namespace", NAMESPACE);
defsym("new", NEW);
defsym("null", NULL_LITERAL);
defsym("override", OVERRIDE);
@@ -191,6 +192,7 @@ static int[] terminalsAllowedBeforeRegexpLiteral = {
defsym("transient", TRANSIENT);
defsym("try", TRY);
defsym("typeof", TYPEOF);
+ defsym("use", USE);
defsym("var", VAR);
defsym("void", VOID);
defsym("volatile", VOLATILE);
@@ -227,6 +229,7 @@ static int[] terminalsAllowedBeforeRegexpLiteral = {
defsym("|", OR);
defsym("^", XOR);
defsym("%", MOD);
+ defsym("~", BITNOT);
defsym("<<", LSHIFT);
defsym(">>", RSHIFT);
defsym(">>>", URSHIFT);
@@ -244,6 +247,7 @@ static int[] terminalsAllowedBeforeRegexpLiteral = {
defsym("===", EQEQEQ);
defsym("!==", NOTEQEQ);
defsym("...", REST);
+ defsym("::", NAMESPACESEP);
}
%}
@@ -277,7 +281,7 @@ NonTerminator = [^\n]
HexDigit = [0-9abcdefABCDEF]
-Include = "include \"" ~"\";"
+Include = "include \"" ~"\""
%state STRING_SQ, STRING_DQ, REGEXPFIRST, REGEXP
@@ -320,6 +324,7 @@ Include = "include \"" ~"\";"
"interface" { return symbol(INTERFACE); }
"internal" { return symbol(INTERNAL); }
"is" { return symbol(IS); }
+ "namespace" { return symbol(NAMESPACE); }
"new" { return symbol(NEW); }
"null" { return symbol(NULL_LITERAL, null); }
"override" { return symbol(OVERRIDE); }
@@ -339,6 +344,7 @@ Include = "include \"" ~"\";"
"transient" { return symbol(TRANSIENT); }
"try" { return symbol(TRY); }
"typeof" { return symbol(TYPEOF); }
+ "use" { return symbol(USE); }
"var" { return symbol(VAR); }
"void" { return symbol(VOID); }
"volatile" { return symbol(VOLATILE); }
@@ -380,6 +386,7 @@ Include = "include \"" ~"\";"
"|" { return symbol(OR); }
"^" { return symbol(XOR); }
"%" { return symbol(MOD); }
+ "~" { return symbol(BITNOT); }
"<<" { return symbol(LSHIFT); }
">>" { return symbol(RSHIFT); }
">>>" { return symbol(URSHIFT); }
@@ -396,6 +403,7 @@ Include = "include \"" ~"\";"
"===" { return symbol(EQEQEQ); }
"!==" { return symbol(NOTEQEQ); }
"..." { return symbol(REST); }
+ "::" { return symbol(NAMESPACESEP); }
"/" { if (!maybeRegexpLiteral())
return symbol(DIV);
@@ -413,7 +421,7 @@ Include = "include \"" ~"\";"
\' { multiStateText = yytext(); yybegin(STRING_SQ); string.setLength(0); }
{DecIntegerLiteral} { return symbol(INT_LITERAL, new Integer(yytext())); }
- {HexIntegerLiteral} { return symbol(INT_LITERAL, Integer.parseInt(yytext().substring(2),16)); }
+ {HexIntegerLiteral} { return symbol(INT_LITERAL, Long.parseLong(yytext().substring(2),16)); }
{DoubleLiteral} { return symbol(FLOAT_LITERAL, new Double(yytext())); }
}
diff --git a/jooc/src/main/js/joo/Class.js b/jooc/src/main/js/joo/Class.js
index ffa7fa9bd..54c484e65 100644
--- a/jooc/src/main/js/joo/Class.js
+++ b/jooc/src/main/js/joo/Class.js
@@ -544,6 +544,10 @@ Function.prototype.bind = function(object) {
} else if (j==modifiers.length-1) {
// last "modifier" is the member name:
memberName = modifier;
+ } else if (modifier=="import") {
+ // TODO, for now, just ignore inner imports:
+ ++i;
+ continue;
} else {
throw new Error("Unknown modifier '"+modifier+"'.");
}
@@ -722,13 +726,16 @@ Function.prototype.bind = function(object) {
imports.packages = [""]; // always "import" top level package!
for (var im=1; im<arguments.length-3; ++im) {
var importMatch = arguments[im].match(/^\s*import\s+(([a-zA-Z$_0-9]+\.)*)(\*|[a-zA-Z$_0-9]+)\s*$/);
- var importPackageName = importMatch[1]; // including last dot
- var importClassName = importMatch[3];
- if (importClassName == "*") {
- imports.packages.push(importPackageName);
- } else {
- addImport(imports, importPackageName+importClassName);
+ if (importMatch) {
+ var importPackageName = importMatch[1]; // including last dot
+ var importClassName = importMatch[3];
+ if (importClassName == "*") {
+ imports.packages.push(importPackageName);
+ } else {
+ addImport(imports, importPackageName+importClassName);
+ }
}
+ // else: TODO! use namespace, annotations, package-scope functions, namespace declarations...
}
var packageName = "";
if (typeof packageDef=="string") {
diff --git a/jooc/src/test/java/net/jangaroo/test/integration/JooTest.java b/jooc/src/test/java/net/jangaroo/test/integration/JooTest.java
index d00ea2e39..297a35ed8 100644
--- a/jooc/src/test/java/net/jangaroo/test/integration/JooTest.java
+++ b/jooc/src/test/java/net/jangaroo/test/integration/JooTest.java
@@ -168,6 +168,9 @@ public void testStatements() throws Exception {
expectNumber(42, "var o2 = { tobedeleted: 42 }; o2.tobedeleted");
expectString("undefined", "obj.testDelete1(o); typeof(o.tobedeleted)");
expectString("undefined", "obj.testDelete2(o2, 'tobedeleted'); typeof(o.tobedeleted)");
+ expectString("is an Error: foo", "obj.testTryCatchFinally(new Error('foo'))");
+ expectString("is not an Error: bar", "obj.testTryCatchFinally('bar')");
+ expectBoolean(true, "obj.cleanedUp");
}
public void testExpressions() throws Exception {
@@ -201,6 +204,12 @@ public void testImport() throws Exception {
expectString("s2/s1"+"/"+(-19+42), "package2.TestImport.main()");
}
+ public void testInclude() throws Exception {
+ loadClass("package2.TestInclude");
+ expectString("included!", "package2.TestInclude.testIncludeSameDir()");
+ expectString("included!", "package2.TestInclude.testIncludeOtherDir()");
+ }
+
public void testSelfAwareness() throws Exception {
runClass("package1.TestSelfAwareness");
}
@@ -246,9 +255,20 @@ public void testUnqualifiedAccess() throws Exception {
expectString("foo", "package1.TestUnqualifiedAccess.SET_BY_STATIC_INITIALIZER");
expectBoolean(true, "obj.testLocalFunction()");
+
+ expectString("foo", "obj.testForwardPrivateUnqualified('foo')");
+
// TODO: test "unqualified access to super members"!
}
+ public void testTypeCast() throws Exception {
+ loadClass("package2.TestImport");
+ loadClass("package1.TestTypeCast");
+ eval("obj = new package1.TestTypeCast()");
+ expectBoolean(true, "package1.TestTypeCast.testAsCast(obj)===obj");
+ expectBoolean(true, "package1.TestTypeCast.testFunctionCast(obj)===obj");
+ }
+
public void testNoSuper() throws Exception {
loadClass("package1.TestNoSuper");
try {
diff --git a/jooc/src/main/java/net/jangaroo/jooc/DeleteStatement.java b/jooc/src/test/joo/package1/TestInclude_fragment.as
similarity index 70%
rename from jooc/src/main/java/net/jangaroo/jooc/DeleteStatement.java
rename to jooc/src/test/joo/package1/TestInclude_fragment.as
index 6d363426f..f30d5a834 100644
--- a/jooc/src/main/java/net/jangaroo/jooc/DeleteStatement.java
+++ b/jooc/src/test/joo/package1/TestInclude_fragment.as
@@ -13,14 +13,4 @@
* governing permissions and limitations under the License.
*/
-package net.jangaroo.jooc;
-
-/**
- * @author Andreas Gawecki
- */
-class DeleteStatement extends KeywordExprStatement {
-
- public DeleteStatement(JooSymbol symDelete, Expr expr, JooSymbol symSemicolon) {
- super(symDelete, expr, symSemicolon);
- }
-}
+public static const INCLUDED_OTHER_DIR : String = "included!";
diff --git a/jooc/src/test/joo/package1/TestInitializers.as b/jooc/src/test/joo/package1/TestInitializers.as
index 59de4e9e0..2010ab80f 100644
--- a/jooc/src/test/joo/package1/TestInitializers.as
+++ b/jooc/src/test/joo/package1/TestInitializers.as
@@ -23,6 +23,10 @@ public class TestInitializers {
protected var slot1;
protected var slot2 = 2;
+ protected var slot3 = {
+ nolabel: 1,
+ alsonolabel: 2
+ };
public function getSlot1() :int {
return this.slot1;
diff --git a/jooc/src/test/joo/package1/TestTypeCast.as b/jooc/src/test/joo/package1/TestTypeCast.as
new file mode 100644
index 000000000..5a4a5d954
--- /dev/null
+++ b/jooc/src/test/joo/package1/TestTypeCast.as
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 CoreMedia AG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS
+ * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+package package1 {
+
+import package2.TestImport;
+
+public class TestTypeCast {
+
+ public function TestTypeCast() {
+ }
+
+ public static function testAsCast(p : Object) : TestTypeCast {
+ return p as TestTypeCast;
+ }
+
+ public static function testFunctionCast(p : Object) : TestTypeCast {
+ p = TestImport(p);
+ p = package2.TestImport(p);
+ return TestTypeCast(p);
+ }
+
+}
+}
diff --git a/jooc/src/test/joo/package1/TestUnqualifiedAccess.as b/jooc/src/test/joo/package1/TestUnqualifiedAccess.as
index 9b12f7b7b..dca8933ce 100644
--- a/jooc/src/test/joo/package1/TestUnqualifiedAccess.as
+++ b/jooc/src/test/joo/package1/TestUnqualifiedAccess.as
@@ -61,6 +61,14 @@ public class TestUnqualifiedAccess {
return localFunction();
}
+ public function testForwardPrivateUnqualified(p : *) : void {
+ return forwardPrivate(p);
+ }
+
+ private function forwardPrivate(p : *) : void {
+ return p;
+ }
+
public static const UNQUALIFIED_CLASS_EQUALS_QUALIFIED_CLASS : Boolean = TestUnqualifiedAccess === package1.TestUnqualifiedAccess;
public static var SET_BY_STATIC_INITIALIZER : String;
diff --git a/jooc/src/test/joo/package2/TestExpressions.as b/jooc/src/test/joo/package2/TestExpressions.as
index 074a47f35..7556f3e19 100644
--- a/jooc/src/test/joo/package2/TestExpressions.as
+++ b/jooc/src/test/joo/package2/TestExpressions.as
@@ -21,7 +21,8 @@ public class TestExpressions {
}
public function antitestRegexpLiterals():int {
- var i = 1 / 2 / 3;
+ var i:Number = 1 / 2 / 3;
+ ++i; // just to avoid "unused variable" warning
return (1 + 1) / 2;
}
@@ -49,7 +50,7 @@ public class TestExpressions {
return '\'' + '¤' + '\\' + '\b' + '\t' + '\n' + '\f' + '\r' + '\'' + '/' + '\'' + '\u00C6' + '\u01bF' + 'e' + '"' + '\'';
}
- public function testRegexpLiterals() {
+ public function testRegexpLiterals():String {
return [
"abc".match(/(abc)*/).length,
" abc abcabcab cabcabc abca bcabcabcabcabcab cabcab cabcabc".match(/(abc)+/g).length,
@@ -59,12 +60,12 @@ public class TestExpressions {
].join(',');
}
- public function testObjectLiterals() {
+ public function testObjectLiterals():int {
var o : * = { x: 123, "y": 456 };
return o.x + o.y;
}
- public function testArrayLiterals() {
+ public function testArrayLiterals():String {
return [ 1+2-2,2+3-3,3+4-4,4,5,6,7,8,9,0 ].join(',');
}
@@ -73,29 +74,29 @@ public class TestExpressions {
}
public function testAssignOpExpr(n:int):int {
- var x = n;
+ var x:Number= n;
x/=2;
return n;
}
- public function testFunExpr(n:int) {
+ public function testFunExpr(n:int):void {
return function(m:int) { return n*m; };
}
- public function testPrefixOpExpr(n:int) {
+ public function testPrefixOpExpr(n:int):void {
return 1+-n+11;
}
- public function testPostfixOpExpr(n:int) {
- var x = 1+n--;
+ public function testPostfixOpExpr(n:int):void {
+ var x:int = 1+n--;
return n+x;
}
- public function testCond(cond:boolean, ifTrue :int, ifFalse :int):int {
+ public function testCond(cond:Boolean, ifTrue :int, ifFalse :int):int {
return cond ? ifTrue : ifFalse;
}
- public function testIn(obj:Object, prop:String):int {
+ public function testIn(obj:Object, prop:String):Boolean {
return prop in obj;
}
diff --git a/jooc/src/test/joo/package2/TestInclude.as b/jooc/src/test/joo/package2/TestInclude.as
new file mode 100644
index 000000000..487243ab9
--- /dev/null
+++ b/jooc/src/test/joo/package2/TestInclude.as
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2008 CoreMedia AG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS
+ * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+package package2 {
+
+public class TestInclude {
+
+ public function TestInclude() {
+ }
+
+ include "TestInclude_fragment.as"
+
+ public static function testIncludeSameDir() : String {
+ return INCLUDED_SAME_DIR;
+ }
+
+ include "../package1/TestInclude_fragment.as"
+
+ public static function testIncludeOtherDir() : String {
+ return INCLUDED_OTHER_DIR;
+ }
+
+}
+}
\ No newline at end of file
diff --git a/jooc/src/test/joo/package2/TestInclude_fragment.as b/jooc/src/test/joo/package2/TestInclude_fragment.as
new file mode 100644
index 000000000..950d398a9
--- /dev/null
+++ b/jooc/src/test/joo/package2/TestInclude_fragment.as
@@ -0,0 +1,16 @@
+/*
+ * Copyright 2008 CoreMedia AG
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an "AS
+ * IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
+ * express or implied. See the License for the specific language
+ * governing permissions and limitations under the License.
+ */
+
+public static const INCLUDED_SAME_DIR : String = "included!";
diff --git a/jooc/src/test/joo/package2/TestStatements.as b/jooc/src/test/joo/package2/TestStatements.as
index c2fc741bf..d3273af82 100644
--- a/jooc/src/test/joo/package2/TestStatements.as
+++ b/jooc/src/test/joo/package2/TestStatements.as
@@ -126,5 +126,33 @@ public class TestStatements {
delete o[slot];
}
+ public function testTryCatchFinally(e :Object):String {
+ try {
+ throw e;
+ } catch(any) {
+ // ignore
+ }
+ try {
+ throw e;
+ } catch(any:Object) {
+ // ignore
+ }
+ try {
+ throw e;
+ } catch(any:*) {
+ // ignore
+ }
+ try {
+ throw e;
+ } catch(e1:Error) {
+ return "is an Error: "+e1.message;
+ } catch(e2) {
+ return "is not an Error: "+e2;
+ } finally {
+ this.cleanedUp = true;
+ }
+ }
+
+ public var cleanedUp : Boolean = false;
}
}
\ No newline at end of file
|
31f4ff749c34c8ff573a1d6e1688c39ea1b4463c
|
kotlin
|
Type annotations supported in Java elements--Reflection-related implementations are pending-
|
a
|
https://github.com/JetBrains/kotlin
|
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/PsiBasedExternalAnnotationResolver.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/PsiBasedExternalAnnotationResolver.java
index 4bd2daea519fb..0b8ff30a6a078 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/PsiBasedExternalAnnotationResolver.java
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/components/PsiBasedExternalAnnotationResolver.java
@@ -24,8 +24,8 @@
import org.jetbrains.kotlin.load.java.structure.JavaAnnotation;
import org.jetbrains.kotlin.load.java.structure.JavaAnnotationOwner;
import org.jetbrains.kotlin.load.java.structure.impl.JavaAnnotationImpl;
-import org.jetbrains.kotlin.load.java.structure.impl.JavaAnnotationOwnerImpl;
import org.jetbrains.kotlin.load.java.structure.impl.JavaElementCollectionFromPsiArrayUtil;
+import org.jetbrains.kotlin.load.java.structure.impl.JavaModifierListOwnerImpl;
import org.jetbrains.kotlin.name.FqName;
import java.util.Collection;
@@ -35,18 +35,25 @@ public class PsiBasedExternalAnnotationResolver implements ExternalAnnotationRes
@Nullable
@Override
public JavaAnnotation findExternalAnnotation(@NotNull JavaAnnotationOwner owner, @NotNull FqName fqName) {
- PsiAnnotation psiAnnotation = findExternalAnnotation(((JavaAnnotationOwnerImpl) owner).getPsi(), fqName);
- return psiAnnotation == null ? null : new JavaAnnotationImpl(psiAnnotation);
+ if (owner instanceof JavaModifierListOwnerImpl) {
+ JavaModifierListOwnerImpl modifierListOwner = (JavaModifierListOwnerImpl) owner;
+ PsiAnnotation psiAnnotation = findExternalAnnotation(modifierListOwner.getPsi(), fqName);
+ return psiAnnotation == null ? null : new JavaAnnotationImpl(psiAnnotation);
+ }
+ return null;
}
@NotNull
@Override
public Collection<JavaAnnotation> findExternalAnnotations(@NotNull JavaAnnotationOwner owner) {
- PsiModifierListOwner psiOwner = ((JavaAnnotationOwnerImpl) owner).getPsi();
- PsiAnnotation[] annotations = ExternalAnnotationsManager.getInstance(psiOwner.getProject()).findExternalAnnotations(psiOwner);
- return annotations == null
- ? Collections.<JavaAnnotation>emptyList()
- : JavaElementCollectionFromPsiArrayUtil.annotations(annotations);
+ if (owner instanceof JavaModifierListOwnerImpl) {
+ PsiModifierListOwner psiOwner = ((JavaModifierListOwnerImpl) owner).getPsi();
+ PsiAnnotation[] annotations = ExternalAnnotationsManager.getInstance(psiOwner.getProject()).findExternalAnnotations(psiOwner);
+ return annotations == null
+ ? Collections.<JavaAnnotation>emptyList()
+ : JavaElementCollectionFromPsiArrayUtil.annotations(annotations);
+ }
+ return Collections.emptyList();
}
@Nullable
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaAnnotationOwnerImpl.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaAnnotationOwnerImpl.java
index dab67466412c0..c13860e33d61d 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaAnnotationOwnerImpl.java
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaAnnotationOwnerImpl.java
@@ -16,11 +16,11 @@
package org.jetbrains.kotlin.load.java.structure.impl;
-import com.intellij.psi.PsiModifierListOwner;
-import org.jetbrains.annotations.NotNull;
+import com.intellij.psi.PsiAnnotationOwner;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.load.java.structure.JavaAnnotationOwner;
public interface JavaAnnotationOwnerImpl extends JavaAnnotationOwner {
- @NotNull
- PsiModifierListOwner getPsi();
+ @Nullable
+ PsiAnnotationOwner getAnnotationOwnerPsi();
}
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.java
index 57db2aef0371b..d7f9e5d13dd79 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.java
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassImpl.java
@@ -146,18 +146,6 @@ public Visibility getVisibility() {
return JavaElementUtil.getVisibility(this);
}
- @NotNull
- @Override
- public Collection<JavaAnnotation> getAnnotations() {
- return JavaElementUtil.getAnnotations(this);
- }
-
- @Nullable
- @Override
- public JavaAnnotation findAnnotation(@NotNull FqName fqName) {
- return JavaElementUtil.findAnnotation(this, fqName);
- }
-
@Override
@NotNull
public JavaClassifierType getDefaultType() {
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassifierImpl.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassifierImpl.java
index cbca1c0ecaf74..f94bd71652e28 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassifierImpl.java
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaClassifierImpl.java
@@ -16,16 +16,28 @@
package org.jetbrains.kotlin.load.java.structure.impl;
+import com.intellij.psi.PsiAnnotationOwner;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiTypeParameter;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.kotlin.load.java.structure.JavaAnnotation;
import org.jetbrains.kotlin.load.java.structure.JavaClassifier;
+import org.jetbrains.kotlin.name.FqName;
-public abstract class JavaClassifierImpl<Psi extends PsiClass> extends JavaElementImpl<Psi> implements JavaClassifier {
+import java.util.Collection;
+
+public abstract class JavaClassifierImpl<Psi extends PsiClass> extends JavaElementImpl<Psi> implements JavaClassifier, JavaAnnotationOwnerImpl {
protected JavaClassifierImpl(@NotNull Psi psiClass) {
super(psiClass);
}
+ @NotNull
+ @Override
+ public PsiAnnotationOwner getAnnotationOwnerPsi() {
+ return getPsi().getModifierList();
+ }
+
@NotNull
/* package */ static JavaClassifier create(@NotNull PsiClass psiClass) {
if (psiClass instanceof PsiTypeParameter) {
@@ -35,4 +47,16 @@ protected JavaClassifierImpl(@NotNull Psi psiClass) {
return new JavaClassImpl(psiClass);
}
}
+
+ @NotNull
+ @Override
+ public Collection<JavaAnnotation> getAnnotations() {
+ return JavaElementUtil.getAnnotations(this);
+ }
+
+ @Nullable
+ @Override
+ public JavaAnnotation findAnnotation(@NotNull FqName fqName) {
+ return JavaElementUtil.findAnnotation(this, fqName);
+ }
}
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java
index 03c6cdc46d60a..c0a225744c313 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaElementUtil.java
@@ -16,10 +16,7 @@
package org.jetbrains.kotlin.load.java.structure.impl;
-import com.intellij.psi.PsiAnnotation;
-import com.intellij.psi.PsiModifier;
-import com.intellij.psi.PsiModifierList;
-import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.descriptors.Visibilities;
@@ -66,18 +63,18 @@ public static Visibility getVisibility(@NotNull JavaModifierListOwnerImpl owner)
@NotNull
public static Collection<JavaAnnotation> getAnnotations(@NotNull JavaAnnotationOwnerImpl owner) {
- PsiModifierList modifierList = owner.getPsi().getModifierList();
- if (modifierList != null) {
- return annotations(modifierList.getAnnotations());
+ PsiAnnotationOwner annotationOwnerPsi = owner.getAnnotationOwnerPsi();
+ if (annotationOwnerPsi != null) {
+ return annotations(annotationOwnerPsi.getAnnotations());
}
return Collections.emptyList();
}
@Nullable
public static JavaAnnotation findAnnotation(@NotNull JavaAnnotationOwnerImpl owner, @NotNull FqName fqName) {
- PsiModifierList modifierList = owner.getPsi().getModifierList();
- if (modifierList != null) {
- PsiAnnotation psiAnnotation = modifierList.findAnnotation(fqName.asString());
+ PsiAnnotationOwner annotationOwnerPsi = owner.getAnnotationOwnerPsi();
+ if (annotationOwnerPsi != null) {
+ PsiAnnotation psiAnnotation = annotationOwnerPsi.findAnnotation(fqName.asString());
return psiAnnotation == null ? null : new JavaAnnotationImpl(psiAnnotation);
}
return null;
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaMemberImpl.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaMemberImpl.java
index 03989fb0a0b0d..f730d42fc57c9 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaMemberImpl.java
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaMemberImpl.java
@@ -16,6 +16,7 @@
package org.jetbrains.kotlin.load.java.structure.impl;
+import com.intellij.psi.PsiAnnotationOwner;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMember;
import org.jetbrains.annotations.NotNull;
@@ -35,6 +36,12 @@ protected JavaMemberImpl(@NotNull Psi psiMember) {
super(psiMember);
}
+ @Nullable
+ @Override
+ public PsiAnnotationOwner getAnnotationOwnerPsi() {
+ return getPsi().getModifierList();
+ }
+
@NotNull
@Override
public Name getName() {
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaTypeImpl.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaTypeImpl.java
index 1b55598c52969..e2874bafc5af7 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaTypeImpl.java
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaTypeImpl.java
@@ -19,10 +19,14 @@
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.kotlin.load.java.structure.JavaAnnotation;
import org.jetbrains.kotlin.load.java.structure.JavaArrayType;
import org.jetbrains.kotlin.load.java.structure.JavaType;
+import org.jetbrains.kotlin.name.FqName;
-public abstract class JavaTypeImpl<Psi extends PsiType> implements JavaType {
+import java.util.Collection;
+
+public abstract class JavaTypeImpl<Psi extends PsiType> implements JavaType, JavaAnnotationOwnerImpl {
private final Psi psiType;
public JavaTypeImpl(@NotNull Psi psiType) {
@@ -34,6 +38,12 @@ public Psi getPsi() {
return psiType;
}
+ @Nullable
+ @Override
+ public PsiAnnotationOwner getAnnotationOwnerPsi() {
+ return getPsi();
+ }
+
@NotNull
public static JavaTypeImpl<?> create(@NotNull PsiType psiType) {
return psiType.accept(new PsiTypeVisitor<JavaTypeImpl<?>>() {
@@ -75,6 +85,19 @@ public JavaArrayType createArrayType() {
return new JavaArrayTypeImpl(getPsi().createArrayType());
}
+ @NotNull
+ @Override
+ public Collection<JavaAnnotation> getAnnotations() {
+ return JavaElementUtil.getAnnotations(this);
+ }
+
+ @Nullable
+ @Override
+ public JavaAnnotation findAnnotation(@NotNull FqName fqName) {
+ return JavaElementUtil.findAnnotation(this, fqName);
+ }
+
+
@Override
public int hashCode() {
return getPsi().hashCode();
diff --git a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaValueParameterImpl.java b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaValueParameterImpl.java
index d54774cbed419..d8a03f5ad37b7 100644
--- a/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaValueParameterImpl.java
+++ b/compiler/frontend.java/src/org/jetbrains/kotlin/load/java/structure/impl/JavaValueParameterImpl.java
@@ -16,10 +16,13 @@
package org.jetbrains.kotlin.load.java.structure.impl;
+import com.intellij.psi.PsiAnnotationOwner;
import com.intellij.psi.PsiParameter;
import com.intellij.psi.impl.compiled.ClsParameterImpl;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.kotlin.descriptors.Visibilities;
+import org.jetbrains.kotlin.descriptors.Visibility;
import org.jetbrains.kotlin.load.java.structure.JavaAnnotation;
import org.jetbrains.kotlin.load.java.structure.JavaType;
import org.jetbrains.kotlin.load.java.structure.JavaValueParameter;
@@ -28,11 +31,39 @@
import java.util.Collection;
-public class JavaValueParameterImpl extends JavaElementImpl<PsiParameter> implements JavaValueParameter, JavaAnnotationOwnerImpl {
+public class JavaValueParameterImpl extends JavaElementImpl<PsiParameter>
+ implements JavaValueParameter, JavaAnnotationOwnerImpl, JavaModifierListOwnerImpl {
public JavaValueParameterImpl(@NotNull PsiParameter psiParameter) {
super(psiParameter);
}
+ @Nullable
+ @Override
+ public PsiAnnotationOwner getAnnotationOwnerPsi() {
+ return getPsi().getModifierList();
+ }
+
+ @Override
+ public boolean isAbstract() {
+ return false;
+ }
+
+ @Override
+ public boolean isStatic() {
+ return false;
+ }
+
+ @Override
+ public boolean isFinal() {
+ return false;
+ }
+
+ @NotNull
+ @Override
+ public Visibility getVisibility() {
+ return Visibilities.LOCAL;
+ }
+
@NotNull
@Override
public Collection<JavaAnnotation> getAnnotations() {
diff --git a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/structure/JavaClassifierType.java b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/structure/JavaClassifierType.java
index d776e0de3c86d..02711b38a9b1d 100644
--- a/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/structure/JavaClassifierType.java
+++ b/core/descriptor.loader.java/src/org/jetbrains/kotlin/load/java/structure/JavaClassifierType.java
@@ -23,7 +23,7 @@
import java.util.Collection;
import java.util.List;
-public interface JavaClassifierType extends JavaType {
+public interface JavaClassifierType extends JavaType, JavaAnnotationOwner {
@Nullable
JavaClassifier getClassifier();
diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClassifierType.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClassifierType.kt
index f18d036a06f14..f7e863fe164c4 100644
--- a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClassifierType.kt
+++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/java/structure/reflect/ReflectJavaClassifierType.kt
@@ -16,10 +16,8 @@
package org.jetbrains.kotlin.load.java.structure.reflect
-import org.jetbrains.kotlin.load.java.structure.JavaClassifier
-import org.jetbrains.kotlin.load.java.structure.JavaClassifierType
-import org.jetbrains.kotlin.load.java.structure.JavaType
-import org.jetbrains.kotlin.load.java.structure.JavaTypeSubstitutor
+import org.jetbrains.kotlin.load.java.structure.*
+import org.jetbrains.kotlin.name.FqName
import java.lang.reflect.ParameterizedType
import java.lang.reflect.Type
import java.lang.reflect.TypeVariable
@@ -48,4 +46,12 @@ public class ReflectJavaClassifierType(public override val type: Type) : Reflect
override fun getTypeArguments(): List<JavaType> {
return (type as? ParameterizedType)?.getActualTypeArguments()?.map { ReflectJavaType.create(it) } ?: listOf()
}
+
+ override fun getAnnotations(): Collection<JavaAnnotation> {
+ return emptyList() // TODO
+ }
+
+ override fun findAnnotation(fqName: FqName): JavaAnnotation? {
+ return null // TODO
+ }
}
|
ad5306f24ccb42ced48a95419850f41d662fc5ac
|
hadoop
|
HADOOP-6906. FileContext copy() utility doesn't- work with recursive copying of directories. (vinod k v via mahadev)--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@987374 13f79535-47bb-0310-9956-ffa450edef68-
|
c
|
https://github.com/apache/hadoop
|
diff --git a/CHANGES.txt b/CHANGES.txt
index 29261198d9086..4ca817d7b59a5 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -205,6 +205,9 @@ Trunk (unreleased changes)
HADOOP-6482. GenericOptionsParser constructor that takes Options and
String[] ignores options. (Eli Collins via jghoman)
+ HADOOP-6906. FileContext copy() utility doesn't work with recursive
+ copying of directories. (vinod k v via mahadev)
+
Release 0.21.0 - Unreleased
INCOMPATIBLE CHANGES
diff --git a/src/java/org/apache/hadoop/fs/ChecksumFs.java b/src/java/org/apache/hadoop/fs/ChecksumFs.java
index cc5123af56058..89f386611cf92 100644
--- a/src/java/org/apache/hadoop/fs/ChecksumFs.java
+++ b/src/java/org/apache/hadoop/fs/ChecksumFs.java
@@ -20,6 +20,7 @@
import java.io.*;
import java.net.URISyntaxException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.EnumSet;
@@ -478,4 +479,19 @@ public boolean reportChecksumFailure(Path f, FSDataInputStream in,
long inPos, FSDataInputStream sums, long sumsPos) {
return false;
}
+
+ @Override
+ protected FileStatus[] listStatus(Path f) throws IOException,
+ UnresolvedLinkException {
+ ArrayList<FileStatus> results = new ArrayList<FileStatus>();
+ FileStatus[] listing = getMyFs().listStatus(f);
+ if (listing != null) {
+ for (int i = 0; i < listing.length; i++) {
+ if (!isChecksumFile(listing[i].getPath())) {
+ results.add(listing[i]);
+ }
+ }
+ }
+ return results.toArray(new FileStatus[results.size()]);
+ }
}
diff --git a/src/java/org/apache/hadoop/fs/FileContext.java b/src/java/org/apache/hadoop/fs/FileContext.java
index efc1d8a2d2a7f..01765743f8c05 100644
--- a/src/java/org/apache/hadoop/fs/FileContext.java
+++ b/src/java/org/apache/hadoop/fs/FileContext.java
@@ -2017,8 +2017,8 @@ public boolean copy(final Path src, final Path dst, boolean deleteSource,
mkdir(qDst, FsPermission.getDefault(), true);
FileStatus[] contents = listStatus(qSrc);
for (FileStatus content : contents) {
- copy(content.getPath(), new Path(qDst, content.getPath()),
- deleteSource, overwrite);
+ copy(makeQualified(content.getPath()), makeQualified(new Path(qDst,
+ content.getPath().getName())), deleteSource, overwrite);
}
} else {
InputStream in=null;
@@ -2062,7 +2062,8 @@ private void checkDest(String srcName, Path dst, boolean overwrite)
// Recurse to check if dst/srcName exists.
checkDest(null, new Path(dst, srcName), overwrite);
} else if (!overwrite) {
- throw new IOException("Target " + dst + " already exists");
+ throw new IOException("Target " + new Path(dst, srcName)
+ + " already exists");
}
} catch (FileNotFoundException e) {
// dst does not exist - OK to copy.
@@ -2098,8 +2099,9 @@ private static void checkDependencies(Path qualSrc, Path qualDst)
private static boolean isSameFS(Path qualPath1, Path qualPath2) {
URI srcUri = qualPath1.toUri();
URI dstUri = qualPath2.toUri();
- return (srcUri.getAuthority().equals(dstUri.getAuthority()) && srcUri
- .getAuthority().equals(dstUri.getAuthority()));
+ return (srcUri.getScheme().equals(dstUri.getScheme()) &&
+ !(srcUri.getAuthority() != null && dstUri.getAuthority() != null && srcUri
+ .getAuthority().equals(dstUri.getAuthority())));
}
/**
@@ -2176,7 +2178,7 @@ public T resolve(final FileContext fc, Path p) throws IOException {
// NB: More than one AbstractFileSystem can match a scheme, eg
// "file" resolves to LocalFs but could have come by RawLocalFs.
AbstractFileSystem fs = fc.getFSofPath(p);
-
+
// Loop until all symlinks are resolved or the limit is reached
for (boolean isLink = true; isLink;) {
try {
diff --git a/src/test/core/org/apache/hadoop/fs/FileContextUtilBase.java b/src/test/core/org/apache/hadoop/fs/FileContextUtilBase.java
index 1eac238e0483b..108993385195d 100644
--- a/src/test/core/org/apache/hadoop/fs/FileContextUtilBase.java
+++ b/src/test/core/org/apache/hadoop/fs/FileContextUtilBase.java
@@ -17,15 +17,17 @@
*/
package org.apache.hadoop.fs;
+import static org.apache.hadoop.fs.FileContextTestHelper.getTestRootPath;
+import static org.apache.hadoop.fs.FileContextTestHelper.readFile;
+import static org.apache.hadoop.fs.FileContextTestHelper.writeFile;
+import static org.junit.Assert.assertTrue;
+
import java.util.Arrays;
import org.apache.hadoop.util.StringUtils;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.*;
-
-import static org.apache.hadoop.fs.FileContextTestHelper.*;
/**
* <p>
@@ -80,4 +82,27 @@ public void testFcCopy() throws Exception{
assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(),
readFile(fc,file2,ts.getBytes().length)));
}
-}
\ No newline at end of file
+
+ @Test
+ public void testRecursiveFcCopy() throws Exception {
+
+ final String ts = "some random text";
+ Path dir1 = getTestRootPath(fc, "dir1");
+ Path dir2 = getTestRootPath(fc, "dir2");
+
+ Path file1 = new Path(dir1, "file1");
+ fc.mkdir(dir1, null, false);
+ writeFile(fc, file1, ts.getBytes());
+ assertTrue(fc.util().exists(file1));
+
+ Path file2 = new Path(dir2, "file1");
+
+ fc.util().copy(dir1, dir2);
+
+ // verify that newly copied file2 exists
+ assertTrue("Failed to copy file2 ", fc.util().exists(file2));
+ // verify that file2 contains test string
+ assertTrue("Copied files does not match ",Arrays.equals(ts.getBytes(),
+ readFile(fc,file2,ts.getBytes().length)));
+ }
+}
|
311520d14682a1f3096dc9307da3e5fcb82936ab
|
elasticsearch
|
add peer recovery status to the indices status- API exposing both on going and summary when recovering from a peer shard--
|
a
|
https://github.com/elastic/elasticsearch
|
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java
index 882b74d25b477..be39f8bd43023 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/ShardStatus.java
@@ -112,7 +112,7 @@ public static Stage fromValue(byte value) {
final long startTime;
- final long took;
+ final long time;
final long retryTime;
@@ -124,11 +124,11 @@ public static Stage fromValue(byte value) {
final long recoveredTranslogOperations;
- public PeerRecoveryStatus(Stage stage, long startTime, long took, long retryTime, long indexSize, long reusedIndexSize,
+ public PeerRecoveryStatus(Stage stage, long startTime, long time, long retryTime, long indexSize, long reusedIndexSize,
long recoveredIndexSize, long recoveredTranslogOperations) {
this.stage = stage;
this.startTime = startTime;
- this.took = took;
+ this.time = time;
this.retryTime = retryTime;
this.indexSize = indexSize;
this.reusedIndexSize = reusedIndexSize;
@@ -148,12 +148,12 @@ public long getStartTime() {
return this.startTime;
}
- public TimeValue took() {
- return TimeValue.timeValueMillis(took);
+ public TimeValue time() {
+ return TimeValue.timeValueMillis(time);
}
- public TimeValue getTook() {
- return took();
+ public TimeValue getTime() {
+ return time();
}
public TimeValue retryTime() {
@@ -321,7 +321,7 @@ public static ShardStatus readIndexShardStatus(StreamInput in) throws IOExceptio
out.writeBoolean(true);
out.writeByte(peerRecoveryStatus.stage.value);
out.writeVLong(peerRecoveryStatus.startTime);
- out.writeVLong(peerRecoveryStatus.took);
+ out.writeVLong(peerRecoveryStatus.time);
out.writeVLong(peerRecoveryStatus.retryTime);
out.writeVLong(peerRecoveryStatus.indexSize);
out.writeVLong(peerRecoveryStatus.reusedIndexSize);
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java
index 466e4c9b35651..e5db74b8c135e 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/action/admin/indices/status/TransportIndicesStatusAction.java
@@ -172,7 +172,7 @@ public class TransportIndicesStatusAction extends TransportBroadcastOperationAct
default:
stage = ShardStatus.PeerRecoveryStatus.Stage.INIT;
}
- shardStatus.peerRecoveryStatus = new ShardStatus.PeerRecoveryStatus(stage, peerRecoveryStatus.startTime(), peerRecoveryStatus.took(),
+ shardStatus.peerRecoveryStatus = new ShardStatus.PeerRecoveryStatus(stage, peerRecoveryStatus.startTime(), peerRecoveryStatus.time(),
peerRecoveryStatus.retryTime(), peerRecoveryStatus.phase1TotalSize(), peerRecoveryStatus.phase1ExistingTotalSize(),
peerRecoveryStatus.currentFilesSize(), peerRecoveryStatus.currentTranslogOperations());
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/PeerRecoveryStatus.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/PeerRecoveryStatus.java
index e64b99c4c562e..1a5251badf3c4 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/PeerRecoveryStatus.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/PeerRecoveryStatus.java
@@ -43,7 +43,7 @@ public static enum Stage {
ConcurrentMap<String, IndexOutput> openIndexOutputs = ConcurrentCollections.newConcurrentMap();
final long startTime = System.currentTimeMillis();
- long took;
+ long time;
volatile long retryTime = 0;
List<String> phase1FileNames;
List<Long> phase1FileSizes;
@@ -60,8 +60,8 @@ public long startTime() {
return startTime;
}
- public long took() {
- return this.took;
+ public long time() {
+ return this.time;
}
public long retryTime() {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryTarget.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryTarget.java
index b62574be15e9e..291e9d6ef7161 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryTarget.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoveryTarget.java
@@ -103,7 +103,15 @@ public static class Actions {
}
public PeerRecoveryStatus peerRecoveryStatus(ShardId shardId) {
- return onGoingRecoveries.get(shardId);
+ PeerRecoveryStatus peerRecoveryStatus = onGoingRecoveries.get(shardId);
+ if (peerRecoveryStatus == null) {
+ return null;
+ }
+ // update how long it takes if we are still recovering...
+ if (peerRecoveryStatus.startTime > 0 && peerRecoveryStatus.stage != PeerRecoveryStatus.Stage.DONE) {
+ peerRecoveryStatus.time = System.currentTimeMillis() - peerRecoveryStatus.startTime;
+ }
+ return peerRecoveryStatus;
}
public void startRecovery(final StartRecoveryRequest request, final boolean fromRetry, final RecoveryListener listener) {
@@ -313,7 +321,7 @@ class FinalizeRecoveryRequestHandler extends BaseTransportRequestHandler<Recover
}
peerRecoveryStatus.stage = PeerRecoveryStatus.Stage.FINALIZE;
shard.performRecoveryFinalization(false, peerRecoveryStatus);
- peerRecoveryStatus.took = System.currentTimeMillis() - peerRecoveryStatus.startTime;
+ peerRecoveryStatus.time = System.currentTimeMillis() - peerRecoveryStatus.startTime;
peerRecoveryStatus.stage = PeerRecoveryStatus.Stage.DONE;
channel.sendResponse(VoidStreamable.INSTANCE);
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java
index 7756ff2b4d10b..7808bb50ca544 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/rest/action/admin/indices/status/RestIndicesStatusAction.java
@@ -143,10 +143,8 @@ public class RestIndicesStatusAction extends BaseRestHandler {
builder.startObject("peer_recovery");
builder.field("stage", peerRecoveryStatus.stage());
builder.field("start_time_in_millis", peerRecoveryStatus.startTime());
- if (peerRecoveryStatus.took().millis() > 0) {
- builder.field("took", peerRecoveryStatus.took());
- builder.field("took_in_millis", peerRecoveryStatus.took().millis());
- }
+ builder.field("time", peerRecoveryStatus.time());
+ builder.field("took_in_millis", peerRecoveryStatus.time().millis());
builder.field("retry_time", peerRecoveryStatus.retryTime());
builder.field("retry_time_in_millis", peerRecoveryStatus.retryTime().millis());
|
7db99eb0da29b8106532a863da32a6bb39ae0a3b
|
camel
|
Camel fails if onCompletion has been mis- configured from Java DSL.--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@1040143 13f79535-47bb-0310-9956-ffa450edef68-
|
c
|
https://github.com/apache/camel
|
diff --git a/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java b/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
index cfe9ad0507d62..e1fe00927f504 100644
--- a/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
+++ b/camel-core/src/main/java/org/apache/camel/model/OnCompletionDefinition.java
@@ -141,6 +141,9 @@ public ProcessorDefinition end() {
* @return the builder
*/
public OnCompletionDefinition onCompleteOnly() {
+ if (onFailureOnly) {
+ throw new IllegalArgumentException("Both onCompleteOnly and onFailureOnly cannot be true. Only one of them can be true. On node: " + this);
+ }
// must define return type as OutputDefinition and not this type to avoid end user being able
// to invoke onFailureOnly/onCompleteOnly more than once
setOnCompleteOnly(Boolean.TRUE);
@@ -154,6 +157,9 @@ public OnCompletionDefinition onCompleteOnly() {
* @return the builder
*/
public OnCompletionDefinition onFailureOnly() {
+ if (onCompleteOnly) {
+ throw new IllegalArgumentException("Both onCompleteOnly and onFailureOnly cannot be true. Only one of them can be true. On node: " + this);
+ }
// must define return type as OutputDefinition and not this type to avoid end user being able
// to invoke onFailureOnly/onCompleteOnly more than once
setOnCompleteOnly(Boolean.FALSE);
diff --git a/camel-core/src/test/java/org/apache/camel/processor/OnCompletionInvalidConfiguredTest.java b/camel-core/src/test/java/org/apache/camel/processor/OnCompletionInvalidConfiguredTest.java
new file mode 100644
index 0000000000000..e432f0e9ea1d2
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/processor/OnCompletionInvalidConfiguredTest.java
@@ -0,0 +1,47 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.processor;
+
+import org.apache.camel.ContextTestSupport;
+import org.apache.camel.builder.RouteBuilder;
+
+/**
+ * @version $Revision$
+ */
+public class OnCompletionInvalidConfiguredTest extends ContextTestSupport {
+
+ @Override
+ public boolean isUseRouteBuilder() {
+ return false;
+ }
+
+ public void testInvalidConfigured() throws Exception {
+ try {
+ context.addRoutes(new RouteBuilder() {
+ @Override
+ public void configure() throws Exception {
+ onCompletion().onFailureOnly().onCompleteOnly().to("mock:foo");
+
+ from("direct:start").to("mock:result");
+ }
+ });
+ fail("Should throw exception");
+ } catch (IllegalArgumentException e) {
+ assertEquals("Both onCompleteOnly and onFailureOnly cannot be true. Only one of them can be true. On node: onCompletion[[]]", e.getMessage());
+ }
+ }
+}
|
a1a7deebf8b28e3b09260f9d1f56b4f687fde672
|
hadoop
|
YARN-3587. Fix the javadoc of- DelegationTokenSecretManager in yarn
|
c
|
https://github.com/apache/hadoop
|
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
index 52e6a0158266a..1d7f2f5328545 100644
--- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/AbstractDelegationTokenSecretManager.java
@@ -99,6 +99,17 @@ class AbstractDelegationTokenSecretManager<TokenIdent
*/
protected Object noInterruptsLock = new Object();
+ /**
+ * Create a secret manager
+ * @param delegationKeyUpdateInterval the number of milliseconds for rolling
+ * new secret keys.
+ * @param delegationTokenMaxLifetime the maximum lifetime of the delegation
+ * tokens in milliseconds
+ * @param delegationTokenRenewInterval how often the tokens must be renewed
+ * in milliseconds
+ * @param delegationTokenRemoverScanInterval how often the tokens are scanned
+ * for expired tokens in milliseconds
+ */
public AbstractDelegationTokenSecretManager(long delegationKeyUpdateInterval,
long delegationTokenMaxLifetime, long delegationTokenRenewInterval,
long delegationTokenRemoverScanInterval) {
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java
index 8af7ebaa0bfcf..b7f89a896dae9 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/security/token/delegation/DelegationTokenSecretManager.java
@@ -79,13 +79,14 @@ public DelegationTokenSecretManager(long delegationKeyUpdateInterval,
/**
* Create a secret manager
- * @param delegationKeyUpdateInterval the number of seconds for rolling new
- * secret keys.
+ * @param delegationKeyUpdateInterval the number of milliseconds for rolling
+ * new secret keys.
* @param delegationTokenMaxLifetime the maximum lifetime of the delegation
- * tokens
+ * tokens in milliseconds
* @param delegationTokenRenewInterval how often the tokens must be renewed
+ * in milliseconds
* @param delegationTokenRemoverScanInterval how often the tokens are scanned
- * for expired tokens
+ * for expired tokens in milliseconds
* @param storeTokenTrackingId whether to store the token's tracking id
*/
public DelegationTokenSecretManager(long delegationKeyUpdateInterval,
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/token/delegation/DelegationTokenSecretManager.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/token/delegation/DelegationTokenSecretManager.java
index b42e0c9f8c118..2a109b63b233c 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/token/delegation/DelegationTokenSecretManager.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapreduce/security/token/delegation/DelegationTokenSecretManager.java
@@ -34,13 +34,14 @@ public class DelegationTokenSecretManager
/**
* Create a secret manager
- * @param delegationKeyUpdateInterval the number of seconds for rolling new
- * secret keys.
+ * @param delegationKeyUpdateInterval the number of milliseconds for rolling
+ * new secret keys.
* @param delegationTokenMaxLifetime the maximum lifetime of the delegation
- * tokens
+ * tokens in milliseconds
* @param delegationTokenRenewInterval how often the tokens must be renewed
+ * in milliseconds
* @param delegationTokenRemoverScanInterval how often the tokens are scanned
- * for expired tokens
+ * for expired tokens in milliseconds
*/
public DelegationTokenSecretManager(long delegationKeyUpdateInterval,
long delegationTokenMaxLifetime,
diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JHSDelegationTokenSecretManager.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JHSDelegationTokenSecretManager.java
index 7fac44df8cf17..98d13a46023f2 100644
--- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JHSDelegationTokenSecretManager.java
+++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-hs/src/main/java/org/apache/hadoop/mapreduce/v2/hs/JHSDelegationTokenSecretManager.java
@@ -47,13 +47,14 @@ public class JHSDelegationTokenSecretManager
/**
* Create a secret manager
- * @param delegationKeyUpdateInterval the number of seconds for rolling new
- * secret keys.
+ * @param delegationKeyUpdateInterval the number of milliseconds for rolling
+ * new secret keys.
* @param delegationTokenMaxLifetime the maximum lifetime of the delegation
- * tokens
+ * tokens in milliseconds
* @param delegationTokenRenewInterval how often the tokens must be renewed
+ * in milliseconds
* @param delegationTokenRemoverScanInterval how often the tokens are scanned
- * for expired tokens
+ * for expired tokens in milliseconds
* @param store history server state store for persisting state
*/
public JHSDelegationTokenSecretManager(long delegationKeyUpdateInterval,
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 97de524ec42b2..e9ecc9eb74e18 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -179,6 +179,9 @@ Release 2.8.0 - UNRELEASED
YARN-3395. FairScheduler: Trim whitespaces when using username for
queuename. (Zhihai Xu via kasha)
+ YARN-3587. Fix the javadoc of DelegationTokenSecretManager in yarn, etc.
+ projects. (Gabor Liptak via junping_du)
+
OPTIMIZATIONS
YARN-3339. TestDockerContainerExecutor should pull a single image and not
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineDelegationTokenSecretManagerService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineDelegationTokenSecretManagerService.java
index c940eea703704..60a0348b0451e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineDelegationTokenSecretManagerService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/timeline/security/TimelineDelegationTokenSecretManagerService.java
@@ -125,11 +125,15 @@ public static class TimelineDelegationTokenSecretManager extends
/**
* Create a timeline secret manager
- *
- * @param delegationKeyUpdateInterval the number of seconds for rolling new secret keys.
- * @param delegationTokenMaxLifetime the maximum lifetime of the delegation tokens
+ * @param delegationKeyUpdateInterval the number of milliseconds for rolling
+ * new secret keys.
+ * @param delegationTokenMaxLifetime the maximum lifetime of the delegation
+ * tokens in milliseconds
* @param delegationTokenRenewInterval how often the tokens must be renewed
- * @param delegationTokenRemoverScanInterval how often the tokens are scanned for expired tokens
+ * in milliseconds
+ * @param delegationTokenRemoverScanInterval how often the tokens are
+ * scanned for expired tokens in milliseconds
+ * @param stateStore timeline service state store
*/
public TimelineDelegationTokenSecretManager(
long delegationKeyUpdateInterval,
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java
index 83defc5424707..631ca9d2e5a75 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/security/RMDelegationTokenSecretManager.java
@@ -56,13 +56,15 @@ public class RMDelegationTokenSecretManager extends
/**
* Create a secret manager
- * @param delegationKeyUpdateInterval the number of seconds for rolling new
- * secret keys.
+ * @param delegationKeyUpdateInterval the number of milliseconds for rolling
+ * new secret keys.
* @param delegationTokenMaxLifetime the maximum lifetime of the delegation
- * tokens
+ * tokens in milliseconds
* @param delegationTokenRenewInterval how often the tokens must be renewed
+ * in milliseconds
* @param delegationTokenRemoverScanInterval how often the tokens are scanned
- * for expired tokens
+ * for expired tokens in milliseconds
+ * @param rmContext current context of the ResourceManager
*/
public RMDelegationTokenSecretManager(long delegationKeyUpdateInterval,
long delegationTokenMaxLifetime,
|
29e1e664f1bcaa2af3488096d33d84e328099f3c
|
camel
|
CAMEL-5370: Added direct-vm component to act as- synchronous direct calls between multiple camel contexts in the same JVM (eg- like direct + vm together). Can be used to support transactions spanning- multiple camel contextes / bundles.--git-svn-id: https://svn.apache.org/repos/asf/camel/trunk@1350591 13f79535-47bb-0310-9956-ffa450edef68-
|
a
|
https://github.com/apache/camel
|
diff --git a/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java b/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java
index c7560c84e9250..c05e613ecda80 100644
--- a/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java
+++ b/camel-core/src/main/java/org/apache/camel/component/directvm/DirectVmComponent.java
@@ -35,7 +35,7 @@ public class DirectVmComponent extends DefaultComponent {
// must keep a map of consumers on the component to ensure endpoints can lookup old consumers
// later in case the DirectEndpoint was re-created due the old was evicted from the endpoints LRUCache
// on DefaultCamelContext
- private static final ConcurrentMap<String, DirectVmConsumer> consumers = new ConcurrentHashMap<String, DirectVmConsumer>();
+ private static final ConcurrentMap<String, DirectVmConsumer> CONSUMERS = new ConcurrentHashMap<String, DirectVmConsumer>();
@Override
protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
@@ -46,22 +46,22 @@ protected Endpoint createEndpoint(String uri, String remaining, Map<String, Obje
public DirectVmConsumer getConsumer(DirectVmEndpoint endpoint) {
String key = getConsumerKey(endpoint.getEndpointUri());
- return consumers.get(key);
+ return CONSUMERS.get(key);
}
public void addConsumer(DirectVmEndpoint endpoint, DirectVmConsumer consumer) {
String key = getConsumerKey(endpoint.getEndpointUri());
- DirectVmConsumer existing = consumers.putIfAbsent(key, consumer);
+ DirectVmConsumer existing = CONSUMERS.putIfAbsent(key, consumer);
if (existing != null) {
String contextId = existing.getEndpoint().getCamelContext().getName();
throw new IllegalStateException("A consumer " + existing + " already exists from CamelContext: " + contextId + ". Multiple consumers not supported");
}
- consumers.put(key, consumer);
+ CONSUMERS.put(key, consumer);
}
public void removeConsumer(DirectVmEndpoint endpoint, DirectVmConsumer consumer) {
String key = getConsumerKey(endpoint.getEndpointUri());
- consumers.remove(key);
+ CONSUMERS.remove(key);
}
private static String getConsumerKey(String uri) {
@@ -82,7 +82,7 @@ protected void doStart() throws Exception {
protected void doStop() throws Exception {
if (START_COUNTER.decrementAndGet() <= 0) {
// clear queues when no more direct-vm components in use
- consumers.clear();
+ CONSUMERS.clear();
}
}
diff --git a/camel-core/src/main/java/org/apache/camel/component/directvm/package.html b/camel-core/src/main/java/org/apache/camel/component/directvm/package.html
index ebcecc9feac27..80219af01cf19 100644
--- a/camel-core/src/main/java/org/apache/camel/component/directvm/package.html
+++ b/camel-core/src/main/java/org/apache/camel/component/directvm/package.html
@@ -19,8 +19,8 @@
</head>
<body>
-The <a href="http://camel.apache.org/directvm.html">Direct VM Component</a> which synchronously invokes
-the consumer when a producer sends an exchange to the endpoint. This also known as <i>strait through processing</i>.
+The <a href="http://camel.apache.org/direct-vm.html">Direct VM Component</a> which synchronously invokes
+the consumer when a producer sends an exchange to the endpoint. This also known as <i>strait through processing</i>.
<p/>
This component supports messaging within the current JVM; so across CamelContext instances.
Note that this communication can only take place between ClassLoaders which share the same camel-core.jar.
diff --git a/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmTwoCamelContextTest.java b/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmTwoCamelContextTest.java
index 09f5104e2752c..6865215cc562d 100644
--- a/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmTwoCamelContextTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/directvm/DirectVmTwoCamelContextTest.java
@@ -25,6 +25,8 @@ public class DirectVmTwoCamelContextTest extends AbstractDirectVmTestSupport {
public void testTwoCamelContext() throws Exception {
getMockEndpoint("mock:result").expectedBodiesReceived("Bye World");
+ getMockEndpoint("mock:result").expectedHeaderReceived("name1", context.getName());
+ getMockEndpoint("mock:result").expectedHeaderReceived("name2", context2.getName());
String out = template2.requestBody("direct:start", "Hello World", String.class);
assertEquals("Bye World", out);
@@ -39,6 +41,7 @@ protected RouteBuilder createRouteBuilder() throws Exception {
public void configure() throws Exception {
from("direct-vm:foo")
.transform(constant("Bye World"))
+ .setHeader("name1", simple("${camelId}"))
.log("Running on Camel ${camelId} on thread ${threadName} with message ${body}")
.to("mock:result");
}
@@ -51,6 +54,7 @@ protected RouteBuilder createRouteBuilderForSecondContext() throws Exception {
@Override
public void configure() throws Exception {
from("direct:start")
+ .setHeader("name2", simple("${camelId}"))
.log("Running on Camel ${camelId} on thread ${threadName} with message ${body}")
.to("direct-vm:foo");
}
|
954582943efddc51245c74ebeaeb1b218aa05668
|
restlet-framework-java
|
- Refactored WADL extension based on John- Logsdon feed-back. Add convenience methods and constructors on- MethodInfo and RepresentationInfo. Removed unecessary methods on - WadlResource like getRepresentationInfo(Variant) and - getParametersInfo(RequestInfo|ResponseInfo|Representation- Info).--
|
p
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/build/tmpl/text/changes.txt b/build/tmpl/text/changes.txt
index 2d0bc382b8..e9142e9d0e 100644
--- a/build/tmpl/text/changes.txt
+++ b/build/tmpl/text/changes.txt
@@ -15,7 +15,12 @@ Changes log
- Added the ability to provide Wadl documentation to any
Restlet instances.
- NRE and Extension Enhancements
- -
+ - Refactored WADL extension based on John Logsdon feed-back.
+ Add convenience methods and constructors on MethodInfo and
+ RepresentationInfo. Removed unecessary methods on
+ WadlResource like getRepresentationInfo(Variant) and
+ getParametersInfo(RequestInfo|ResponseInfo|Representation-
+ Info).
- Misc
-
diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java
index 4b720dd46f..5ac681ffc5 100644
--- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java
+++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/MethodInfo.java
@@ -34,6 +34,7 @@
import org.restlet.data.Method;
import org.restlet.data.Reference;
+import org.restlet.resource.Variant;
import org.restlet.util.XmlWriter;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
@@ -97,6 +98,78 @@ public MethodInfo(String documentation) {
super(documentation);
}
+ /**
+ * Adds a new request parameter.
+ *
+ * @param name
+ * The name of the parameter.
+ * @param required
+ * True if thes parameter is required.
+ * @param type
+ * The type of the parameter.
+ * @param style
+ * The style of the parameter.
+ * @param documentation
+ * A single documentation element.
+ * @return The created parameter description.
+ */
+ public ParameterInfo addRequestParameter(String name, boolean required,
+ String type, ParameterStyle style, String documentation) {
+ ParameterInfo result = new ParameterInfo(name, required, type, style,
+ documentation);
+ getRequest().getParameters().add(result);
+ return result;
+ }
+
+ /**
+ * Adds a new request representation based on a given variant.
+ *
+ * @param variant
+ * The variant to describe.
+ * @return The created representation description.
+ */
+ public RepresentationInfo addRequestRepresentation(Variant variant) {
+ RepresentationInfo result = new RepresentationInfo(variant);
+ getRequest().getRepresentations().add(result);
+ return result;
+ }
+
+ /**
+ * Adds a new response parameter.
+ *
+ * @param name
+ * The name of the parameter.
+ * @param required
+ * True if thes parameter is required.
+ * @param type
+ * The type of the parameter.
+ * @param style
+ * The style of the parameter.
+ * @param documentation
+ * A single documentation element.
+ * @return The created parameter description.
+ */
+ public ParameterInfo addResponseParameter(String name, boolean required,
+ String type, ParameterStyle style, String documentation) {
+ ParameterInfo result = new ParameterInfo(name, required, type, style,
+ documentation);
+ getResponse().getParameters().add(result);
+ return result;
+ }
+
+ /**
+ * Adds a new response representation based on a given variant.
+ *
+ * @param variant
+ * The variant to describe.
+ * @return The created representation description.
+ */
+ public RepresentationInfo addResponseRepresentation(Variant variant) {
+ RepresentationInfo result = new RepresentationInfo(variant);
+ getResponse().getRepresentations().add(result);
+ return result;
+ }
+
/**
* Returns the identifier for the method.
*
diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java
index 48ff697de8..d63d13d7d0 100644
--- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java
+++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/RepresentationInfo.java
@@ -37,6 +37,7 @@
import org.restlet.data.MediaType;
import org.restlet.data.Reference;
import org.restlet.data.Status;
+import org.restlet.resource.Variant;
import org.restlet.util.XmlWriter;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
@@ -105,6 +106,16 @@ public RepresentationInfo(String documentation) {
super(documentation);
}
+ /**
+ * Constructor with a variant.
+ *
+ * @param variant
+ * The variant to describe.
+ */
+ public RepresentationInfo(Variant variant) {
+ setMediaType(variant.getMediaType());
+ }
+
/**
* Returns the identifier for that element.
*
diff --git a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java
index 62967f02f8..0e3f526d6a 100644
--- a/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java
+++ b/modules/org.restlet.ext.wadl_1.0/src/org/restlet/ext/wadl/WadlResource.java
@@ -196,16 +196,10 @@ protected void describeDelete(MethodInfo methodInfo) {
* The method description to update.
*/
protected void describeGet(MethodInfo methodInfo) {
- ResponseInfo responseInfo = new ResponseInfo();
-
// Describe each variant
for (final Variant variant : getVariants()) {
- responseInfo.getRepresentations().add(
- getRepresentationInfo(variant));
+ methodInfo.addResponseRepresentation(variant);
}
-
- methodInfo.setResponse(responseInfo);
-
}
/**
@@ -218,6 +212,8 @@ protected void describeGet(MethodInfo methodInfo) {
*/
protected void describeMethod(Method method, MethodInfo methodInfo) {
methodInfo.setName(method);
+ methodInfo.setRequest(new RequestInfo());
+ methodInfo.setResponse(new ResponseInfo());
if (Method.GET.equals(method)) {
describeGet(methodInfo);
@@ -241,15 +237,10 @@ protected void describeMethod(Method method, MethodInfo methodInfo) {
* The method description to update.
*/
protected void describeOptions(MethodInfo methodInfo) {
- ResponseInfo responseInfo = new ResponseInfo();
-
// Describe each variant
for (final Variant variant : getWadlVariants()) {
- responseInfo.getRepresentations().add(
- getRepresentationInfo(variant));
+ methodInfo.addResponseRepresentation(variant);
}
-
- methodInfo.setResponse(responseInfo);
}
/**
@@ -281,46 +272,6 @@ protected List<ParameterInfo> getParametersInfo() {
return result;
}
- /**
- * Returns the description of the parameters of the given representation.
- * Returns null by default.
- *
- * @param representation
- * The parent representation.
- * @return The description of the parameters.
- */
- protected List<ParameterInfo> getParametersInfo(
- RepresentationInfo representation) {
- final List<ParameterInfo> result = null;
- return result;
- }
-
- /**
- * Returns the description of the parameters of the given request. Returns
- * null by default.
- *
- * @param request
- * The parent request.
- * @return The description of the parameters.
- */
- protected List<ParameterInfo> getParametersInfo(RequestInfo request) {
- final List<ParameterInfo> result = null;
- return result;
- }
-
- /**
- * Returns the description of the parameters of the given response. Returns
- * null by default.
- *
- * @param response
- * The parent response.
- * @return The description of the parameters.
- */
- protected List<ParameterInfo> getParametersInfo(ResponseInfo response) {
- final List<ParameterInfo> result = null;
- return result;
- }
-
/**
* Returns the preferred WADL variant according to the client preferences
* specified in the request.
@@ -345,20 +296,6 @@ protected Variant getPreferredWadlVariant() {
return result;
}
- /**
- * Returns a WADL description for a given variant.
- *
- * @param variant
- * The variant to describe.
- * @return The variant description.
- */
- protected RepresentationInfo getRepresentationInfo(Variant variant) {
- final RepresentationInfo result = new RepresentationInfo();
- result.setMediaType(variant.getMediaType());
- result.setParameters(getParametersInfo(result));
- return result;
- }
-
/**
* Returns the resource's relative path.
*
|
d380a628bfac05b158a059306edf68baa2b33abd
|
hbase
|
HBASE-1537 Intra-row scanning; apply limit over- multiple families--git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@951682 13f79535-47bb-0310-9956-ffa450edef68-
|
a
|
https://github.com/apache/hbase
|
diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 2c324cceb37f..f26efbb36c92 100644
--- a/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -2065,7 +2065,7 @@ private boolean nextInternal(int limit) throws IOException {
} else {
byte [] nextRow;
do {
- this.storeHeap.next(results, limit);
+ this.storeHeap.next(results, limit - results.size());
if (limit > 0 && results.size() == limit) {
if (this.filter != null && filter.hasFilterRow()) throw new IncompatibleFilterException(
"Filter with filterRow(List<KeyValue>) incompatible with scan with limit!");
diff --git a/src/main/resources/org/apache/hadoop/hbase/rest/XMLSchema.xsd b/src/main/resources/org/apache/hadoop/hbase/rest/XMLSchema.xsd
new file mode 100644
index 000000000000..fcaf810cd6c9
--- /dev/null
+++ b/src/main/resources/org/apache/hadoop/hbase/rest/XMLSchema.xsd
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<schema targetNamespace="ModelSchema" elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="ModelSchema">
+
+ <element name="Version" type="tns:Version"></element>
+
+ <complexType name="Version">
+ <attribute name="REST" type="string"></attribute>
+ <attribute name="JVM" type="string"></attribute>
+ <attribute name="OS" type="string"></attribute>
+ <attribute name="Server" type="string"></attribute>
+ <attribute name="Jersey" type="string"></attribute>
+ </complexType>
+
+ <element name="TableList" type="tns:TableList"></element>
+
+ <complexType name="TableList">
+ <sequence>
+ <element name="table" type="tns:Table" maxOccurs="unbounded" minOccurs="1"></element>
+ </sequence>
+ </complexType>
+
+ <complexType name="Table">
+ <sequence>
+ <element name="name" type="string"></element>
+ </sequence>
+ </complexType>
+
+ <element name="TableInfo" type="tns:TableInfo"></element>
+
+ <complexType name="TableInfo">
+ <sequence>
+ <element name="region" type="tns:TableRegion" maxOccurs="unbounded" minOccurs="1"></element>
+ </sequence>
+ <attribute name="name" type="string"></attribute>
+ </complexType>
+
+ <complexType name="TableRegion">
+ <attribute name="name" type="string"></attribute>
+ <attribute name="id" type="int"></attribute>
+ <attribute name="startKey" type="base64Binary"></attribute>
+ <attribute name="endKey" type="base64Binary"></attribute>
+ <attribute name="location" type="string"></attribute>
+ </complexType>
+
+ <element name="TableSchema" type="tns:TableSchema"></element>
+
+ <complexType name="TableSchema">
+ <sequence>
+ <element name="column" type="tns:ColumnSchema" maxOccurs="unbounded" minOccurs="1"></element>
+ </sequence>
+ <attribute name="name" type="string"></attribute>
+ <anyAttribute></anyAttribute>
+ </complexType>
+
+ <complexType name="ColumnSchema">
+ <attribute name="name" type="string"></attribute>
+ <anyAttribute></anyAttribute>
+ </complexType>
+
+ <element name="CellSet" type="tns:CellSet"></element>
+
+ <complexType name="CellSet">
+ <sequence>
+ <element name="row" type="tns:Row" maxOccurs="unbounded" minOccurs="1"></element>
+ </sequence>
+ </complexType>
+
+ <element name="Row" type="tns:Row"></element>
+
+ <complexType name="Row">
+ <sequence>
+ <element name="key" type="base64Binary"></element>
+ <element name="cell" type="tns:Cell" maxOccurs="unbounded" minOccurs="1"></element>
+ </sequence>
+ </complexType>
+
+ <element name="Cell" type="tns:Cell"></element>
+
+ <complexType name="Cell">
+ <sequence>
+ <element name="value" maxOccurs="1" minOccurs="1">
+ <simpleType><restriction base="base64Binary">
+ </simpleType>
+ </element>
+ </sequence>
+ <attribute name="column" type="base64Binary" />
+ <attribute name="timestamp" type="int" />
+ </complexType>
+
+ <element name="Scanner" type="tns:Scanner"></element>
+
+ <complexType name="Scanner">
+ <sequence>
+ <element name="column" type="base64Binary" minOccurs="0" maxOccurs="unbounded"></element>
+ </sequence>
+ <sequence>
+ <element name="filter" type="string" minOccurs="0" maxOccurs="1"></element>
+ </sequence>
+ <attribute name="startRow" type="base64Binary"></attribute>
+ <attribute name="endRow" type="base64Binary"></attribute>
+ <attribute name="batch" type="int"></attribute>
+ <attribute name="startTime" type="int"></attribute>
+ <attribute name="endTime" type="int"></attribute>
+ </complexType>
+
+ <element name="StorageClusterVersion" type="tns:StorageClusterVersion" />
+
+ <complexType name="StorageClusterVersion">
+ <attribute name="version" type="string"></attribute>
+ </complexType>
+
+ <element name="StorageClusterStatus"
+ type="tns:StorageClusterStatus">
+ </element>
+
+ <complexType name="StorageClusterStatus">
+ <sequence>
+ <element name="liveNode" type="tns:Node"
+ maxOccurs="unbounded" minOccurs="0">
+ </element>
+ <element name="deadNode" type="string" maxOccurs="unbounded"
+ minOccurs="0">
+ </element>
+ </sequence>
+ <attribute name="regions" type="int"></attribute>
+ <attribute name="requests" type="int"></attribute>
+ <attribute name="averageLoad" type="float"></attribute>
+ </complexType>
+
+ <complexType name="Node">
+ <sequence>
+ <element name="region" type="tns:Region"
+ maxOccurs="unbounded" minOccurs="0">
+ </element>
+ </sequence>
+ <attribute name="name" type="string"></attribute>
+ <attribute name="startCode" type="int"></attribute>
+ <attribute name="requests" type="int"></attribute>
+ <attribute name="heapSizeMB" type="int"></attribute>
+ <attribute name="maxHeapSizeMB" type="int"></attribute>
+ </complexType>
+
+ <complexType name="Region">
+ <attribute name="name" type="base64Binary"></attribute>
+ <attribute name="stores" type="int"></attribute>
+ <attribute name="storefiles" type="int"></attribute>
+ <attribute name="storefileSizeMB" type="int"></attribute>
+ <attribute name="memstoreSizeMB" type="int"></attribute>
+ <attribute name="storefileIndexSizeMB" type="int"></attribute>
+ </complexType>
+
+</schema>
\ No newline at end of file
diff --git a/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java b/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java
index 0d5a17a55ed9..106cbc121cf2 100644
--- a/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java
+++ b/src/test/java/org/apache/hadoop/hbase/regionserver/TestWideScanner.java
@@ -23,6 +23,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Random;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -41,25 +42,39 @@
public class TestWideScanner extends HBaseTestCase {
private final Log LOG = LogFactory.getLog(this.getClass());
- static final int BATCH = 1000;
-
- private MiniDFSCluster cluster = null;
- private HRegion r;
-
+ static final byte[] A = Bytes.toBytes("A");
+ static final byte[] B = Bytes.toBytes("B");
+ static final byte[] C = Bytes.toBytes("C");
+ static byte[][] COLUMNS = { A, B, C };
+ static final Random rng = new Random();
static final HTableDescriptor TESTTABLEDESC =
new HTableDescriptor("testwidescan");
static {
- TESTTABLEDESC.addFamily(new HColumnDescriptor(HConstants.CATALOG_FAMILY,
+ TESTTABLEDESC.addFamily(new HColumnDescriptor(A,
+ 10, // Ten is arbitrary number. Keep versions to help debuggging.
+ Compression.Algorithm.NONE.getName(), false, true, 8 * 1024,
+ HConstants.FOREVER, StoreFile.BloomType.NONE.toString(),
+ HColumnDescriptor.DEFAULT_REPLICATION_SCOPE));
+ TESTTABLEDESC.addFamily(new HColumnDescriptor(B,
+ 10, // Ten is arbitrary number. Keep versions to help debuggging.
+ Compression.Algorithm.NONE.getName(), false, true, 8 * 1024,
+ HConstants.FOREVER, StoreFile.BloomType.NONE.toString(),
+ HColumnDescriptor.DEFAULT_REPLICATION_SCOPE));
+ TESTTABLEDESC.addFamily(new HColumnDescriptor(C,
10, // Ten is arbitrary number. Keep versions to help debuggging.
Compression.Algorithm.NONE.getName(), false, true, 8 * 1024,
HConstants.FOREVER, StoreFile.BloomType.NONE.toString(),
HColumnDescriptor.DEFAULT_REPLICATION_SCOPE));
}
+
/** HRegionInfo for root region */
public static final HRegionInfo REGION_INFO =
new HRegionInfo(TESTTABLEDESC, HConstants.EMPTY_BYTE_ARRAY,
HConstants.EMPTY_BYTE_ARRAY);
+ MiniDFSCluster cluster = null;
+ HRegion r;
+
@Override
public void setUp() throws Exception {
cluster = new MiniDFSCluster(conf, 2, true, (String[])null);
@@ -69,30 +84,15 @@ public void setUp() throws Exception {
super.setUp();
}
- private int addWideContent(HRegion region, byte[] family)
- throws IOException {
+ private int addWideContent(HRegion region) throws IOException {
int count = 0;
- // add a few rows of 2500 columns (we'll use batch of 1000) to make things
- // interesting
for (char c = 'a'; c <= 'c'; c++) {
byte[] row = Bytes.toBytes("ab" + c);
int i;
for (i = 0; i < 2500; i++) {
byte[] b = Bytes.toBytes(String.format("%10d", i));
Put put = new Put(row);
- put.add(family, b, b);
- region.put(put);
- count++;
- }
- }
- // add one row of 100,000 columns
- {
- byte[] row = Bytes.toBytes("abf");
- int i;
- for (i = 0; i < 100000; i++) {
- byte[] b = Bytes.toBytes(String.format("%10d", i));
- Put put = new Put(row);
- put.add(family, b, b);
+ put.add(COLUMNS[rng.nextInt(COLUMNS.length)], b, b);
region.put(put);
count++;
}
@@ -103,11 +103,13 @@ private int addWideContent(HRegion region, byte[] family)
public void testWideScanBatching() throws IOException {
try {
this.r = createNewHRegion(REGION_INFO.getTableDesc(), null, null);
- int inserted = addWideContent(this.r, HConstants.CATALOG_FAMILY);
+ int inserted = addWideContent(this.r);
List<KeyValue> results = new ArrayList<KeyValue>();
Scan scan = new Scan();
- scan.addFamily(HConstants.CATALOG_FAMILY);
- scan.setBatch(BATCH);
+ scan.addFamily(A);
+ scan.addFamily(B);
+ scan.addFamily(C);
+ scan.setBatch(1000);
InternalScanner s = r.getScanner(scan);
int total = 0;
int i = 0;
@@ -117,8 +119,8 @@ public void testWideScanBatching() throws IOException {
i++;
LOG.info("iteration #" + i + ", results.size=" + results.size());
- // assert that the result set is no larger than BATCH
- assertTrue(results.size() <= BATCH);
+ // assert that the result set is no larger than 1000
+ assertTrue(results.size() <= 1000);
total += results.size();
|
4dfff5ee0cad5fb7ca757ef4e1822a8a5fb7848c
|
duracloud$duracloud
|
Adds searching for text in any field of ContentIndexItem. Adds to unit test for this new functionality.
|
p
|
https://github.com/duracloud/duracloud
|
diff --git a/content-index-client/src/main/java/org/duracloud/client/contentindex/ContentIndexClient.java b/content-index-client/src/main/java/org/duracloud/client/contentindex/ContentIndexClient.java
index f36de615c..d67183aa0 100644
--- a/content-index-client/src/main/java/org/duracloud/client/contentindex/ContentIndexClient.java
+++ b/content-index-client/src/main/java/org/duracloud/client/contentindex/ContentIndexClient.java
@@ -32,6 +32,17 @@ public ContentIndexItem get(String account,
String space,
String contentId);
+ /**
+ * Search all field values for the provided 'text'
+ * @param text The text to find in any field's value
+ * @param account The account to search, may be null to search across accounts
+ * @param storeId The storeId to search, only used if account supplied. May be null.
+ * @param space The space to search, may be null to search all spaces.
+ * @return
+ */
+ public List<ContentIndexItem> get(String text, String account,
+ Integer storeId, String space);
+
/**
* Saves or updates a ContentIndexItem
* @param item
diff --git a/content-index-client/src/main/java/org/duracloud/client/contentindex/ContentIndexItem.java b/content-index-client/src/main/java/org/duracloud/client/contentindex/ContentIndexItem.java
index 4d21db30f..600516aa4 100644
--- a/content-index-client/src/main/java/org/duracloud/client/contentindex/ContentIndexItem.java
+++ b/content-index-client/src/main/java/org/duracloud/client/contentindex/ContentIndexItem.java
@@ -13,6 +13,8 @@
import org.springframework.data.elasticsearch.annotations.FieldIndex;
import org.springframework.data.elasticsearch.annotations.FieldType;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -122,6 +124,14 @@ public void setProps(Map<String, String> props) {
this.props = props;
}
+ public ContentIndexItem addProp(String key, String value) {
+ if(props == null) {
+ props = new HashMap<String, String>();
+ }
+ props.put(key, value);
+ return this;
+ }
+
public List<String> getTags() {
return tags;
}
@@ -129,4 +139,12 @@ public List<String> getTags() {
public void setTags(List<String> tags) {
this.tags = tags;
}
+
+ public ContentIndexItem addTag(String tag) {
+ if(tags == null) {
+ tags = new ArrayList<String>();
+ }
+ tags.add(tag);
+ return this;
+ }
}
diff --git a/content-index-client/src/main/java/org/duracloud/client/contentindex/ESContentIndexClient.java b/content-index-client/src/main/java/org/duracloud/client/contentindex/ESContentIndexClient.java
index 15865b681..db5d26951 100644
--- a/content-index-client/src/main/java/org/duracloud/client/contentindex/ESContentIndexClient.java
+++ b/content-index-client/src/main/java/org/duracloud/client/contentindex/ESContentIndexClient.java
@@ -9,15 +9,13 @@
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.metadata.AliasAction;
-import org.elasticsearch.index.query.FilterBuilder;
import org.elasticsearch.index.query.FilterBuilders;
import org.elasticsearch.index.query.QueryBuilder;
+import org.elasticsearch.index.query.TermFilterBuilder;
import org.elasticsearch.search.sort.FieldSortBuilder;
-import org.elasticsearch.search.sort.SortBuilders;
import org.elasticsearch.search.sort.SortOrder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.core.ElasticsearchOperations;
import org.springframework.data.elasticsearch.core.query.GetQuery;
import org.springframework.data.elasticsearch.core.query.IndexQuery;
@@ -28,8 +26,9 @@
import java.util.List;
import static org.duracloud.client.contentindex.ContentIndexItem.ID_SEPARATOR;
-
-import static org.elasticsearch.index.query.QueryBuilders.*;
+import static org.elasticsearch.index.query.QueryBuilders.boolQuery;
+import static org.elasticsearch.index.query.QueryBuilders.simpleQueryString;
+import static org.elasticsearch.index.query.QueryBuilders.termQuery;
/**
* @author Erik Paulsson
* Date: 3/11/14
@@ -104,6 +103,52 @@ protected SearchQuery getQueryForSpace(String account,
return searchQuery;
}
+ /**
+ * Search all field values for the provided 'text'
+ * @param text
+ * @param account
+ * @param storeId
+ * @param space
+ * @return
+ */
+ @Override
+ public List<ContentIndexItem> get(String text, String account,
+ Integer storeId, String space) {
+ //FilterBuilders.
+ TermFilterBuilder storeIdFilter = null;
+ TermFilterBuilder spaceFilter = null;
+
+ NativeSearchQueryBuilder nsqBuilder = new NativeSearchQueryBuilder()
+ .withQuery(simpleQueryString(text))
+ .withTypes(TYPE);
+ if(account != null) {
+ nsqBuilder.withIndices(account);
+ if(storeId != null) {
+ storeIdFilter = FilterBuilders.termFilter("storeId", storeId);
+ }
+ }
+
+ if(space != null) {
+ spaceFilter = FilterBuilders.termFilter("space", space);
+ }
+
+ if(storeIdFilter != null && spaceFilter != null) {
+ nsqBuilder.withFilter(
+ FilterBuilders.andFilter(storeIdFilter, spaceFilter));
+
+ } else {
+ if(storeIdFilter != null) {
+ nsqBuilder.withFilter(storeIdFilter);
+ } else if(spaceFilter != null) {
+ nsqBuilder.withFilter(spaceFilter);
+ }
+ }
+
+ List<ContentIndexItem> items = elasticSearchOps.queryForList(
+ nsqBuilder.build(), ContentIndexItem.class);
+ return items;
+ }
+
@Override
public ContentIndexItem get(String account, int storeId,
String space,
diff --git a/content-index-client/src/test/java/org/duracloud/client/contentindex/ESContentIndexClientTest.java b/content-index-client/src/test/java/org/duracloud/client/contentindex/ESContentIndexClientTest.java
index 783b0d4f6..740b7a0e0 100644
--- a/content-index-client/src/test/java/org/duracloud/client/contentindex/ESContentIndexClientTest.java
+++ b/content-index-client/src/test/java/org/duracloud/client/contentindex/ESContentIndexClientTest.java
@@ -46,6 +46,8 @@ public class ESContentIndexClientTest {
protected String account2 = "account2";
protected int storeId = 1;
protected String space = "space1";
+ protected String key1 = "key1", key2 = "key2",
+ value1 = "value1", value2 = "value2";
private static Node node;
protected static String datadir;
@@ -114,31 +116,34 @@ public void setUp() {
@Test
public void testSaveContentIndexItem() {
- ContentIndexItem item1 = createContentIndexItem(account1, 5);
- String item1Id = item1.getId();
- String checksum1 = item1.getProps().get("checksum");
+ ContentIndexItem item5 = createContentIndexItem(account1, 5);
+ item5.addTag(value1);
+ String item5Id = item5.getId();
+ String checksum1 = item5.getProps().get("checksum");
- String returnedId = contentIndexClient.save(item1);
+ String returnedId = contentIndexClient.save(item5);
assertNotNull(returnedId);
- assertEquals(item1Id, returnedId);
+ assertEquals(item5Id, returnedId);
ContentIndexItem retrieved = contentIndexClient.get(
- account1, storeId, space, item1.getContentId());
- assertFalse(retrieved == item1); // assert not the same object in memory
+ account1, storeId, space, item5.getContentId());
+ assertFalse(retrieved == item5); // assert not the same object in memory
assertNotNull(retrieved);
assertEquals(checksum1, retrieved.getProps().get("checksum"));
List<ContentIndexItem> items = new ArrayList();
items.add(createContentIndexItem(account1, 4));
- items.add(createContentIndexItem(account1, 3));
+ items.add(createContentIndexItem(account1, 3).addProp(key1, value1));
items.add(createContentIndexItem(account1, 2));
items.add(createContentIndexItem(account1, 1));
contentIndexClient.bulkSave(items);
items = new ArrayList();
- items.add(createContentIndexItem(account2, 3));
- items.add(createContentIndexItem(account2, 2));
- items.add(createContentIndexItem(account2, 1));
+ items.add(createContentIndexItem(account2, 3)
+ .addProp(key1, value1).addProp(key2, value2));
+ items.add(createContentIndexItem(account2, 2)
+ .addProp(key1, value1).addTag(value2));
+ items.add(createContentIndexItem(account2, 1).addTag(value1));
contentIndexClient.bulkSave(items);
long count1 = contentIndexClient.getSpaceCount(account1, storeId, space);
@@ -190,6 +195,22 @@ public void testSaveContentIndexItem() {
idIndex++;
}
+ // both accounts
+ items = contentIndexClient.get(value1, null, null, null);
+ assertEquals(5, items.size());
+ items = contentIndexClient.get(value2, null, null, null);
+ assertEquals(2, items.size());
+
+ // account1
+ items = contentIndexClient.get(value1, account1, null, null);
+ assertEquals(2, items.size());
+ items = contentIndexClient.get(value2, account1, null, null);
+ assertEquals(0, items.size());
+
+ // account2
+ items = contentIndexClient.get(value1, account2, null, null);
+ assertEquals(3, items.size());
+
}
protected void assertItemFieldsNotNull(ContentIndexItem item) {
|
4ef78b5acd5df2a2d96930392fcc729858354a61
|
aeshell$aesh
|
added in-memory history functionality
|
p
|
https://github.com/aeshell/aesh
|
diff --git a/src/main/java/org/jboss/jreadline/console/Buffer.java b/src/main/java/org/jboss/jreadline/console/Buffer.java
index 859a0580d..0e570de6f 100644
--- a/src/main/java/org/jboss/jreadline/console/Buffer.java
+++ b/src/main/java/org/jboss/jreadline/console/Buffer.java
@@ -53,6 +53,10 @@ protected int length() {
return line.length();
}
+ protected int totalLength() {
+ return line.length() + prompt.length();
+ }
+
protected int getCursor() {
return cursor;
}
@@ -160,6 +164,10 @@ public StringBuilder getLine() {
return line;
}
+ protected void setLine(StringBuilder line) {
+ this.line = line;
+ }
+
public void write(char c) {
line.insert(cursor++, c);
}
diff --git a/src/main/java/org/jboss/jreadline/console/Console.java b/src/main/java/org/jboss/jreadline/console/Console.java
index e0dd856ab..cffe166a6 100644
--- a/src/main/java/org/jboss/jreadline/console/Console.java
+++ b/src/main/java/org/jboss/jreadline/console/Console.java
@@ -19,8 +19,9 @@
import org.jboss.jreadline.edit.EditMode;
import org.jboss.jreadline.edit.EmacsEditMode;
import org.jboss.jreadline.edit.PasteManager;
-import org.jboss.jreadline.edit.ViEditMode;
import org.jboss.jreadline.edit.actions.*;
+import org.jboss.jreadline.history.History;
+import org.jboss.jreadline.history.InMemoryHistory;
import org.jboss.jreadline.terminal.POSIXTerminal;
import org.jboss.jreadline.terminal.Terminal;
import org.jboss.jreadline.undo.UndoAction;
@@ -41,6 +42,9 @@ public class Console {
private UndoManager undoManager;
private PasteManager pasteManager;
private EditMode editMode;
+ private History history;
+
+ private Action prevAction = Action.EDIT;
private static final String CR = System.getProperty("line.separator");
@@ -55,27 +59,32 @@ public Console(InputStream in, Writer out) {
}
public Console(InputStream in, Writer out, Terminal terminal) {
+ this(in, out, terminal, null);
+ }
+
+ public Console(InputStream in, Writer out, Terminal terminal, EditMode mode) {
if(terminal == null)
- setTerminal(initTerminal());
+ setTerminal(new POSIXTerminal());
+ else
+ setTerminal(terminal);
+
+ if(mode == null)
+ editMode = new EmacsEditMode();
+ else
+ editMode = mode;
- editMode = new ViEditMode();
undoManager = new UndoManager();
pasteManager = new PasteManager();
buffer = new Buffer(null);
+ history = new InMemoryHistory();
setInStream(in);
setOutWriter(out);
-
- }
-
- private Terminal initTerminal() {
- Terminal t = new POSIXTerminal();
- t.init();
- return t;
}
- private void setTerminal(Terminal terminal) {
- this.terminal = terminal;
+ private void setTerminal(Terminal term) {
+ terminal = term;
+ terminal.init();
}
private void setInStream(InputStream is) {
@@ -107,6 +116,7 @@ public String read(String prompt) throws IOException {
Operation operation = editMode.parseInput(c);
Action action = operation.getAction();
+ //System.out.println("new action:"+action);
if (action == Action.EDIT) {
/*
@@ -215,14 +225,16 @@ else if(action == Action.EXIT) {
//deleteCurrentCharacter();
}
else if(action == Action.HISTORY) {
- //if(operation.getMovement() == Movement.NEXT)
- //moveHistory(true);
- //else if(operation.getMovement() == Movement.PREV)
- //moveHistory(false);
+ if(operation.getMovement() == Movement.NEXT)
+ getHistory(true);
+ else if(operation.getMovement() == Movement.PREV)
+ getHistory(false);
}
else if(action == Action.NEWLINE) {
// clear the undo stack for each new line
clearUndoStack();
+ addToHistory(buffer.getLine());
+ prevAction = Action.NEWLINE;
//moveToEnd();
printNewline(); // output newline
return buffer.getLine().toString();
@@ -244,12 +256,46 @@ else if(action == Action.NO_ACTION) {
//atm do nothing
}
+ if(action == Action.HISTORY)
+ prevAction = action;
+
flushOut();
}
}
- private void writeChar(int c) throws IOException {
+ private void getHistory(boolean first) throws IOException {
+ // first add current line to history
+ if(prevAction == Action.NEWLINE) {
+ history.setCurrent(buffer.getLine());
+ }
+ //get next
+ if(first) {
+ StringBuilder next = history.getNextFetch();
+ if(next != null) {
+ buffer.setLine(next);
+ moveCursor(buffer.length()-buffer.getCursor());
+ redrawLine();
+ }
+ }
+ // get previous
+ else {
+ StringBuilder prev = history.getPreviousFetch();
+ if(prev != null) {
+ buffer.setLine(prev);
+ //buffer.setCursor(buffer.length());
+ moveCursor(buffer.length()-buffer.getCursor());
+ redrawLine();
+ }
+ }
+ prevAction = Action.HISTORY;
+ }
+
+ private void addToHistory(StringBuilder line) {
+ history.push(new StringBuilder(line));
+ }
+
+ private void writeChar(int c) throws IOException {
buffer.write((char) c);
outStream.write(c);
@@ -415,7 +461,7 @@ private boolean undo() throws IOException {
buffer.write(ua.getBuffer());
redrawLine();
//move the cursor to the saved position
- outStream.write(Buffer.printAnsi((ua.getCursorPosition()+buffer.getPrompt().length()+1)+"G"));
+ outStream.write(Buffer.printAnsi((ua.getCursorPosition() + buffer.getPrompt().length() + 1) + "G"));
flushOut();
//sync terminal cursor with jreadline
buffer.setCursor(ua.getCursorPosition());
diff --git a/src/main/java/org/jboss/jreadline/history/History.java b/src/main/java/org/jboss/jreadline/history/History.java
index 1fa2e9365..5821794f5 100644
--- a/src/main/java/org/jboss/jreadline/history/History.java
+++ b/src/main/java/org/jboss/jreadline/history/History.java
@@ -1,7 +1,41 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package org.jboss.jreadline.history;
/**
+ *
* @author <a href="mailto:[email protected]">Ståle W. Pedersen</a>
*/
public interface History {
+
+ void push(StringBuilder entry);
+
+ StringBuilder find(StringBuilder search);
+
+ StringBuilder get(int index);
+
+ int size();
+
+ StringBuilder getNextFetch();
+
+ StringBuilder getPreviousFetch();
+
+ void setCurrent(StringBuilder line);
+
+ StringBuilder getCurrent();
+
}
diff --git a/src/main/java/org/jboss/jreadline/history/InMemoryHistory.java b/src/main/java/org/jboss/jreadline/history/InMemoryHistory.java
index 7a1de6f57..a621b1edd 100644
--- a/src/main/java/org/jboss/jreadline/history/InMemoryHistory.java
+++ b/src/main/java/org/jboss/jreadline/history/InMemoryHistory.java
@@ -1,7 +1,95 @@
+/*
+* JBoss, Home of Professional Open Source
+* Copyright 2010, Red Hat Middleware LLC, and individual contributors
+* by the @authors tag. See the copyright.txt in the distribution for a
+* full listing of individual contributors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+* http://www.apache.org/licenses/LICENSE-2.0
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
package org.jboss.jreadline.history;
+import java.util.LinkedList;
+import java.util.List;
+
/**
+ * A simple in-memory history implementation
+ *
* @author <a href="mailto:[email protected]">Ståle W. Pedersen</a>
*/
-public class InMemoryHistory {
+public class InMemoryHistory implements History {
+
+ private List<StringBuilder> historyList = new LinkedList<StringBuilder>();
+ private int lastFetchedId = -1;
+ private StringBuilder current;
+
+ @Override
+ public void push(StringBuilder entry) {
+ historyList.add(0, entry);
+ lastFetchedId = -1;
+ }
+
+ @Override
+ public StringBuilder find(StringBuilder search) {
+ int index = historyList.indexOf(search);
+ if(index >= 0) {
+ return get(index);
+ }
+ else
+ return null;
+
+ }
+
+ @Override
+ public StringBuilder get(int index) {
+ lastFetchedId = index;
+ return new StringBuilder(historyList.get(index));
+ }
+
+ @Override
+ public int size() {
+ return historyList.size();
+ }
+
+ @Override
+ public StringBuilder getPreviousFetch() {
+ if(size() < 1)
+ return null;
+
+ if(lastFetchedId < size()-1)
+ return get(++lastFetchedId);
+ else {
+ return get(lastFetchedId);
+ }
+ }
+
+ @Override
+ public void setCurrent(StringBuilder line) {
+ this.current = line;
+ }
+
+ @Override
+ public StringBuilder getCurrent() {
+ return current;
+ }
+
+ @Override
+ public StringBuilder getNextFetch() {
+ if(size() < 1)
+ return null;
+
+ if(lastFetchedId > 0)
+ return get(--lastFetchedId);
+ else {
+ return getCurrent();
+ }
+ }
+
}
diff --git a/src/main/java/org/jboss/jreadline/terminal/POSIXTerminal.java b/src/main/java/org/jboss/jreadline/terminal/POSIXTerminal.java
index 437283e50..9d2888044 100644
--- a/src/main/java/org/jboss/jreadline/terminal/POSIXTerminal.java
+++ b/src/main/java/org/jboss/jreadline/terminal/POSIXTerminal.java
@@ -84,7 +84,7 @@ public void init() {
catch (IOException ioe) {
System.err.println("TTY failed with: " + ioe.getMessage());
} catch (InterruptedException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ e.printStackTrace();
}
// at exit, restore the original tty configuration (for JDK 1.3+)
@@ -93,6 +93,7 @@ public void start() {
try {
restoreTerminal();
} catch (Exception e) {
+ e.printStackTrace();
//ignored
}
}
|
90f3fc20181932474f371d143cf7b91755df53c4
|
Vala
|
posix: add gettimeofday() and settimeofday() bindings.
Fixes bug 592189.
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/vapi/posix.vapi b/vapi/posix.vapi
index 3a8dd317fe..80b102767f 100644
--- a/vapi/posix.vapi
+++ b/vapi/posix.vapi
@@ -1854,10 +1854,14 @@ namespace Posix {
public struct fd_set {
}
- [CCode (cname = "struct timeval", cheader_filename = "sys/select.h")]
+ [CCode (cname = "struct timeval", cheader_filename = "sys/time.h")]
public struct timeval {
public time_t tv_sec;
public long tv_usec;
+ [CCode (cname = "gettimeofday")]
+ public int get_time_of_day (void * timezone = null);
+ [CCode (cname = "settimeofday")]
+ public int set_time_of_day (void * timezone = null);
}
[CCode (cname = "sigset_t", cheader_filename = "sys/select.h")]
|
e83ec1017bf61d352ef8e872984a79002c2020b0
|
kotlin
|
Reflection support--
|
a
|
https://github.com/JetBrains/kotlin
|
diff --git a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java
index 2599c11fa137b..4b5dc88d1c932 100644
--- a/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java
+++ b/compiler/backend-common/src/org/jetbrains/kotlin/backend/common/CodegenUtil.java
@@ -19,6 +19,7 @@
import com.intellij.openapi.editor.Document;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
+import kotlin.KotlinPackage;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.kotlin.backend.common.bridges.BridgesPackage;
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassFileFactory.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassFileFactory.java
index 181981b3462aa..ab8c235196e05 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassFileFactory.java
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClassFileFactory.java
@@ -38,6 +38,8 @@
import java.io.UnsupportedEncodingException;
import java.util.*;
+import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.getMappingFileName;
+
public class ClassFileFactory implements OutputFileCollection {
private final GenerationState state;
private final ClassBuilderFactory builderFactory;
@@ -86,7 +88,7 @@ void done() {
private void writeModuleMappings(Collection<PackageCodegen> values) {
String moduleName = KotlinPackage.removeSurrounding(state.getModule().getName().asString(), "<", ">");
- String outputFilePath = "META-INF/" + moduleName + ".kotlin_module";
+ String outputFilePath = getMappingFileName(moduleName);
final StringWriter moduleMapping = new StringWriter(1024);
for (PackageCodegen codegen : values) {
codegen.getFacades().serialize(moduleMapping);
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/GeneratedClassLoader.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/GeneratedClassLoader.java
index 14282bd82ba77..3b346ef7f1336 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/GeneratedClassLoader.java
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/GeneratedClassLoader.java
@@ -19,6 +19,8 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.kotlin.backend.common.output.OutputFile;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.List;
@@ -32,6 +34,15 @@ public GeneratedClassLoader(@NotNull ClassFileFactory factory, ClassLoader paren
this.factory = factory;
}
+ @Override
+ public InputStream getResourceAsStream(String name) {
+ OutputFile outputFile = factory.get(name);
+ if (outputFile != null) {
+ return new ByteArrayInputStream(outputFile.asByteArray());
+ }
+ return super.getResourceAsStream(name);
+ }
+
@NotNull
@Override
protected Class<?> findClass(@NotNull String name) throws ClassNotFoundException {
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java
index 2a2e0a5a521a0..7297aa1c4753c 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/JvmCodegenUtil.java
@@ -245,4 +245,13 @@ public static boolean shouldUseJavaClassForClassLiteral(@NotNull ClassifierDescr
module == module.getBuiltIns().getBuiltInsModule() ||
DescriptorUtils.isAnnotationClass(descriptor);
}
+
+ public static String getModuleName(ModuleDescriptor module) {
+ return KotlinPackage.removeSurrounding(module.getName().asString(), "<", ">");
+ }
+
+ @NotNull
+ public static String getMappingFileName(@NotNull String moduleName) {
+ return "META-INF/" + moduleName + ".kotlin_module";
+ }
}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java
index 8d04c8bd80f97..80cadd4c5437e 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java
@@ -467,6 +467,9 @@ public static void generateReflectionObjectField(
if (state.getClassBuilderMode() == ClassBuilderMode.LIGHT_CLASSES) return;
v.aconst(thisAsmType);
+ if (factory.getArgumentTypes().length == 2) {
+ v.aconst(JvmCodegenUtil.getModuleName(state.getModule()));
+ }
v.invokestatic(REFLECTION, factory.getName(), factory.getDescriptor(), false);
v.putstatic(thisAsmType.getInternalName(), fieldName, type);
}
diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/PackageCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/PackageCodegen.java
index 4f4998b699ff6..1ca57d90a746b 100644
--- a/compiler/backend/src/org/jetbrains/kotlin/codegen/PackageCodegen.java
+++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/PackageCodegen.java
@@ -260,7 +260,7 @@ private void generatePackageFacadeClass(
private void generateKotlinPackageReflectionField() {
MethodVisitor mv = v.newMethod(NO_ORIGIN, ACC_STATIC, "<clinit>", "()V", null, null);
- Method method = method("createKotlinPackage", K_PACKAGE_TYPE, getType(Class.class));
+ Method method = method("createKotlinPackage", K_PACKAGE_TYPE, getType(Class.class), getType(String.class));
InstructionAdapter iv = new InstructionAdapter(mv);
MemberCodegen.generateReflectionObjectField(state, packageClassType, v, method, JvmAbi.KOTLIN_PACKAGE_FIELD_NAME, iv);
iv.areturn(Type.VOID_TYPE);
diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt
index 1672b1fbb92a8..a0f50d4390ce6 100644
--- a/compiler/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt
+++ b/compiler/tests/org/jetbrains/kotlin/jvm/runtime/AbstractJvmRuntimeDescriptorLoaderTest.kt
@@ -82,7 +82,7 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
val classLoader = URLClassLoader(arrayOf(tmpdir.toURI().toURL()), ForTestCompileRuntime.runtimeAndReflectJarClassLoader())
- val actual = createReflectedPackageView(classLoader)
+ val actual = createReflectedPackageView(classLoader, "")
val expected = LoadDescriptorUtil.loadTestPackageAndBindingContextFromJavaRoot(
tmpdir, getTestRootDisposable(), jdkKind, ConfigurationKind.ALL, true
@@ -129,8 +129,8 @@ public abstract class AbstractJvmRuntimeDescriptorLoaderTest : TestCaseWithTmpdi
}
}
- private fun createReflectedPackageView(classLoader: URLClassLoader): SyntheticPackageViewForTest {
- val module = RuntimeModuleData.create(classLoader).module
+ private fun createReflectedPackageView(classLoader: URLClassLoader, moduleName: String): SyntheticPackageViewForTest {
+ val module = RuntimeModuleData.create(classLoader, moduleName).module
val generatedPackageDir = File(tmpdir, LoadDescriptorUtil.TEST_PACKAGE_FQNAME.pathSegments().single().asString())
diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/kotlin/reflect/RuntimeModuleData.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/kotlin/reflect/RuntimeModuleData.kt
index d38a8485da684..6f68484c5a14a 100644
--- a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/kotlin/reflect/RuntimeModuleData.kt
+++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/kotlin/reflect/RuntimeModuleData.kt
@@ -44,7 +44,7 @@ public class RuntimeModuleData private constructor(public val deserialization: D
public val localClassResolver: LocalClassResolver get() = deserialization.localClassResolver
companion object {
- public fun create(classLoader: ClassLoader): RuntimeModuleData {
+ public fun create(classLoader: ClassLoader, moduleName: String?): RuntimeModuleData {
val storageManager = LockBasedStorageManager()
val module = ModuleDescriptorImpl(Name.special("<runtime module for $classLoader>"), storageManager,
ModuleParameters(listOf(), JavaToKotlinClassMap.INSTANCE))
@@ -57,8 +57,10 @@ public class RuntimeModuleData private constructor(public val deserialization: D
ExternalAnnotationResolver.EMPTY, ExternalSignatureResolver.DO_NOTHING, RuntimeErrorReporter, JavaResolverCache.EMPTY,
JavaPropertyInitializerEvaluator.DoNothing, SamConversionResolver, RuntimeSourceElementFactory, singleModuleClassResolver
)
+ println("moduleName $moduleName")
val lazyJavaPackageFragmentProvider =
- LazyJavaPackageFragmentProvider(globalJavaResolverContext, module, ReflectionTypes(module), PackageMappingProvider.EMPTY)
+ LazyJavaPackageFragmentProvider(globalJavaResolverContext, module, ReflectionTypes(module),
+ if (moduleName == null) PackageMappingProvider.EMPTY else RuntimePackageMappingProvider(moduleName, classLoader))
val javaDescriptorResolver = JavaDescriptorResolver(lazyJavaPackageFragmentProvider, module)
val javaClassDataFinder = JavaClassDataFinder(reflectKotlinClassFinder, deserializedDescriptorResolver)
val binaryClassAnnotationAndConstantLoader = BinaryClassAnnotationAndConstantLoaderImpl(module, storageManager, reflectKotlinClassFinder, RuntimeErrorReporter)
diff --git a/core/descriptors.runtime/src/org/jetbrains/kotlin/load/kotlin/reflect/RuntimePackageMappingProvider.kt b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/kotlin/reflect/RuntimePackageMappingProvider.kt
new file mode 100644
index 0000000000000..867163bca17ef
--- /dev/null
+++ b/core/descriptors.runtime/src/org/jetbrains/kotlin/load/kotlin/reflect/RuntimePackageMappingProvider.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2010-2015 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.jetbrains.kotlin.load.kotlin.reflect
+
+import org.jetbrains.kotlin.load.java.lazy.PackageMappingProvider
+import org.jetbrains.kotlin.load.kotlin.ModuleMapping
+import org.jetbrains.kotlin.load.kotlin.PackageFacades
+import java.io.ByteArrayOutputStream
+
+class RuntimePackageMappingProvider(val moduleName: String, val classLoader : ClassLoader) : PackageMappingProvider {
+
+ val mapping: ModuleMapping by lazy {
+ print("finding metainf for $moduleName")
+ val resourceAsStream = classLoader.getResourceAsStream("META-INF/$moduleName.kotlin_module") ?: return@lazy ModuleMapping("")
+
+ print("OK")
+
+ try {
+ val out = ByteArrayOutputStream(4096);
+ val buffer = ByteArray(4096);
+ while (true) {
+ val r = resourceAsStream.read(buffer);
+ if (r == -1) break;
+ out.write(buffer, 0, r);
+ }
+
+ val ret = out.toByteArray();
+ return@lazy ModuleMapping(String(ret, "UTF-8"))
+ } finally {
+ resourceAsStream.close()
+ }
+ }
+
+ override fun findPackageMembers(packageName: String): List<String> {
+ print("finding $packageName")
+ return mapping.package2MiniFacades.getOrElse (packageName, { PackageFacades("default") }).parts.toList()
+ }
+}
\ No newline at end of file
diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt
index d9a37fc547e51..287a51a57e913 100644
--- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt
+++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KDeclarationContainerImpl.kt
@@ -39,7 +39,7 @@ import kotlin.reflect.KotlinReflectionInternalError
abstract class KDeclarationContainerImpl : ClassBasedDeclarationContainer {
// Note: this is stored here on a soft reference to prevent GC from destroying the weak reference to it in the moduleByClassLoader cache
val moduleData by ReflectProperties.lazySoft {
- jClass.getOrCreateModule()
+ jClass.getOrCreateModule(null)
}
abstract val constructorDescriptors: Collection<ConstructorDescriptor>
diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPackageImpl.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPackageImpl.kt
index 33c507d8b9cdf..3e27cc9081ded 100644
--- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPackageImpl.kt
+++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/KPackageImpl.kt
@@ -27,9 +27,9 @@ import kotlin.jvm.internal.KotlinPackage
import kotlin.reflect.KCallable
import kotlin.reflect.KPackage
-class KPackageImpl(override val jClass: Class<*>) : KDeclarationContainerImpl(), KPackage {
+class KPackageImpl(override val jClass: Class<*>, val moduleName: String) : KDeclarationContainerImpl(), KPackage {
val descriptor by ReflectProperties.lazySoft {
- val moduleData = jClass.getOrCreateModule()
+ val moduleData = jClass.getOrCreateModule(moduleName)
val fqName = jClass.classId.getPackageFqName()
moduleData.module.getPackage(fqName)
diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/ReflectionFactoryImpl.java b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/ReflectionFactoryImpl.java
index 27f730367ef7b..b3a7eff722085 100644
--- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/ReflectionFactoryImpl.java
+++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/ReflectionFactoryImpl.java
@@ -32,7 +32,12 @@ public KClass createKotlinClass(Class javaClass) {
@Override
public KPackage createKotlinPackage(Class javaClass) {
- return new KPackageImpl(javaClass);
+ return createKotlinPackage(javaClass, "undefined");
+ }
+
+ @Override
+ public KPackage createKotlinPackage(Class javaClass, String moduleName) {
+ return new KPackageImpl(javaClass, moduleName);
}
@Override
diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt
index e4fb26a3e9435..5d274af7c2544 100644
--- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt
+++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt
@@ -44,7 +44,7 @@ private class WeakClassLoaderBox(classLoader: ClassLoader) {
ref.get()?.let { it.toString() } ?: "<null>"
}
-internal fun Class<*>.getOrCreateModule(): RuntimeModuleData {
+internal fun Class<*>.getOrCreateModule(moduleName: String?): RuntimeModuleData {
val classLoader = this.safeClassLoader
val key = WeakClassLoaderBox(classLoader)
@@ -54,7 +54,7 @@ internal fun Class<*>.getOrCreateModule(): RuntimeModuleData {
moduleByClassLoader.remove(key, cached)
}
- val module = RuntimeModuleData.create(classLoader)
+ val module = RuntimeModuleData.create(classLoader, moduleName)
try {
while (true) {
val ref = moduleByClassLoader.putIfAbsent(key, WeakReference(module))
diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/mapping.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/mapping.kt
index 765e23fb2537e..4b8d90d7a3af6 100644
--- a/core/reflection.jvm/src/kotlin/reflect/jvm/mapping.kt
+++ b/core/reflection.jvm/src/kotlin/reflect/jvm/mapping.kt
@@ -94,7 +94,7 @@ public val KType.javaType: Type
*/
public val Class<*>.kotlinPackage: KPackage?
get() = if (getSimpleName().endsWith("Package") &&
- getAnnotation(javaClass<kotlin.jvm.internal.KotlinPackage>()) != null) KPackageImpl(this) else null
+ getAnnotation(javaClass<kotlin.jvm.internal.KotlinPackage>()) != null) KPackageImpl(this, "undefined") else null
/**
diff --git a/core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java b/core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java
index 26bfe9fa704bd..4cdf824e9d02f 100644
--- a/core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java
+++ b/core/runtime.jvm/src/kotlin/jvm/internal/Reflection.java
@@ -55,6 +55,10 @@ public static KPackage createKotlinPackage(Class javaClass) {
return factory.createKotlinPackage(javaClass);
}
+ public static KPackage createKotlinPackage(Class javaClass, String moduleName) {
+ return factory.createKotlinPackage(javaClass, moduleName);
+ }
+
public static KClass foreignKotlinClass(Class javaClass) {
return factory.foreignKotlinClass(javaClass);
}
diff --git a/core/runtime.jvm/src/kotlin/jvm/internal/ReflectionFactory.java b/core/runtime.jvm/src/kotlin/jvm/internal/ReflectionFactory.java
index e6a2cc273b851..88aae99ba338e 100644
--- a/core/runtime.jvm/src/kotlin/jvm/internal/ReflectionFactory.java
+++ b/core/runtime.jvm/src/kotlin/jvm/internal/ReflectionFactory.java
@@ -27,6 +27,10 @@ public KPackage createKotlinPackage(Class javaClass) {
return null;
}
+ public KPackage createKotlinPackage(Class javaClass, String moduleName) {
+ return null;
+ }
+
public KClass foreignKotlinClass(Class javaClass) {
return new ClassReference(javaClass);
}
|
d2cf18983b635c3c47ca6bfcadc06bb2e15a547e
|
camel
|
CAMEL-1198: Ant path matcher now also possible- with camel-ftp.--git-svn-id: https://svn.apache.org/repos/asf/activemq/camel/trunk@730753 13f79535-47bb-0310-9956-ffa450edef68-
|
a
|
https://github.com/apache/camel
|
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java b/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
index df3fe20eb3d3a..c180e4318c6f5 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/FileConsumer.java
@@ -23,9 +23,9 @@
import org.apache.camel.AsyncCallback;
import org.apache.camel.Processor;
-import org.apache.camel.util.ObjectHelper;
import org.apache.camel.impl.ScheduledPollConsumer;
import org.apache.camel.processor.DeadLetterChannel;
+import org.apache.camel.util.ObjectHelper;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -103,8 +103,8 @@ protected void pollDirectory(File fileOrDirectory, List<File> fileList) {
}
File[] files = fileOrDirectory.listFiles();
for (File file : files) {
- if (endpoint.isRecursive() && file.isDirectory()) {
- if (isValidFile(file)) {
+ if (file.isDirectory()) {
+ if (endpoint.isRecursive() && isValidFile(file)) {
// recursive scan and add the sub files and folders
pollDirectory(file, fileList);
}
diff --git a/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java b/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java
index 4a1a397d5747d..9b4acf5951630 100644
--- a/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java
+++ b/camel-core/src/main/java/org/apache/camel/util/CollectionHelper.java
@@ -18,7 +18,9 @@
import java.lang.reflect.Array;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
+import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -107,4 +109,29 @@ public static List filterList(List list, Object... filters) {
}
return answer;
}
+
+ public static String collectionAsCommaDelimitedString(String[] col) {
+ if (col == null || col.length == 0) {
+ return "";
+ }
+ return collectionAsCommaDelimitedString(Arrays.asList(col));
+ }
+
+ public static String collectionAsCommaDelimitedString(Collection col) {
+ if (col == null || col.isEmpty()) {
+ return "";
+ }
+
+ StringBuilder sb = new StringBuilder();
+ Iterator it = col.iterator();
+ while (it.hasNext()) {
+ sb.append(it.next());
+ if (it.hasNext()) {
+ sb.append(",");
+ }
+ }
+
+ return sb.toString();
+ }
+
}
diff --git a/camel-core/src/test/java/org/apache/camel/util/CollectionHelperTest.java b/camel-core/src/test/java/org/apache/camel/util/CollectionHelperTest.java
new file mode 100644
index 0000000000000..95b8cfb47444e
--- /dev/null
+++ b/camel-core/src/test/java/org/apache/camel/util/CollectionHelperTest.java
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.util;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Revision$
+ */
+public class CollectionHelperTest extends TestCase {
+
+ private String[] names = new String[]{"Claus", "Willem", "Jonathan"};
+ private List list = Arrays.asList(names);
+
+ public void testCollectionAsCommaDelimitedString() {
+ assertEquals("Claus,Willem,Jonathan", CollectionHelper.collectionAsCommaDelimitedString(names));
+ assertEquals("Claus,Willem,Jonathan", CollectionHelper.collectionAsCommaDelimitedString(list));
+
+ assertEquals("", CollectionHelper.collectionAsCommaDelimitedString((String[]) null));
+ assertEquals("", CollectionHelper.collectionAsCommaDelimitedString((Collection) null));
+
+ assertEquals("Claus", CollectionHelper.collectionAsCommaDelimitedString(new String[]{"Claus"}));
+ }
+
+}
\ No newline at end of file
diff --git a/components/camel-ftp/pom.xml b/components/camel-ftp/pom.xml
index cfa31de1b9466..91b28692b0ec7 100644
--- a/components/camel-ftp/pom.xml
+++ b/components/camel-ftp/pom.xml
@@ -81,6 +81,13 @@
<scope>test</scope>
</dependency>
+ <!-- for unit testing AntPathMatcher -->
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ <scope>test</scope>
+ </dependency>
+
<dependency>
<groupId>org.apache.ftpserver</groupId>
<artifactId>ftpserver-core</artifactId>
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/AntPathMatcherRemoteFileFilter.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/AntPathMatcherRemoteFileFilter.java
new file mode 100644
index 0000000000000..c51b46e524fe4
--- /dev/null
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/AntPathMatcherRemoteFileFilter.java
@@ -0,0 +1,89 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.component.file.remote;
+
+import org.apache.camel.util.ObjectHelper;
+import static org.apache.camel.util.CollectionHelper.collectionAsCommaDelimitedString;
+
+/**
+ * File filter using Spring's AntPathMatcher.
+ * <p/>
+ * Exclude take precedence over includes. If a file match both exclude and include it will be regarded as excluded.
+ */
+public class AntPathMatcherRemoteFileFilter implements RemoteFileFilter {
+ private static final String ANTPATHMATCHER_CLASSNAME = "org.apache.camel.component.file.AntPathMatcherFileFilter";
+ private String[] excludes;
+ private String[] includes;
+
+ public boolean accept(RemoteFile file) {
+ // we must use reflection to invoke the AntPathMatcherFileFilter that reside in camel-spring.jar
+ // and we don't want camel-ftp to have runtime dependency on camel-spring.jar
+ Class clazz = ObjectHelper.loadClass(ANTPATHMATCHER_CLASSNAME);
+ ObjectHelper.notNull(clazz, ANTPATHMATCHER_CLASSNAME + " not found in classpath. camel-spring.jar is required in the classpath.");
+
+ try {
+ Object filter = ObjectHelper.newInstance(clazz);
+
+ // invoke setIncludes(String), must using string type as invoking with string[] does not work
+ ObjectHelper.invokeMethod(filter.getClass().getMethod("setIncludes", String.class), filter, collectionAsCommaDelimitedString(includes));
+
+ // invoke setExcludes(String), must using string type as invoking with string[] does not work
+ ObjectHelper.invokeMethod(filter.getClass().getMethod("setExcludes", String.class), filter, collectionAsCommaDelimitedString(excludes));
+
+ // invoke acceptPathName(String)
+ String path = file.getRelativeFileName();
+ Boolean result = (Boolean) ObjectHelper.invokeMethod(filter.getClass().getMethod("acceptPathName", String.class), filter, path);
+ return result;
+
+ } catch (NoSuchMethodException e) {
+ throw new TypeNotPresentException(ANTPATHMATCHER_CLASSNAME, e);
+ }
+ }
+
+ public String[] getExcludes() {
+ return excludes;
+ }
+
+ public void setExcludes(String[] excludes) {
+ this.excludes = excludes;
+ }
+
+ public String[] getIncludes() {
+ return includes;
+ }
+
+ public void setIncludes(String[] includes) {
+ this.includes = includes;
+ }
+
+ /**
+ * Sets excludes using a single string where each element can be separated with comma
+ */
+ public void setExcludes(String excludes) {
+ setExcludes(excludes.split(","));
+ }
+
+ /**
+ * Sets includes using a single string where each element can be separated with comma
+ */
+ public void setIncludes(String includes) {
+ setIncludes(includes.split(","));
+ }
+
+
+
+}
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
index 75adaf4e13430..0872b8ce81675 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/FtpConsumer.java
@@ -30,7 +30,7 @@ public FtpConsumer(RemoteFileEndpoint endpoint, Processor processor, RemoteFileO
super(endpoint, processor, ftp);
}
- protected void pollDirectory(String fileName, boolean processDir, List<RemoteFile> fileList) {
+ protected void pollDirectory(String fileName, List<RemoteFile> fileList) {
if (fileName == null) {
return;
}
@@ -45,11 +45,11 @@ protected void pollDirectory(String fileName, boolean processDir, List<RemoteFil
List<FTPFile> files = operations.listFiles(fileName);
for (FTPFile file : files) {
RemoteFile<FTPFile> remote = asRemoteFile(fileName, file);
- if (processDir && file.isDirectory()) {
- if (isValidFile(remote, true)) {
+ if (file.isDirectory()) {
+ if (endpoint.isRecursive() && isValidFile(remote, true)) {
// recursive scan and add the sub files and folders
String directory = fileName + "/" + file.getName();
- pollDirectory(directory, endpoint.isRecursive(), fileList);
+ pollDirectory(directory, fileList);
}
} else if (file.isFile()) {
if (isValidFile(remote, false)) {
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
index bbcc5c7ea93bb..aa712d6e60d11 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/RemoteFileConsumer.java
@@ -62,7 +62,7 @@ protected void poll() throws Exception {
String name = endpoint.getConfiguration().getFile();
boolean isDirectory = endpoint.getConfiguration().isDirectory();
if (isDirectory) {
- pollDirectory(name, endpoint.isRecursive(), files);
+ pollDirectory(name, files);
} else {
pollFile(name, files);
}
@@ -103,10 +103,9 @@ protected void poll() throws Exception {
* Polls the given directory for files to process
*
* @param fileName current directory or file
- * @param processDir recursive
* @param fileList current list of files gathered
*/
- protected abstract void pollDirectory(String fileName, boolean processDir, List<RemoteFile> fileList);
+ protected abstract void pollDirectory(String fileName, List<RemoteFile> fileList);
/**
* Polls the given file
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java
index 15d22987d7abf..32c6d37b4291b 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConsumer.java
@@ -30,7 +30,7 @@ public SftpConsumer(RemoteFileEndpoint endpoint, Processor processor, RemoteFile
super(endpoint, processor, operations);
}
- protected void pollDirectory(String fileName, boolean processDir, List<RemoteFile> fileList) {
+ protected void pollDirectory(String fileName, List<RemoteFile> fileList) {
if (fileName == null) {
return;
}
@@ -45,10 +45,10 @@ protected void pollDirectory(String fileName, boolean processDir, List<RemoteFil
List<ChannelSftp.LsEntry> files = operations.listFiles(fileName);
for (ChannelSftp.LsEntry file : files) {
RemoteFile<ChannelSftp.LsEntry> remote = asRemoteFile(fileName, file);
- if (processDir && file.getAttrs().isDir()) {
- if (isValidFile(remote, true)) {
+ if (file.getAttrs().isDir()) {
+ if (endpoint.isRecursive() && isValidFile(remote, true)) {
// recursive scan and add the sub files and folders
- pollDirectory(file.getFilename(), endpoint.isRecursive(), fileList);
+ pollDirectory(file.getFilename(), fileList);
}
} else if (!file.getAttrs().isLink()) {
if (isValidFile(remote, false)) {
diff --git a/components/camel-spring/pom.xml b/components/camel-spring/pom.xml
index 3cce464b949e1..278723597057e 100644
--- a/components/camel-spring/pom.xml
+++ b/components/camel-spring/pom.xml
@@ -43,6 +43,7 @@
org.apache.camel.spring.*;${camel.osgi.version},
org.apache.camel.component;${camel.osgi.split.pkg};${camel.osgi.version},
org.apache.camel.component.event;${camel.osgi.split.pkg};${camel.osgi.version},
+ org.apache.camel.component.file;${camel.osgi.split.pkg};${camel.osgi.version},
org.apache.camel.component.test;${camel.osgi.split.pkg};${camel.osgi.version},
org.apache.camel.component.validator;${camel.osgi.split.pkg};${camel.osgi.version},
org.apache.camel.component.xslt;${camel.osgi.split.pkg};${camel.osgi.version}
diff --git a/components/camel-spring/src/main/java/org/apache/camel/component/file/AntPathMatcherFileFilter.java b/components/camel-spring/src/main/java/org/apache/camel/component/file/AntPathMatcherFileFilter.java
index 0ffcdbe7346a5..578a3801e3d9f 100644
--- a/components/camel-spring/src/main/java/org/apache/camel/component/file/AntPathMatcherFileFilter.java
+++ b/components/camel-spring/src/main/java/org/apache/camel/component/file/AntPathMatcherFileFilter.java
@@ -37,7 +37,16 @@ public class AntPathMatcherFileFilter implements FileFilter {
private String[] includes;
public boolean accept(File pathname) {
- String path = pathname.getPath();
+ return acceptPathName(pathname.getPath());
+ }
+
+ /**
+ * Accepts the given file by the path name
+ *
+ * @param path the path
+ * @return <tt>true</tt> if accepted, <tt>false</tt> if not
+ */
+ public boolean acceptPathName(String path) {
// must use single / as path seperators
path = StringUtils.replace(path, File.separator, "/");
diff --git a/tests/camel-itest/pom.xml b/tests/camel-itest/pom.xml
index 1264c16780231..381bbc0afb60f 100644
--- a/tests/camel-itest/pom.xml
+++ b/tests/camel-itest/pom.xml
@@ -20,136 +20,170 @@
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
- <modelVersion>4.0.0</modelVersion>
+ <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-parent</artifactId>
- <version>2.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-parent</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ </parent>
- <artifactId>camel-itest</artifactId>
- <name>Camel :: Integration Tests</name>
- <description>Performs cross component integration tests</description>
+ <artifactId>camel-itest</artifactId>
+ <name>Camel :: Integration Tests</name>
+ <description>Performs cross component integration tests</description>
- <dependencies>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jms</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-spring</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-cxf</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-jetty</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-http</artifactId>
- <scope>test</scope>
- </dependency>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jms</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-spring</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-cxf</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-jetty</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-http</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-ftp</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ftpserver</groupId>
+ <artifactId>ftpserver-core</artifactId>
+ <version>1.0.0-M3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.ftpserver</groupId>
+ <artifactId>ftplet-api</artifactId>
+ <version>1.0.0-M3</version>
+ <scope>test</scope>
+ </dependency>
+ <!-- ftpserver using mina 2.0.0-M2 -->
+ <dependency>
+ <groupId>org.apache.mina</groupId>
+ <artifactId>mina-core</artifactId>
+ <version>2.0.0-M2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <scope>test</scope>
+ </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.camel</groupId>
- <artifactId>camel-core</artifactId>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-core</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.activemq</groupId>
- <artifactId>activemq-camel</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.xbean</groupId>
- <artifactId>xbean-spring</artifactId>
- <exclusions>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.springframework</groupId>
- <artifactId>spring-test</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-core</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-core</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.activemq</groupId>
+ <artifactId>activemq-camel</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.xbean</groupId>
+ <artifactId>xbean-spring</artifactId>
+ <exclusions>
+ <exclusion>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework</groupId>
+ <artifactId>spring-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <forkMode>pertest</forkMode>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-codegen-plugin</artifactId>
- <version>${cxf-version}</version>
- <executions>
- <execution>
- <id>generate-test-sources</id>
- <phase>generate-sources</phase>
- <configuration>
- <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
- <wsdlOptions>
- <wsdlOption>
- <wsdl>
- ${basedir}/src/test/resources/wsdl/CustomerService-1.0.0.wsdl
- </wsdl>
- </wsdlOption>
- <wsdlOption>
- <wsdl>
- ${basedir}/src/test/resources/wsdl/hello_world.wsdl
- </wsdl>
- </wsdlOption>
- </wsdlOptions>
- </configuration>
- <goals>
- <goal>wsdl2java</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>pertest</forkMode>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-codegen-plugin</artifactId>
+ <version>${cxf-version}</version>
+ <executions>
+ <execution>
+ <id>generate-test-sources</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <testSourceRoot>${basedir}/target/generated/src/test/java</testSourceRoot>
+ <wsdlOptions>
+ <wsdlOption>
+ <wsdl>
+ ${basedir}/src/test/resources/wsdl/CustomerService-1.0.0.wsdl
+ </wsdl>
+ </wsdlOption>
+ <wsdlOption>
+ <wsdl>
+ ${basedir}/src/test/resources/wsdl/hello_world.wsdl
+ </wsdl>
+ </wsdlOption>
+ </wsdlOptions>
+ </configuration>
+ <goals>
+ <goal>wsdl2java</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
diff --git a/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java b/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java
new file mode 100644
index 0000000000000..bbd10b3085474
--- /dev/null
+++ b/tests/camel-itest/src/test/java/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest.java
@@ -0,0 +1,87 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.itest.ftp;
+
+import java.io.File;
+
+import org.apache.camel.Endpoint;
+import org.apache.camel.EndpointInject;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.file.FileComponent;
+import org.apache.camel.component.mock.MockEndpoint;
+import org.apache.ftpserver.FtpServer;
+import org.apache.ftpserver.usermanager.ClearTextPasswordEncryptor;
+import org.apache.ftpserver.usermanager.PropertiesUserManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit38.AbstractJUnit38SpringContextTests;
+
+/**
+ * Unit testing FTP ant path matcher
+ */
+@ContextConfiguration
+public class SpringFileAntPathMatcherRemoteFileFilterTest extends AbstractJUnit38SpringContextTests {
+ protected FtpServer ftpServer;
+
+ protected String expectedBody = "Godday World";
+ @Autowired
+ protected ProducerTemplate template;
+ @EndpointInject(name = "myFTPEndpoint")
+ protected Endpoint inputFTP;
+ @EndpointInject(uri = "mock:result")
+ protected MockEndpoint result;
+
+ public void testAntPatchMatherFilter() throws Exception {
+ result.expectedBodiesReceived(expectedBody);
+
+ template.sendBodyAndHeader(inputFTP, "Hello World", FileComponent.HEADER_FILE_NAME, "hello.txt");
+ template.sendBodyAndHeader(inputFTP, "Bye World", FileComponent.HEADER_FILE_NAME, "bye.xml");
+ template.sendBodyAndHeader(inputFTP, "Bad world", FileComponent.HEADER_FILE_NAME, "subfolder/badday.txt");
+ template.sendBodyAndHeader(inputFTP, "Day world", FileComponent.HEADER_FILE_NAME, "day.xml");
+ template.sendBodyAndHeader(inputFTP, expectedBody, FileComponent.HEADER_FILE_NAME, "subfolder/foo/godday.txt");
+
+ result.assertIsSatisfied();
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ initFtpServer();
+ ftpServer.start();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ ftpServer.stop();
+ ftpServer = null;
+ }
+
+ protected void initFtpServer() throws Exception {
+ ftpServer = new FtpServer();
+
+ // setup user management to read our users.properties and use clear text passwords
+ PropertiesUserManager uman = new PropertiesUserManager();
+ uman.setFile(new File("./src/test/resources/users.properties").getAbsoluteFile());
+ uman.setPasswordEncryptor(new ClearTextPasswordEncryptor());
+ uman.setAdminName("admin");
+ uman.configure();
+ ftpServer.setUserManager(uman);
+
+ ftpServer.getListener("default").setPort(20123);
+ }
+
+}
+
diff --git a/tests/camel-itest/src/test/resources/log4j.properties b/tests/camel-itest/src/test/resources/log4j.properties
index 1c9dcf7ef08b3..bcfdb12735907 100644
--- a/tests/camel-itest/src/test/resources/log4j.properties
+++ b/tests/camel-itest/src/test/resources/log4j.properties
@@ -22,7 +22,9 @@ log4j.rootLogger=WARN, out
log4j.logger.org.springframework=WARN
log4j.logger.org.apache.activemq=WARN
+#log4j.logger.org.apache.camel=TRACE
#log4j.logger.org.apache.camel=DEBUG
+#log4j.logger.org.apache.camel.component.file=TRACE
# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
diff --git a/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml b/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml
new file mode 100644
index 0000000000000..04299ccf62379
--- /dev/null
+++ b/tests/camel-itest/src/test/resources/org/apache/camel/itest/ftp/SpringFileAntPathMatcherRemoteFileFilterTest-context.xml
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://activemq.apache.org/camel/schema/spring http://activemq.apache.org/camel/schema/spring/camel-spring.xsd
+ ">
+
+ <!-- START SNIPPET: example -->
+ <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
+ <template id="camelTemplate"/>
+
+ <!-- use myFilter as filter to allow setting ANT paths for which files to scan for -->
+ <endpoint id="myFTPEndpoint" uri="ftp://admin@localhost:20123/antpath?password=admin&recursive=true&delay=10000&initialDelay=2000&filter=#myAntFilter"/>
+
+ <route>
+ <from ref="myFTPEndpoint"/>
+ <to uri="mock:result"/>
+ </route>
+ </camelContext>
+
+ <!-- we use the AntPathMatcherRemoteFileFilter to use ant paths for includes and exlucde -->
+ <bean id="myAntFilter" class="org.apache.camel.component.file.remote.AntPathMatcherRemoteFileFilter">
+ <!-- include and file in the subfolder that has day in the name -->
+ <property name="includes" value="**/subfolder/**/*day*"/>
+ <!-- exclude all files with bad in name or .xml files. Use comma to seperate multiple excludes -->
+ <property name="excludes" value="**/*bad*,**/*.xml"/>
+ </bean>
+ <!-- END SNIPPET: example -->
+
+</beans>
diff --git a/tests/camel-itest/src/test/resources/users.properties b/tests/camel-itest/src/test/resources/users.properties
new file mode 100644
index 0000000000000..b4f2e17164ed0
--- /dev/null
+++ b/tests/camel-itest/src/test/resources/users.properties
@@ -0,0 +1,12 @@
+ftpserver.user.admin
+ftpserver.user.admin.userpassword=admin
+ftpserver.user.admin.homedirectory=./res/home
+ftpserver.user.admin.writepermission=true
+ftpserver.user.scott
+ftpserver.user.scott.userpassword=tiger
+ftpserver.user.scott.homedirectory=./res/home
+ftpserver.user.scott.writepermission=true
+ftpserver.user.dummy
+ftpserver.user.dummy.userpassword=foo
+ftpserver.user.dummy.homedirectory=./res/home
+ftpserver.user.dummy.writepermission=false
|
988192ad2245343da0fbf89277746833256d0109
|
intellij-community
|
Added code completion test.--
|
p
|
https://github.com/JetBrains/intellij-community
|
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/ComlpetionActionTest.java b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/ComlpetionActionTest.java
index ce9b85cd97eaf..8fca979db7358 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/ComlpetionActionTest.java
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/ComlpetionActionTest.java
@@ -83,12 +83,13 @@ public void run() {
result = myEditor.getDocument().getText();
result = result.substring(0, offset) + CARET_MARKER + result.substring(offset);
- if (items.length > 0) {
- result = result + "\n#####";
+ if (items.length > 1) {
Arrays.sort(items);
+ result = "";
for (LookupItem item : items) {
result = result + "\n" + item.getLookupString();
}
+ result = result.trim();
}
} finally {
@@ -109,18 +110,17 @@ protected LookupItem[] getAcceptableItems(CompletionData completionData) {
final Set<LookupItem> lookupSet = new LinkedHashSet<LookupItem>();
final PsiElement elem = myFile.findElementAt(myOffset);
- String whitePrefix = "";
- for (int i = 0; i < myOffset; i++) {
- whitePrefix += " ";
- }
-
+ /**
+ * Create fake file with dummy element
+ */
String newFileText = myFile.getText().substring(0, myOffset + 1) + "IntellijIdeaRulezzz" +
myFile.getText().substring(myOffset + 1);
try {
- PsiFile newFile = createGroovyFile(newFileText);
+ /**
+ * Hack for IDEA completion
+ */
+ PsiFile newFile = TestUtils.createPseudoPhysicalFile(project, newFileText);
PsiElement insertedElement = newFile.findElementAt(myOffset + 1);
-
-
final int offset1 =
myEditor.getSelectionModel().hasSelection() ? myEditor.getSelectionModel().getSelectionStart() : myEditor.getCaretModel().getOffset();
final int offset2 = myEditor.getSelectionModel().hasSelection() ? myEditor.getSelectionModel().getSelectionEnd() : offset1;
@@ -148,20 +148,6 @@ protected LookupItem[] getAcceptableItems(CompletionData completionData) {
}
}
- private PsiElement createIdentifierFromText(String idText) {
- PsiFile file = null;
- try {
- file = createGroovyFile(idText);
- } catch (IncorrectOperationException e) {
- e.printStackTrace();
- }
- return ((GrReferenceExpression) ((GroovyFile) file).getTopStatements()[0]).getReferenceNameElement();
- }
-
- private PsiFile createGroovyFile(String idText) throws IncorrectOperationException {
- return TestUtils.createPseudoPhysicalFile(project, idText);
- }
-
public String transform(String testName, String[] data) throws Exception {
setSettings();
String fileText = data[0];
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/instanceof/ins1.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/instanceof/ins1.test
deleted file mode 100644
index 75627b97c1354..0000000000000
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/instanceof/ins1.test
+++ /dev/null
@@ -1,5 +0,0 @@
-return a i<caret> b
------
-return a instanceof <caret>b
-#####
-instanceof
\ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/class/class2.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/class/class2.test
new file mode 100644
index 0000000000000..eefa814c2e41e
--- /dev/null
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/class/class2.test
@@ -0,0 +1,3 @@
+class A extends B <caret> C {}
+-----
+class A extends B implements <caret>C {}
\ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/class/class3.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/class/class3.test
new file mode 100644
index 0000000000000..0c2dd701fecba
--- /dev/null
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/class/class3.test
@@ -0,0 +1,4 @@
+cl<caret>
+-----
+class <caret>
+
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/import/imp1.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/import/imp1.test
index 8d649d7c03414..4002f2587aa85 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/import/imp1.test
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/import/imp1.test
@@ -1,5 +1,3 @@
im<caret>
-----
-import <caret>
-#####
-import
\ No newline at end of file
+import <caret>
\ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/import/imp2.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/import/imp2.test
index c47a164707171..d84d67abbfcf3 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/import/imp2.test
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/import/imp2.test
@@ -1,6 +1,4 @@
i<caret>
-----
-i<caret>
-#####
import
interface
\ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/instanceof/ins1.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/instanceof/ins1.test
new file mode 100644
index 0000000000000..78e6dd647b547
--- /dev/null
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/instanceof/ins1.test
@@ -0,0 +1,3 @@
+return a i<caret> b
+-----
+return a instanceof <caret>b
\ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/package/pack1.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/package/pack1.test
index d1d943081e039..d0f9510a93f88 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/package/pack1.test
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/package/pack1.test
@@ -1,5 +1,3 @@
pa<caret>
-----
-package <caret>
-#####
-package
\ No newline at end of file
+package <caret>
\ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/switch/swit1.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/switch/swit1.test
similarity index 53%
rename from plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/switch/swit1.test
rename to plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/switch/swit1.test
index 99b262b739939..3e0787084872f 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/switch/swit1.test
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/switch/swit1.test
@@ -6,13 +6,5 @@ class A{
}
}
-----
-class A{
- def foo(){
- switch (x){
- <caret>
- }
- }
-}
-#####
case
default
\ No newline at end of file
diff --git a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/switch/swit2.test b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/switch/swit2.test
similarity index 92%
rename from plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/switch/swit2.test
rename to plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/switch/swit2.test
index 5bcc55a6b1533..ef6dbfa57cbd4 100644
--- a/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/switch/swit2.test
+++ b/plugins/groovy/test/org/jetbrains/plugins/groovy/lang/completion/data/keyword/switch/swit2.test
@@ -12,6 +12,4 @@ class A {
case <caret>
}
}
-}
-#####
-case
\ No newline at end of file
+}
\ No newline at end of file
|
6a12880afc3fb8497578b4646e6e4f28571d267f
|
square$retrofit
|
Use string converter for String type.
Unlike RequestBody and ResponseBody which are library types that must be handled by default, String is a platform type and we want to ofer the flexibility of doing things like using annotations to transform the contents.
|
p
|
https://github.com/square/retrofit
|
diff --git a/retrofit/src/main/java/retrofit2/BuiltInConverters.java b/retrofit/src/main/java/retrofit2/BuiltInConverters.java
index d580c00fb1..f729383a31 100644
--- a/retrofit/src/main/java/retrofit2/BuiltInConverters.java
+++ b/retrofit/src/main/java/retrofit2/BuiltInConverters.java
@@ -27,10 +27,9 @@ final class BuiltInConverters extends Converter.Factory {
public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations,
Retrofit retrofit) {
if (type == ResponseBody.class) {
- if (Utils.isAnnotationPresent(annotations, Streaming.class)) {
- return StreamingResponseBodyConverter.INSTANCE;
- }
- return BufferingResponseBodyConverter.INSTANCE;
+ return Utils.isAnnotationPresent(annotations, Streaming.class)
+ ? StreamingResponseBodyConverter.INSTANCE
+ : BufferingResponseBodyConverter.INSTANCE;
}
if (type == Void.class) {
return VoidResponseBodyConverter.INSTANCE;
@@ -47,22 +46,6 @@ public Converter<?, RequestBody> requestBodyConverter(Type type,
return null;
}
- @Override public Converter<?, String> stringConverter(Type type, Annotation[] annotations,
- Retrofit retrofit) {
- if (type == String.class) {
- return StringConverter.INSTANCE;
- }
- return null;
- }
-
- static final class StringConverter implements Converter<String, String> {
- static final StringConverter INSTANCE = new StringConverter();
-
- @Override public String convert(String value) throws IOException {
- return value;
- }
- }
-
static final class VoidResponseBodyConverter implements Converter<ResponseBody, Void> {
static final VoidResponseBodyConverter INSTANCE = new VoidResponseBodyConverter();
diff --git a/retrofit/src/test/java/retrofit2/RetrofitTest.java b/retrofit/src/test/java/retrofit2/RetrofitTest.java
index 9c17cab429..41036c9877 100644
--- a/retrofit/src/test/java/retrofit2/RetrofitTest.java
+++ b/retrofit/src/test/java/retrofit2/RetrofitTest.java
@@ -399,11 +399,13 @@ class MyConverterFactory extends Converter.Factory {
assertThat(annotations).hasAtLeastOneElementOfType(Annotated.Foo.class);
}
- @Test public void stringConverterNotCalledForString() {
+ @Test public void stringConverterCalledForString() {
+ final AtomicBoolean factoryCalled = new AtomicBoolean();
class MyConverterFactory extends Converter.Factory {
@Override public Converter<?, String> stringConverter(Type type, Annotation[] annotations,
Retrofit retrofit) {
- throw new AssertionError();
+ factoryCalled.set(true);
+ return null;
}
}
Retrofit retrofit = new Retrofit.Builder()
@@ -413,7 +415,7 @@ class MyConverterFactory extends Converter.Factory {
CallMethod service = retrofit.create(CallMethod.class);
Call<ResponseBody> call = service.queryString(null);
assertThat(call).isNotNull();
- // We also implicitly assert the above factory was not called as it would have thrown.
+ assertThat(factoryCalled.get()).isTrue();
}
@Test public void stringConverterReturningNullResultsInDefault() {
|
7d474706065c400dd59a6808c0a05d9ad1ac77ab
|
restlet-framework-java
|
- Simple HTTP connector works again--
|
c
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/source/ext/simple3.1/com/noelios/restlet/ext/simple/SimpleServer.java b/source/ext/simple3.1/com/noelios/restlet/ext/simple/SimpleServer.java
index 46c0adedaa..3ce0a5ecd6 100644
--- a/source/ext/simple3.1/com/noelios/restlet/ext/simple/SimpleServer.java
+++ b/source/ext/simple3.1/com/noelios/restlet/ext/simple/SimpleServer.java
@@ -22,28 +22,19 @@
package com.noelios.restlet.ext.simple;
-import java.io.FileInputStream;
import java.io.IOException;
import java.net.ServerSocket;
-import java.security.KeyStore;
import java.util.logging.Level;
import java.util.logging.Logger;
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-
import org.restlet.component.Component;
import org.restlet.data.ParameterList;
-import org.restlet.data.Protocols;
-import simple.http.BufferedPipelineFactory;
import simple.http.PipelineHandler;
-import simple.http.PipelineHandlerFactory;
import simple.http.ProtocolHandler;
import simple.http.Request;
import simple.http.Response;
import simple.http.connect.Connection;
-import simple.http.connect.ConnectionFactory;
import com.noelios.restlet.impl.HttpServer;
@@ -89,42 +80,6 @@ public SimpleServer(Component owner, ParameterList parameters, String address, i
super(owner, parameters, address, port);
}
- /** Starts the Restlet. */
- public void start() throws Exception
- {
- if(!isStarted())
- {
- if (Protocols.HTTP.equals(super.protocols))
- {
- socket = new ServerSocket(port);
- }
- else if (Protocols.HTTPS.equals(super.protocols))
- {
- KeyStore keyStore = KeyStore.getInstance("JKS");
- keyStore.load(new FileInputStream(keystorePath), keystorePassword
- .toCharArray());
- KeyManagerFactory keyManagerFactory = KeyManagerFactory
- .getInstance("SunX509");
- keyManagerFactory.init(keyStore, keyPassword.toCharArray());
- SSLContext sslContext = SSLContext.getInstance("TLS");
- sslContext.init(keyManagerFactory.getKeyManagers(), null, null);
- socket = sslContext.getServerSocketFactory().createServerSocket(port);
- socket.setSoTimeout(60000);
- }
- else
- {
- // Should never happen.
- throw new RuntimeException("Unsupported protocol: " + super.protocols);
- }
-
- this.confidential = Protocols.HTTPS.equals(getProtocols());
- this.handler = PipelineHandlerFactory.getInstance(this, 20, 200);
- this.connection = ConnectionFactory.getConnection(handler, new BufferedPipelineFactory());
- this.connection.connect(socket);
- super.start();
- }
- }
-
/** Stops the Restlet. */
public void stop() throws Exception
{
diff --git a/source/main/com/noelios/restlet/impl/FactoryImpl.java b/source/main/com/noelios/restlet/impl/FactoryImpl.java
index 3e3fa990f0..ac34f648ce 100644
--- a/source/main/com/noelios/restlet/impl/FactoryImpl.java
+++ b/source/main/com/noelios/restlet/impl/FactoryImpl.java
@@ -30,7 +30,6 @@
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
-import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -116,7 +115,7 @@ public FactoryImpl()
try
{
Class<? extends Client> providerClass = (Class<? extends Client>) Class.forName(providerClassName);
- this.clients.add(providerClass.newInstance());
+ this.clients.add(providerClass.getConstructor(Component.class, ParameterList.class).newInstance(null, null));
}
catch(Exception e)
{
@@ -166,7 +165,7 @@ public FactoryImpl()
try
{
Class<? extends Server> providerClass = (Class<? extends Server>) Class.forName(providerClassName);
- this.servers.add(providerClass.newInstance());
+ this.servers.add(providerClass.getConstructor(Component.class, ParameterList.class, String.class, int.class).newInstance(null, null, null, new Integer(-1)));
}
catch(Exception e)
{
@@ -204,7 +203,7 @@ public Client createClient(List<Protocol> protocols, Component owner, ParameterL
{
try
{
- return client.getClass().getConstructor(Component.class, Map.class).newInstance(owner, parameters);
+ return client.getClass().getConstructor(Component.class, ParameterList.class).newInstance(owner, parameters);
}
catch (Exception e)
{
@@ -267,7 +266,7 @@ public Server createServer(List<Protocol> protocols, Component owner, ParameterL
{
try
{
- return server.getClass().getConstructor(Component.class, Map.class, String.class, int.class).newInstance(owner, parameters, address, port);
+ return server.getClass().getConstructor(Component.class, ParameterList.class, String.class, int.class).newInstance(owner, parameters, address, port);
}
catch (Exception e)
{
diff --git a/source/main/meta-inf/services/org.restlet.connector.Client b/source/main/meta-inf/services/org.restlet.connector.Client
index 01c6b38b2a..41ab6574c1 100644
--- a/source/main/meta-inf/services/org.restlet.connector.Client
+++ b/source/main/meta-inf/services/org.restlet.connector.Client
@@ -1,3 +1,2 @@
com.noelios.restlet.impl.HttpClient # HTTP, HTTPS
-com.noelios.restlet.impl.FileClient # FILE
-com.noelios.restlet.impl.ContextClient # CONTEXT
+com.noelios.restlet.impl.ContextClient # CONTEXT, FILE
|
e86d48730c64d10ba2a838e5663f9ab7a698c9c6
|
hadoop
|
HADOOP-7187. Fix socket leak in GangliaContext. - Contributed by Uma Maheswara Rao G--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1085122 13f79535-47bb-0310-9956-ffa450edef68-
|
c
|
https://github.com/apache/hadoop
|
diff --git a/CHANGES.txt b/CHANGES.txt
index 3cb5136879088..f33d02a834cbc 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -604,6 +604,9 @@ Release 0.21.1 - Unreleased
HADOOP-7174. Null is displayed in the "fs -copyToLocal" command.
(Uma Maheswara Rao G via szetszwo)
+ HADOOP-7187. Fix socket leak in GangliaContext. (Uma Maheswara Rao G
+ via szetszwo)
+
Release 0.21.0 - 2010-08-13
INCOMPATIBLE CHANGES
diff --git a/src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java b/src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java
index 1b22240f879d0..6460120012d41 100644
--- a/src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java
+++ b/src/java/org/apache/hadoop/metrics/ganglia/GangliaContext.java
@@ -112,6 +112,17 @@ public void init(String contextName, ContextFactory factory) {
}
}
+ /**
+ * method to close the datagram socket
+ */
+ @Override
+ public void close() {
+ super.close();
+ if (datagramSocket != null) {
+ datagramSocket.close();
+ }
+ }
+
@InterfaceAudience.Private
public void emitRecord(String contextName, String recordName,
OutputRecord outRec)
diff --git a/src/test/core/org/apache/hadoop/metrics/ganglia/TestGangliaContext.java b/src/test/core/org/apache/hadoop/metrics/ganglia/TestGangliaContext.java
new file mode 100644
index 0000000000000..deb8231154cd8
--- /dev/null
+++ b/src/test/core/org/apache/hadoop/metrics/ganglia/TestGangliaContext.java
@@ -0,0 +1,42 @@
+/*
+ * TestGangliaContext.java
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.hadoop.metrics.ganglia;
+
+import org.junit.Test;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import org.apache.hadoop.metrics.ContextFactory;
+import org.apache.hadoop.metrics.spi.AbstractMetricsContext;
+
+public class TestGangliaContext {
+
+ @Test
+ public void testCloseShouldCloseTheSocketWhichIsCreatedByInit() throws Exception {
+ AbstractMetricsContext context=new GangliaContext();
+ context.init("gangliaContext", ContextFactory.getFactory());
+ GangliaContext gangliaContext =(GangliaContext) context;
+ assertFalse("Socket already closed",gangliaContext.datagramSocket.isClosed());
+ context.close();
+ assertTrue("Socket not closed",gangliaContext.datagramSocket.isClosed());
+ }
+}
|
55ff4ae941e12c170a5e49801e599827e6461e27
|
kotlin
|
Abstract Lazy test for gianostics--
|
p
|
https://github.com/JetBrains/kotlin
|
diff --git a/compiler/tests/org/jetbrains/jet/checkers/AbstractDiagnosticsTestWithEagerResolve.java b/compiler/tests/org/jetbrains/jet/checkers/AbstractDiagnosticsTestWithEagerResolve.java
index 58a0b7bbe6ab8..77b940858ad37 100644
--- a/compiler/tests/org/jetbrains/jet/checkers/AbstractDiagnosticsTestWithEagerResolve.java
+++ b/compiler/tests/org/jetbrains/jet/checkers/AbstractDiagnosticsTestWithEagerResolve.java
@@ -17,7 +17,6 @@
package org.jetbrains.jet.checkers;
import com.google.common.base.Predicates;
-import com.google.common.collect.Lists;
import com.intellij.psi.PsiFile;
import org.jetbrains.jet.lang.BuiltinsScopeExtensionMode;
import org.jetbrains.jet.lang.psi.JetFile;
@@ -39,12 +38,7 @@
public abstract class AbstractDiagnosticsTestWithEagerResolve extends AbstractJetDiagnosticsTest {
protected void analyzeAndCheck(String expectedText, List<TestFile> testFiles) {
- List<JetFile> jetFiles = Lists.newArrayList();
- for (TestFile testFile : testFiles) {
- if (testFile.getJetFile() != null) {
- jetFiles.add(testFile.getJetFile());
- }
- }
+ List<JetFile> jetFiles = getJetFiles(testFiles);
BindingContext bindingContext = AnalyzerFacadeForJVM.analyzeFilesWithJavaIntegration(
getProject(), jetFiles, Collections.<AnalyzerScriptParameter>emptyList(),
diff --git a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java
index 4498b7883033a..224b863d6a397 100644
--- a/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java
+++ b/compiler/tests/org/jetbrains/jet/checkers/AbstractJetDiagnosticsTest.java
@@ -91,6 +91,16 @@ public TestFile create(String fileName, String text) {
protected abstract void analyzeAndCheck(String expectedText, List<TestFile> files);
+ protected static List<JetFile> getJetFiles(List<TestFile> testFiles) {
+ List<JetFile> jetFiles = Lists.newArrayList();
+ for (TestFile testFile : testFiles) {
+ if (testFile.getJetFile() != null) {
+ jetFiles.add(testFile.getJetFile());
+ }
+ }
+ return jetFiles;
+ }
+
protected class TestFile {
private final List<CheckerTestUtil.DiagnosedRange> diagnosedRanges = Lists.newArrayList();
private final String expectedText;
diff --git a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyResolveDiagnosticsTest.java b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyResolveDiagnosticsTest.java
index fec99cb68aaf7..72a492a53e876 100644
--- a/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyResolveDiagnosticsTest.java
+++ b/compiler/tests/org/jetbrains/jet/lang/resolve/lazy/AbstractLazyResolveDiagnosticsTest.java
@@ -16,10 +16,15 @@
package org.jetbrains.jet.lang.resolve.lazy;
+import com.google.common.base.Predicates;
import junit.framework.TestCase;
import org.jetbrains.jet.ConfigurationKind;
import org.jetbrains.jet.checkers.AbstractJetDiagnosticsTest;
import org.jetbrains.jet.cli.jvm.compiler.JetCoreEnvironment;
+import org.jetbrains.jet.jvm.compiler.NamespaceComparator;
+import org.jetbrains.jet.lang.descriptors.ModuleDescriptor;
+import org.jetbrains.jet.lang.descriptors.NamespaceDescriptor;
+import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.test.generator.SimpleTestClassModel;
import org.jetbrains.jet.test.generator.TestGenerator;
@@ -39,7 +44,11 @@ protected JetCoreEnvironment createEnvironment() {
@Override
protected void analyzeAndCheck(String expectedText, List<TestFile> files) {
+ List<JetFile> jetFiles = getJetFiles(files);
+ ModuleDescriptor lazyModule = LazyResolveTestUtil.resolveLazily(jetFiles, getEnvironment());
+ ModuleDescriptor eagerModule = LazyResolveTestUtil.resolveEagerly(jetFiles, getEnvironment());
+ NamespaceComparator.assertNamespacesEqual(eagerModule.getRootNamespace(), lazyModule.getRootNamespace(), false, Predicates.<NamespaceDescriptor>alwaysTrue());
}
public static void main(String[] args) throws IOException {
|
7b7fc7b788066529daa177873c28f4f9013a9c9e
|
hadoop
|
YARN-254. Update fair scheduler web UI for- hierarchical queues. (sandyr via tucu)--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1423743 13f79535-47bb-0310-9956-ffa450edef68-
|
a
|
https://github.com/apache/hadoop
|
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index dc762a56a1a39..16c8cb338a15a 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -56,6 +56,9 @@ Release 2.0.3-alpha - Unreleased
YARN-129. Simplify classpath construction for mini YARN tests. (tomwhite)
+ YARN-254. Update fair scheduler web UI for hierarchical queues.
+ (sandyr via tucu)
+
OPTIMIZATIONS
BUG FIXES
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java
index 8872fab097a17..b36fd9a4c2d52 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/FairSchedulerPage.java
@@ -20,21 +20,21 @@
import static org.apache.hadoop.yarn.util.StringHelper.join;
-import java.util.List;
+import java.util.Collection;
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerInfo;
+import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerLeafQueueInfo;
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.FairSchedulerQueueInfo;
import org.apache.hadoop.yarn.webapp.ResponseInfo;
import org.apache.hadoop.yarn.webapp.SubView;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.DIV;
+import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.LI;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.UL;
import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
import org.apache.hadoop.yarn.webapp.view.InfoBlock;
-import org.apache.hadoop.yarn.webapp.view.HtmlPage.Page;
-import org.apache.hadoop.yarn.webapp.view.HtmlPage._;
import com.google.inject.Inject;
import com.google.inject.servlet.RequestScoped;
@@ -50,16 +50,15 @@ public class FairSchedulerPage extends RmView {
@RequestScoped
static class FSQInfo {
- FairSchedulerInfo fsinfo;
FairSchedulerQueueInfo qinfo;
}
- static class QueueInfoBlock extends HtmlBlock {
- final FairSchedulerQueueInfo qinfo;
+ static class LeafQueueBlock extends HtmlBlock {
+ final FairSchedulerLeafQueueInfo qinfo;
- @Inject QueueInfoBlock(ViewContext ctx, FSQInfo info) {
+ @Inject LeafQueueBlock(ViewContext ctx, FSQInfo info) {
super(ctx);
- qinfo = (FairSchedulerQueueInfo) info.qinfo;
+ qinfo = (FairSchedulerLeafQueueInfo)info.qinfo;
}
@Override
@@ -83,6 +82,47 @@ protected void render(Block html) {
}
}
+ static class QueueBlock extends HtmlBlock {
+ final FSQInfo fsqinfo;
+
+ @Inject QueueBlock(FSQInfo info) {
+ fsqinfo = info;
+ }
+
+ @Override
+ public void render(Block html) {
+ Collection<FairSchedulerQueueInfo> subQueues = fsqinfo.qinfo.getChildQueues();
+ UL<Hamlet> ul = html.ul("#pq");
+ for (FairSchedulerQueueInfo info : subQueues) {
+ float capacity = info.getMaxResourcesFraction();
+ float fairShare = info.getFairShareFraction();
+ float used = info.getUsedFraction();
+ LI<UL<Hamlet>> li = ul.
+ li().
+ a(_Q).$style(width(capacity * Q_MAX_WIDTH)).
+ $title(join("Fair Share:", percent(fairShare))).
+ span().$style(join(Q_GIVEN, ";font-size:1px;", width(fairShare/capacity))).
+ _('.')._().
+ span().$style(join(width(used/capacity),
+ ";font-size:1px;left:0%;", used > fairShare ? Q_OVER : Q_UNDER)).
+ _('.')._().
+ span(".q", info.getQueueName())._().
+ span().$class("qstats").$style(left(Q_STATS_POS)).
+ _(join(percent(used), " used"))._();
+
+ fsqinfo.qinfo = info;
+ if (info instanceof FairSchedulerLeafQueueInfo) {
+ li.ul("#lq").li()._(LeafQueueBlock.class)._()._();
+ } else {
+ li._(QueueBlock.class);
+ }
+ li._();
+ }
+
+ ul._();
+ }
+ }
+
static class QueuesBlock extends HtmlBlock {
final FairScheduler fs;
final FSQInfo fsqinfo;
@@ -91,8 +131,9 @@ static class QueuesBlock extends HtmlBlock {
fs = (FairScheduler)rm.getResourceScheduler();
fsqinfo = info;
}
-
- @Override public void render(Block html) {
+
+ @Override
+ public void render(Block html) {
html._(MetricsOverviewTable.class);
UL<DIV<DIV<Hamlet>>> ul = html.
div("#cs-wrapper.ui-widget").
@@ -108,8 +149,8 @@ static class QueuesBlock extends HtmlBlock {
span(".q", "default")._()._();
} else {
FairSchedulerInfo sinfo = new FairSchedulerInfo(fs);
- fsqinfo.fsinfo = sinfo;
- fsqinfo.qinfo = null;
+ fsqinfo.qinfo = sinfo.getRootQueueInfo();
+ float used = fsqinfo.qinfo.getUsedFraction();
ul.
li().$style("margin-bottom: 1em").
@@ -122,29 +163,15 @@ static class QueuesBlock extends HtmlBlock {
_("Used (over fair share)")._().
span().$class("qlegend ui-corner-all ui-state-default").
_("Max Capacity")._().
- _();
-
- List<FairSchedulerQueueInfo> subQueues = fsqinfo.fsinfo.getQueueInfos();
- for (FairSchedulerQueueInfo info : subQueues) {
- fsqinfo.qinfo = info;
- float capacity = info.getMaxResourcesFraction();
- float fairShare = info.getFairShareFraction();
- float used = info.getUsedFraction();
- ul.
- li().
- a(_Q).$style(width(capacity * Q_MAX_WIDTH)).
- $title(join("Fair Share:", percent(fairShare))).
- span().$style(join(Q_GIVEN, ";font-size:1px;", width(fairShare/capacity))).
- _('.')._().
- span().$style(join(width(used/capacity),
- ";font-size:1px;left:0%;", used > fairShare ? Q_OVER : Q_UNDER)).
- _('.')._().
- span(".q", info.getQueueName())._().
- span().$class("qstats").$style(left(Q_STATS_POS)).
- _(join(percent(used), " used"))._().
- ul("#lq").li()._(QueueInfoBlock.class)._()._().
- _();
- }
+ _().
+ li().
+ a(_Q).$style(width(Q_MAX_WIDTH)).
+ span().$style(join(width(used), ";left:0%;",
+ used > 1 ? Q_OVER : Q_UNDER))._(".")._().
+ span(".q", "root")._().
+ span().$class("qstats").$style(left(Q_STATS_POS)).
+ _(join(percent(used), " used"))._().
+ _(QueueBlock.class)._();
}
ul._()._().
script().$type("text/javascript").
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerInfo.java
index 4fe19ca13d1b5..e1fac4a2cf4da 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerInfo.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerInfo.java
@@ -18,33 +18,23 @@
package org.apache.hadoop.yarn.server.resourcemanager.webapp.dao;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
public class FairSchedulerInfo {
- private List<FairSchedulerQueueInfo> queueInfos;
private FairScheduler scheduler;
public FairSchedulerInfo(FairScheduler fs) {
scheduler = fs;
- Collection<FSLeafQueue> queues = fs.getQueueManager().getLeafQueues();
- queueInfos = new ArrayList<FairSchedulerQueueInfo>();
- for (FSLeafQueue queue : queues) {
- queueInfos.add(new FairSchedulerQueueInfo(queue, fs));
- }
- }
-
- public List<FairSchedulerQueueInfo> getQueueInfos() {
- return queueInfos;
}
public int getAppFairShare(ApplicationAttemptId appAttemptId) {
return scheduler.getSchedulerApp(appAttemptId).
getAppSchedulable().getFairShare().getMemory();
}
+
+ public FairSchedulerQueueInfo getRootQueueInfo() {
+ return new FairSchedulerQueueInfo(scheduler.getQueueManager().
+ getRootQueue(), scheduler);
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerLeafQueueInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerLeafQueueInfo.java
new file mode 100644
index 0000000000000..bee1cfd9866fc
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerLeafQueueInfo.java
@@ -0,0 +1,32 @@
+package org.apache.hadoop.yarn.server.resourcemanager.webapp.dao;
+
+import java.util.Collection;
+
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AppSchedulable;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue;
+
+public class FairSchedulerLeafQueueInfo extends FairSchedulerQueueInfo {
+ private int numPendingApps;
+ private int numActiveApps;
+
+ public FairSchedulerLeafQueueInfo(FSLeafQueue queue, FairScheduler scheduler) {
+ super(queue, scheduler);
+ Collection<AppSchedulable> apps = queue.getAppSchedulables();
+ for (AppSchedulable app : apps) {
+ if (app.getApp().isPending()) {
+ numPendingApps++;
+ } else {
+ numActiveApps++;
+ }
+ }
+ }
+
+ public int getNumActiveApplications() {
+ return numPendingApps;
+ }
+
+ public int getNumPendingApplications() {
+ return numActiveApps;
+ }
+}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerQueueInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerQueueInfo.java
index 35749427d007a..3cab1da33c0ad 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerQueueInfo.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/FairSchedulerQueueInfo.java
@@ -18,19 +18,18 @@
package org.apache.hadoop.yarn.server.resourcemanager.webapp.dao;
+
+import java.util.ArrayList;
import java.util.Collection;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.server.resourcemanager.resource.Resources;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.AppSchedulable;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSLeafQueue;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FSQueue;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.QueueManager;
-public class FairSchedulerQueueInfo {
- private int numPendingApps;
- private int numActiveApps;
-
+public class FairSchedulerQueueInfo {
private int fairShare;
private int minShare;
private int maxShare;
@@ -48,16 +47,9 @@ public class FairSchedulerQueueInfo {
private String queueName;
- public FairSchedulerQueueInfo(FSLeafQueue queue, FairScheduler scheduler) {
- Collection<AppSchedulable> apps = queue.getAppSchedulables();
- for (AppSchedulable app : apps) {
- if (app.getApp().isPending()) {
- numPendingApps++;
- } else {
- numActiveApps++;
- }
- }
-
+ private Collection<FairSchedulerQueueInfo> childInfos;
+
+ public FairSchedulerQueueInfo(FSQueue queue, FairScheduler scheduler) {
QueueManager manager = scheduler.getQueueManager();
queueName = queue.getName();
@@ -81,6 +73,16 @@ public FairSchedulerQueueInfo(FSLeafQueue queue, FairScheduler scheduler) {
fractionMinShare = (float)minShare / clusterMaxMem;
maxApps = manager.getQueueMaxApps(queueName);
+
+ Collection<FSQueue> childQueues = queue.getChildQueues();
+ childInfos = new ArrayList<FairSchedulerQueueInfo>();
+ for (FSQueue child : childQueues) {
+ if (child instanceof FSLeafQueue) {
+ childInfos.add(new FairSchedulerLeafQueueInfo((FSLeafQueue)child, scheduler));
+ } else {
+ childInfos.add(new FairSchedulerQueueInfo(child, scheduler));
+ }
+ }
}
/**
@@ -96,15 +98,7 @@ public float getFairShareFraction() {
public int getFairShare() {
return fairShare;
}
-
- public int getNumActiveApplications() {
- return numPendingApps;
- }
-
- public int getNumPendingApplications() {
- return numActiveApps;
- }
-
+
public Resource getMinResources() {
return minResources;
}
@@ -148,4 +142,8 @@ public float getUsedFraction() {
public float getMaxResourcesFraction() {
return (float)maxShare / clusterMaxMem;
}
+
+ public Collection<FairSchedulerQueueInfo> getChildQueues() {
+ return childInfos;
+ }
}
|
6e15ed3153e6fbcacd2b8798b9c5ebea29768210
|
kotlin
|
WithDeferredResolve removed (it was never used)--
|
p
|
https://github.com/JetBrains/kotlin
|
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java
index 01dab6767eb70..da643a50d59df 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/MutableClassDescriptorLite.java
@@ -37,8 +37,7 @@
/**
* @author Stepan Koltsov
*/
-public abstract class MutableClassDescriptorLite extends ClassDescriptorBase
- implements WithDeferredResolve {
+public abstract class MutableClassDescriptorLite extends ClassDescriptorBase {
private List<AnnotationDescriptor> annotations = Lists.newArrayList();
@@ -68,16 +67,6 @@ public MutableClassDescriptorLite(@NotNull DeclarationDescriptor containingDecla
this.kind = kind;
}
- @Override
- public void forceResolve() {
-
- }
-
- @Override
- public boolean isAlreadyResolved() {
- return false;
- }
-
@NotNull
@Override
public DeclarationDescriptor getContainingDeclaration() {
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/NamespaceDescriptorImpl.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/NamespaceDescriptorImpl.java
index e97dccd31d767..77345674a3657 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/NamespaceDescriptorImpl.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/NamespaceDescriptorImpl.java
@@ -28,7 +28,7 @@
/**
* @author abreslav
*/
-public class NamespaceDescriptorImpl extends AbstractNamespaceDescriptorImpl implements WithDeferredResolve {
+public class NamespaceDescriptorImpl extends AbstractNamespaceDescriptorImpl {
private WritableScope memberScope;
@@ -102,14 +102,4 @@ public ClassObjectStatus setClassObjectDescriptor(@NotNull MutableClassDescripto
return builder;
}
-
- @Override
- public void forceResolve() {
-
- }
-
- @Override
- public boolean isAlreadyResolved() {
- return false;
- }
}
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/WithDeferredResolve.java b/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/WithDeferredResolve.java
deleted file mode 100644
index da3177fa2e45b..0000000000000
--- a/compiler/frontend/src/org/jetbrains/jet/lang/descriptors/WithDeferredResolve.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Copyright 2010-2012 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.jetbrains.jet.lang.descriptors;
-
-/**
- * @author Nikolay Krasko
- */
-public interface WithDeferredResolve {
- void forceResolve();
- boolean isAlreadyResolved();
-}
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java
index bb5ec6502428e..ed81b3ddcba82 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TopDownAnalysisContext.java
@@ -47,7 +47,7 @@ public class TopDownAnalysisContext implements BodiesResolveContext {
// File scopes - package scope extended with imports
protected final Map<JetFile, WritableScope> namespaceScopes = Maps.newHashMap();
- public final Map<JetDeclarationContainer, WithDeferredResolve> forDeferredResolver = Maps.newHashMap();
+ public final Map<JetDeclarationContainer, DeclarationDescriptor> forDeferredResolver = Maps.newHashMap();
public final Map<JetDeclarationContainer, JetScope> normalScope = Maps.newHashMap();
diff --git a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeHierarchyResolver.java b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeHierarchyResolver.java
index 09edbc218c6c0..f207cd7a421be 100644
--- a/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeHierarchyResolver.java
+++ b/compiler/frontend/src/org/jetbrains/jet/lang/resolve/TypeHierarchyResolver.java
@@ -112,7 +112,7 @@ public void process(
JetDeclarationContainer declarationContainer = forDeferredResolve.poll();
assert declarationContainer != null;
- WithDeferredResolve descriptorForDeferredResolve = context.forDeferredResolver.get(declarationContainer);
+ DeclarationDescriptor descriptorForDeferredResolve = context.forDeferredResolver.get(declarationContainer);
JetScope scope = context.normalScope.get(declarationContainer);
// Even more temp code
@@ -668,12 +668,12 @@ private ConstructorDescriptorImpl createPrimaryConstructorForObject(
private void prepareForDeferredCall(
@NotNull JetScope outerScope,
- @NotNull WithDeferredResolve withDeferredResolve,
+ @NotNull DeclarationDescriptor descriptorForDeferredResolve,
@NotNull JetDeclarationContainer container
) {
forDeferredResolve.add(container);
context.normalScope.put(container, outerScope);
- context.forDeferredResolver.put(container, withDeferredResolve);
+ context.forDeferredResolver.put(container, descriptorForDeferredResolve);
}
@Nullable
|
d16dcfbbbeb30a6b65da2fd0e9b866ad3a148be4
|
arquillian$arquillian-graphene
|
ARQGRA-258: enrichment supports classes wrapping web elements
* Page fragment enricher doesn't throw an exception when it meets
field with abstract type or type with non empty constructor.
It skips these fields instead of throwing an exception.
* Added a new enricher which is able to inject fiels with @FindBy
annotation and type with constructor requiring web element.
* Unfortunately the new enrichment can't be used for injecting
fields with type org.openqa.selenium.support.ui.Select, because
the Select class accesses to the web element in its constructor
and the web element isn't available yet (page is not loaded for
example).
|
a
|
https://github.com/arquillian/arquillian-graphene
|
diff --git a/graphene-webdriver/graphene-webdriver-ftest/src/test/java/org/jboss/arquillian/graphene/enricher/TestWebElementWrapper.java b/graphene-webdriver/graphene-webdriver-ftest/src/test/java/org/jboss/arquillian/graphene/enricher/TestWebElementWrapper.java
new file mode 100644
index 000000000..1ce2a4213
--- /dev/null
+++ b/graphene-webdriver/graphene-webdriver-ftest/src/test/java/org/jboss/arquillian/graphene/enricher/TestWebElementWrapper.java
@@ -0,0 +1,92 @@
+/**
+ * JBoss, Home of Professional Open Source
+ * Copyright 2012, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.arquillian.graphene.enricher;
+
+import java.net.URL;
+import junit.framework.Assert;
+import org.jboss.arquillian.drone.api.annotation.Drone;
+import org.jboss.arquillian.junit.Arquillian;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.WebElement;
+import org.openqa.selenium.support.FindBy;
+
+/**
+ * @author <a href="mailto:[email protected]">Jan Papousek</a>
+ */
+@RunWith(Arquillian.class)
+public class TestWebElementWrapper {
+
+ @Drone
+ private WebDriver browser;
+
+ @FindBy(css="#root span")
+ private Wrapper1 wrapper1;
+
+ @FindBy(css="#root span")
+ private Wrapper2 wrapper2;
+
+ public void loadPage() {
+ URL page = this.getClass().getClassLoader().getResource("org/jboss/arquillian/graphene/ftest/enricher/sample.html");
+ browser.get(page.toString());
+ }
+
+ @Test
+ public void testInnerStaticClassWrapper() {
+ loadPage();
+ Assert.assertNotNull(wrapper1);
+ Assert.assertEquals("correct", wrapper1.getText());
+ }
+
+ @Test
+ public void testInnerClassWrapper() {
+ loadPage();
+ Assert.assertNotNull(wrapper2);
+ Assert.assertEquals("correct", wrapper2.getText());
+ }
+
+ private static class Wrapper1 {
+ private final WebElement element;
+
+ public Wrapper1(WebElement element) {
+ this.element = element;
+ }
+
+ public String getText() {
+ return element.getText();
+ }
+ }
+
+ private class Wrapper2 {
+ private final WebElement element;
+
+ public Wrapper2(WebElement element) {
+ this.element = element;
+ }
+
+ public String getText() {
+ return element.getText();
+ }
+ }
+
+}
diff --git a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/GrapheneExtension.java b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/GrapheneExtension.java
index 08a3f4a14..bbe48e2e0 100644
--- a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/GrapheneExtension.java
+++ b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/GrapheneExtension.java
@@ -29,7 +29,9 @@
import org.jboss.arquillian.graphene.enricher.PageFragmentEnricher;
import org.jboss.arquillian.graphene.enricher.PageObjectEnricher;
import org.jboss.arquillian.graphene.enricher.SeleniumResourceProvider;
+import org.jboss.arquillian.graphene.enricher.WebElementWrapperEnricher;
import org.jboss.arquillian.graphene.enricher.WebElementEnricher;
+import org.jboss.arquillian.graphene.enricher.WrapsElementInterceptor;
import org.jboss.arquillian.graphene.page.extension.GraphenePageExtensionRegistrar;
import org.jboss.arquillian.graphene.spi.enricher.SearchContextTestEnricher;
import org.jboss.arquillian.test.spi.TestEnricher;
@@ -49,6 +51,7 @@ public void register(ExtensionBuilder builder) {
builder.service(SearchContextTestEnricher.class, WebElementEnricher.class);
builder.service(SearchContextTestEnricher.class, PageFragmentEnricher.class);
builder.service(SearchContextTestEnricher.class, PageObjectEnricher.class);
+ builder.service(SearchContextTestEnricher.class, WebElementWrapperEnricher.class);
/** Javascript enrichment */
builder.service(TestEnricher.class, JavaScriptEnricher.class);
/** Page Extensions */
diff --git a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/AbstractSearchContextEnricher.java b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/AbstractSearchContextEnricher.java
index 44996a6a7..609a06471 100644
--- a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/AbstractSearchContextEnricher.java
+++ b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/AbstractSearchContextEnricher.java
@@ -33,6 +33,7 @@
import org.jboss.arquillian.core.api.Instance;
import org.jboss.arquillian.core.api.annotation.Inject;
import org.jboss.arquillian.core.spi.ServiceLoader;
+import org.jboss.arquillian.core.spi.Validate;
import org.jboss.arquillian.graphene.enricher.exception.GrapheneTestEnricherException;
import org.jboss.arquillian.graphene.spi.enricher.SearchContextTestEnricher;
import org.jboss.arquillian.test.spi.TestEnricher;
@@ -40,7 +41,7 @@
/**
* This class should help you to implement {@link SearchContextTestEnricher}.
- *
+ *
* @author <a href="mailto:[email protected]">Juraj Huska</a>
* @author <a href="mailto:[email protected]">Jan Papousek</a>
*/
@@ -57,7 +58,7 @@ public abstract class AbstractSearchContextEnricher implements SearchContextTest
/**
* Performs further enrichment on the given instance with the given search context. That means all instances
* {@link TestEnricher} and {@link SearchContextTestEnricher} are invoked.
- *
+ *
* @param searchContext
* @param target
*/
@@ -76,7 +77,7 @@ protected final void enrichRecursively(SearchContext searchContext, Object targe
* It loads a real type of a field defined by parametric type. It searches in declaring class and super class. E. g. if a
* field is declared as 'A fieldName', It tries to find type parameter called 'A' in super class declaration and its
* evaluation in the class declaring the given field.
- *
+ *
* @param field
* @param testCase
* @return type of the given field
@@ -104,7 +105,7 @@ protected final Class<?> getActualType(Field field, Object testCase) {
/**
* It loads the concrete type of list items. E.g. for List<String>, String is returned.
- *
+ *
* @param listField
* @return
* @throws ClassNotFoundException
@@ -115,7 +116,7 @@ protected final Class<?> getListType(Field listField) throws ClassNotFoundExcept
/**
* Initialize given class.
- *
+ *
* @param clazz to be initialized
* @throws IllegalAccessException
* @throws InstantiationException
@@ -124,29 +125,43 @@ protected final Class<?> getListType(Field listField) throws ClassNotFoundExcept
* @throws SecurityException
* @throws NoSuchMethodException
*/
- protected final <T> T instantiate(Class<T> clazz) throws NoSuchMethodException, SecurityException, InstantiationException,
+ protected final <T> T instantiate(Class<T> clazz, Object... args) throws NoSuchMethodException, SecurityException, InstantiationException,
IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Class<?> outerClass = clazz.getDeclaringClass();
+ // load constructor and rea; arguments
// check whether declared page object is not nested class
- if (outerClass != null && !Modifier.isStatic(clazz.getModifiers())) {
- Constructor<T> construtor = clazz.getDeclaredConstructor(outerClass);
- if (!construtor.isAccessible()) {
- construtor.setAccessible(true);
+ Class<?>[] argTypes;
+ Object[] realArgs;
+ if (outerClass == null || Modifier.isStatic(clazz.getModifiers())) {
+ argTypes = new Class<?>[args.length];
+ realArgs = args;
+ for (int i=0; i<args.length; i++) {
+ argTypes[i] = args[i].getClass();
}
-
- Object outerObject = instantiate(outerClass);
-
- return construtor.newInstance(new Object[] { outerObject });
-
} else {
- Constructor<T> construtor = clazz.getDeclaredConstructor();
- if (!construtor.isAccessible()) {
- construtor.setAccessible(true);
+ argTypes = new Class<?>[args.length + 1];
+ realArgs = new Object[args.length + 1];
+ argTypes[0] = outerClass;
+ realArgs[0] = instantiate(outerClass);
+ for (int i=0; i<args.length; i++) {
+ argTypes[i+1] = args[i].getClass();
+ realArgs[i+1] = args[i];
}
- return construtor.newInstance();
}
+ Constructor<T> construtor;
+ if (ReflectionHelper.hasConstructor(clazz, argTypes)) {
+ construtor = clazz.getDeclaredConstructor(argTypes);
+ } else {
+ construtor = ReflectionHelper.getAssignableConstructor(clazz, argTypes);
+ }
+ // instantiate
+ if (!construtor.isAccessible()) {
+ construtor.setAccessible(true);
+ }
+
+ return construtor.newInstance(realArgs);
}
protected final void setValue(Field field, Object target, Object value) {
diff --git a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/PageFragmentEnricher.java b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/PageFragmentEnricher.java
index 412aca77c..def142ead 100644
--- a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/PageFragmentEnricher.java
+++ b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/PageFragmentEnricher.java
@@ -21,6 +21,7 @@
*/
package org.jboss.arquillian.graphene.enricher;
+import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
@@ -72,7 +73,20 @@ public void enrich(SearchContext searchContext, Object target) {
}
protected final boolean isPageFragmentClass(Class<?> clazz) {
- return !clazz.isInterface() && !Modifier.isFinal(clazz.getModifiers()) && !Modifier.isInterface(clazz.getModifiers());
+ // check whether it isn't interface or final class
+ if (Modifier.isInterface(clazz.getModifiers()) || Modifier.isFinal(clazz.getModifiers()) || Modifier.isAbstract(clazz.getModifiers())) {
+ return false;
+ }
+
+ Class<?> outerClass = clazz.getDeclaringClass();
+
+ // check whether there is an empty constructor
+ if (outerClass == null || Modifier.isStatic(clazz.getModifiers())) {
+ return ReflectionHelper.hasConstructor(clazz);
+ // check whether there is an empty constructor with outer class
+ } else {
+ return ReflectionHelper.hasConstructor(clazz, outerClass);
+ }
}
protected final <T> List<T> createPageFragmentList(final Class<T> clazz, final SearchContext searchContext, final By rootBy) {
diff --git a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/ReflectionHelper.java b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/ReflectionHelper.java
index b5bbe9ba4..3e9e71565 100644
--- a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/ReflectionHelper.java
+++ b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/ReflectionHelper.java
@@ -25,6 +25,7 @@
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
/**
@@ -96,6 +97,34 @@ public Constructor<?> run() throws NoSuchMethodException {
}
}
+ public static <T> Constructor<T> getAssignableConstructor(final Class<T> clazz, final Class<?>... argumentTypes) throws NoSuchMethodException {
+ for (Constructor constructor: clazz.getDeclaredConstructors()) {
+ if (constructor.getParameterTypes().length != argumentTypes.length) {
+ continue;
+ }
+ boolean found = true;
+ for (int i=0; i<argumentTypes.length; i++) {
+ if (!constructor.getParameterTypes()[i].isAssignableFrom(argumentTypes[i])) {
+ found = false;
+ break;
+ }
+ }
+ if (found) {
+ return constructor;
+ }
+ }
+ throw new NoSuchMethodException("There is no constructor in class " + clazz.getName() + " with arguments " + Arrays.toString(argumentTypes));
+ }
+
+ public static boolean hasConstructor(final Class<?> clazz, final Class<?>... argumentTypes) {
+ try {
+ clazz.getDeclaredConstructor(argumentTypes);
+ return true;
+ } catch(NoSuchMethodException ignored) {
+ return false;
+ }
+ }
+
/**
* Create a new instance by finding a constructor that matches the argumentTypes signature using the arguments for
* instantiation.
diff --git a/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/WebElementWrapperEnricher.java b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/WebElementWrapperEnricher.java
new file mode 100644
index 000000000..75834f588
--- /dev/null
+++ b/graphene-webdriver/graphene-webdriver-impl/src/main/java/org/jboss/arquillian/graphene/enricher/WebElementWrapperEnricher.java
@@ -0,0 +1,46 @@
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package org.jboss.arquillian.graphene.enricher;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.List;
+import org.jboss.arquillian.graphene.enricher.exception.GrapheneTestEnricherException;
+import org.jboss.arquillian.graphene.enricher.findby.FindByUtilities;
+import org.openqa.selenium.By;
+import org.openqa.selenium.SearchContext;
+import org.openqa.selenium.WebElement;
+
+/**
+ * @author <a href="mailto:[email protected]">Jan Papousek</a>
+ */
+public class WebElementWrapperEnricher extends AbstractWebElementEnricher {
+
+ @Override
+ public void enrich(SearchContext searchContext, Object target) {
+ List<Field> fields = FindByUtilities.getListOfFieldsAnnotatedWithFindBys(target);
+ for (Field field: fields) {
+ if (isValidClass(field.getType())) {
+ By rootBy = FindByUtilities.getCorrectBy(field);
+ try {
+ Object component = instantiate(field.getType(), createWebElement(rootBy, searchContext));
+ setValue(field, target, component);
+ } catch (Exception e) {
+ throw new GrapheneTestEnricherException("Can't set a value to the " + target.getClass() + "." + field.getName() + ".", e);
+ }
+ }
+ }
+ }
+
+ protected final boolean isValidClass(Class<?> clazz) {
+ Class<?> outerClass = clazz.getDeclaringClass();
+ if (outerClass == null || Modifier.isStatic(clazz.getModifiers())) {
+ return ReflectionHelper.hasConstructor(clazz, WebElement.class);
+ } else {
+ return ReflectionHelper.hasConstructor(clazz, outerClass, WebElement.class);
+ }
+ }
+
+}
diff --git a/graphene-webdriver/graphene-webdriver-impl/src/test/java/org/jboss/arquillian/graphene/enricher/TestPageFragmentEnricher.java b/graphene-webdriver/graphene-webdriver-impl/src/test/java/org/jboss/arquillian/graphene/enricher/TestPageFragmentEnricher.java
index aae3c001e..36a02cacb 100644
--- a/graphene-webdriver/graphene-webdriver-impl/src/test/java/org/jboss/arquillian/graphene/enricher/TestPageFragmentEnricher.java
+++ b/graphene-webdriver/graphene-webdriver-impl/src/test/java/org/jboss/arquillian/graphene/enricher/TestPageFragmentEnricher.java
@@ -1,8 +1,3 @@
-package org.jboss.arquillian.graphene.enricher;
-
-import org.jboss.arquillian.graphene.enricher.exception.PageFragmentInitializationException;
-import org.jboss.arquillian.graphene.enricher.fragment.AbstractPageFragmentStub;
-import org.jboss.arquillian.graphene.enricher.fragment.WrongPageFragmentMissingNoArgConstructor;
/**
* JBoss, Home of Professional Open Source
* Copyright 2012, Red Hat, Inc. and individual contributors
@@ -24,6 +19,12 @@
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
+package org.jboss.arquillian.graphene.enricher;
+
+import junit.framework.Assert;
+import org.jboss.arquillian.graphene.enricher.exception.PageFragmentInitializationException;
+import org.jboss.arquillian.graphene.enricher.fragment.AbstractPageFragmentStub;
+import org.jboss.arquillian.graphene.enricher.fragment.WrongPageFragmentMissingNoArgConstructor;
import org.jboss.arquillian.graphene.enricher.fragment.WrongPageFragmentTooManyRoots;
import org.junit.Test;
import org.openqa.selenium.support.FindBy;
@@ -36,8 +37,9 @@ public class TestPageFragmentEnricher extends AbstractGrapheneEnricherTest {
@Test
public void testMissingNoArgConstructor() {
- thrown.expect(PageFragmentInitializationException.class);
- getGrapheneEnricher().enrich(new NoArgConstructorTest());
+ NoArgConstructorTest target = new NoArgConstructorTest();
+ getGrapheneEnricher().enrich(target);
+ Assert.assertNull(target.pageFragment);
}
@Test
@@ -54,8 +56,9 @@ public void testTooManyRoots() {
@Test
public void testAbstractType() {
- thrown.expect(PageFragmentInitializationException.class);
- getGrapheneEnricher().enrich(new AbstractTypeTest());
+ AbstractTypeTest target = new AbstractTypeTest();
+ getGrapheneEnricher().enrich(target);
+ Assert.assertNull(target.pageFragment);
}
public static class NoArgConstructorTest {
|
ccc5ad71f9b1aa5bad97291997710009022f942b
|
Search_api
|
Issue #1372092 by drunken monkey: Added an error message when no service class is available when creating a server.
|
a
|
https://github.com/lucidworks/drupal_search_api
|
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index d60ece86..cfd33577 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,5 +1,7 @@
Search API 1.x, dev (xx/xx/xxxx):
---------------------------------
+- #1372092 by drunken monkey: Added an error message when no service class is
+ available when creating a server.
- #2305627 by drunken monkey, cpliakas: Fixed date facets not displayed when
the configured granularity is larger than the calculated granularity.
- #2319263 by solotandem: Added easier way to subclass entity classes.
diff --git a/search_api.admin.inc b/search_api.admin.inc
index a145ec7e..cb85e563 100644
--- a/search_api.admin.inc
+++ b/search_api.admin.inc
@@ -252,6 +252,13 @@ function search_api_admin_add_server(array $form, array &$form_state) {
$form['options']['#prefix'] = '<div id="search-api-class-options">';
$form['options']['#suffix'] = '</div>';
+ // If $info is not set, there are no service classes. Display an error message
+ // telling the user how to change that and return an empty form.
+ if (!isset($info)) {
+ drupal_set_message(t('There are no service classes available for the Search API. Please install a <a href="@url">module that provides a service class</a> to proceed.', array('@url' => url('https://www.drupal.org/node/1254698'))), 'error');
+ return array();
+ }
+
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Create server'),
|
d0441857cd6853975d83c612bbd2778b51007db8
|
elasticsearch
|
Fix typo in Hunspell logging--
|
c
|
https://github.com/elastic/elasticsearch
|
diff --git a/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java b/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java
index f2ea0e37398fa..08e9ea9fa900c 100644
--- a/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java
+++ b/src/main/java/org/elasticsearch/indices/analysis/HunspellService.java
@@ -140,7 +140,7 @@ private void scanAndLoadDictionaries() {
*/
private Dictionary loadDictionary(String locale, Settings nodeSettings, Environment env) throws Exception {
if (logger.isDebugEnabled()) {
- logger.debug("Loading huspell dictionary [{}]...", locale);
+ logger.debug("Loading hunspell dictionary [{}]...", locale);
}
File dicDir = new File(hunspellDir, locale);
if (!dicDir.exists() || !dicDir.isDirectory()) {
|
f128dc6ce8b5fa81a4f56972b80af18e89f46d98
|
frontlinesms-credit$plugin-paymentview
|
Now we have the functionality extended to the UI...
|
p
|
https://github.com/frontlinesms-credit/plugin-paymentview
|
diff --git a/src/main/java/net/frontlinesms/payment/PaymentServiceStartedNotification.java b/src/main/java/net/frontlinesms/payment/PaymentServiceStartedNotification.java
new file mode 100644
index 00000000..e0cda1ef
--- /dev/null
+++ b/src/main/java/net/frontlinesms/payment/PaymentServiceStartedNotification.java
@@ -0,0 +1,6 @@
+package net.frontlinesms.payment;
+
+import net.frontlinesms.events.FrontlineEventNotification;
+
+public class PaymentServiceStartedNotification implements FrontlineEventNotification {
+}
diff --git a/src/main/java/net/frontlinesms/payment/safaricom/MpesaPaymentService.java b/src/main/java/net/frontlinesms/payment/safaricom/MpesaPaymentService.java
index 71dd677d..1f6a7437 100644
--- a/src/main/java/net/frontlinesms/payment/safaricom/MpesaPaymentService.java
+++ b/src/main/java/net/frontlinesms/payment/safaricom/MpesaPaymentService.java
@@ -48,6 +48,9 @@ public abstract class MpesaPaymentService implements PaymentService, EventObserv
protected static final String PAID_BY_PATTERN = "([A-Za-z ]+)";
protected static final String ACCOUNT_NUMBER_PATTERN = "Account Number [\\d]+";
protected static final String RECEIVED_FROM = "received from";
+
+ private static final int BALANCE_ENQUIRY_CHARGE = 1;
+ private static final BigDecimal BD_BALANCE_ENQUIRY_CHARGE = new BigDecimal(BALANCE_ENQUIRY_CHARGE);
//> INSTANCE PROPERTIES
protected Logger pvLog;
@@ -63,7 +66,7 @@ public abstract class MpesaPaymentService implements PaymentService, EventObserv
//> FIELDS
private String pin;
protected Balance balance;
- private EventBus eventBus;
+ protected EventBus eventBus;
private TargetAnalytics targetAnalytics;
//> STK & PAYMENT ACCOUNT
@@ -247,6 +250,30 @@ public void run() {
}.execute();
}
+ protected void processBalance(final FrontlineMessage message){
+ //TODO: On first run, should the user be told to update the
+ //balance by making an enquiry to M-PESA, or?
+ new PaymentJob() {
+ public void run() {
+ performBalanceEnquiryFraudCheck(message);
+ }
+ }.execute();
+ }
+
+ synchronized void performBalanceEnquiryFraudCheck(final FrontlineMessage message) {
+ BigDecimal tempBalance = balance.getBalanceAmount();
+ BigDecimal expectedBalance = tempBalance.subtract(BD_BALANCE_ENQUIRY_CHARGE);
+
+ BigDecimal actualBalance = getAmount(message);
+ informUserOnFraud(expectedBalance, actualBalance, !expectedBalance.equals(actualBalance));
+
+ balance.setBalanceAmount(actualBalance);
+ balance.setConfirmationMessage(getConfirmationCode(message));
+ balance.setDateTime(getTimePaid(message));
+ balance.setBalanceUpdateMethod("BalanceEnquiry");
+ balance.updateBalance();
+ }
+
synchronized void performIncominPaymentFraudCheck(final FrontlineMessage message,
final IncomingPayment payment) {
//check is: Let Previous Balance be p, Current Balance be c and Amount received be a
@@ -266,7 +293,9 @@ synchronized void performIncominPaymentFraudCheck(final FrontlineMessage message
void informUserOnFraud(BigDecimal expected, BigDecimal actual, boolean fraudCommited) {
if (fraudCommited) {
- pvLog.warn("Fraud commited? Was Expecting: "+expected+", But was "+actual);
+ String message = "Fraud commited? Was expecting balance as: "+expected+", But was "+actual;
+ pvLog.warn(message);
+ this.eventBus.notifyObservers(new BalanceFraudNotification(message));
}else{
pvLog.info("No Fraud occured!");
}
@@ -279,7 +308,6 @@ private boolean isValidIncomingPaymentConfirmation(final FrontlineMessage messag
return isMessageTextValid(message.getTextContent());
}
- abstract void processBalance(FrontlineMessage message);
abstract Date getTimePaid(FrontlineMessage message);
abstract boolean isMessageTextValid(String message);
abstract Account getAccount(FrontlineMessage message);
@@ -405,8 +433,12 @@ public void initDaosAndServices(final PaymentViewPluginController pluginControll
this.targetAnalytics = pluginController.getTargetAnalytics();
this.balance = Balance.getInstance().getLatest();
- this.balance.setEventBus(pluginController.getUiGeneratorController()
- .getFrontlineController().getEventBus());
+ this.registerToEventBus(
+ pluginController.getUiGeneratorController()
+ .getFrontlineController().getEventBus()
+ );
+
+ this.balance.setEventBus(this.eventBus);
//Would like to test using the log...
this.pvLog = pluginController.getLogger(this.getClass());
}
@@ -423,4 +455,10 @@ public String createAccountNumber(){
}
return accountNumberGeneratedStr;
}
+
+ public class BalanceFraudNotification implements FrontlineEventNotification{
+ private final String message;
+ public BalanceFraudNotification(String message){this.message=message;}
+ public String getMessage(){return message;}
+ }
}
\ No newline at end of file
diff --git a/src/main/java/net/frontlinesms/payment/safaricom/MpesaPersonalService.java b/src/main/java/net/frontlinesms/payment/safaricom/MpesaPersonalService.java
index 34c42839..88fca9f7 100644
--- a/src/main/java/net/frontlinesms/payment/safaricom/MpesaPersonalService.java
+++ b/src/main/java/net/frontlinesms/payment/safaricom/MpesaPersonalService.java
@@ -16,8 +16,6 @@
public class MpesaPersonalService extends MpesaPaymentService {
- private static final int BALANCE_ENQUIRY_CHARGE = 1;
- private static final BigDecimal BD_BALANCE_ENQUIRY_CHARGE = new BigDecimal(BALANCE_ENQUIRY_CHARGE);
//> REGEX PATTERN CONSTANTS
private static final String STR_PERSONAL_INCOMING_PAYMENT_REGEX_PATTERN = "[A-Z0-9]+ Confirmed.\n" +
"You have received Ksh[,|.|\\d]+ from\n([A-Za-z ]+) 2547[\\d]{8}\non " +
@@ -45,30 +43,6 @@ protected boolean isValidBalanceMessage(FrontlineMessage message){
return BALANCE_REGEX_PATTERN.matcher(message.getTextContent()).matches();
}
- protected void processBalance(final FrontlineMessage message){
- //TODO: On first run, the user should be told to update the
- //Balance by sending a request to M-PESA, or?
- new PaymentJob() {
- public void run() {
- performBalanceEnquiryFraudCheck(message);
- }
- }.execute();
- }
-
- private synchronized void performBalanceEnquiryFraudCheck(final FrontlineMessage message) {
- BigDecimal tempBalance = balance.getBalanceAmount();
- BigDecimal expectedBalance = getAmount(message);
-
- BigDecimal actual = tempBalance.subtract(BD_BALANCE_ENQUIRY_CHARGE);
- informUserOnFraud(expectedBalance, actual, !expectedBalance.equals(actual));
-
- balance.setBalanceAmount(expectedBalance);
- balance.setConfirmationMessage(getConfirmationCode(message));
- balance.setDateTime(getTimePaid(message));
- balance.setBalanceUpdateMethod("BalanceEnquiry");
- balance.updateBalance();
- }
-
@Override
protected void processMessage(final FrontlineMessage message) {
super.processMessage(message);
diff --git a/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/SettingsTabHandler.java b/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/SettingsTabHandler.java
index ca6228dd..70dc6197 100644
--- a/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/SettingsTabHandler.java
+++ b/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/SettingsTabHandler.java
@@ -6,7 +6,10 @@
import net.frontlinesms.events.FrontlineEventNotification;
import net.frontlinesms.payment.PaymentService;
import net.frontlinesms.payment.PaymentServiceException;
+import net.frontlinesms.payment.PaymentServiceStartedNotification;
import net.frontlinesms.payment.safaricom.MpesaPaymentService;
+import net.frontlinesms.payment.safaricom.MpesaPaymentService.BalanceFraudNotification;
+import net.frontlinesms.ui.UiDestroyEvent;
import net.frontlinesms.ui.UiGeneratorController;
import net.frontlinesms.ui.events.FrontlineUiUpateJob;
import net.frontlinesms.ui.handler.BaseTabHandler;
@@ -17,6 +20,7 @@
import org.creditsms.plugins.paymentview.userhomepropeties.payment.balance.Balance.BalanceEventNotification;
public class SettingsTabHandler extends BaseTabHandler implements EventObserver{
+ private static final String BTN_CREATE_NEW_SERVICE = "btn_createNewService";
private static final String COMPONENT_SETTINGS_TABLE = "tbl_accounts";
private static final String XML_SETTINGS_TAB = "/ui/plugins/paymentview/settings/settingsTab.xml";
@@ -82,11 +86,19 @@ public void deleteAccount() {
public void notify(final FrontlineEventNotification notification) {
new FrontlineUiUpateJob() {
public void run() {
- if (!(notification instanceof BalanceEventNotification)) {
- return;
- }else{
+ if (notification instanceof BalanceEventNotification) {
ui.alert(((BalanceEventNotification)notification).getMessage());
SettingsTabHandler.this.refresh();
+ }else if (notification instanceof PaymentServiceStartedNotification) {
+ SettingsTabHandler.this.refresh();
+ ui.setEnabled(ui.find(settingsTab, BTN_CREATE_NEW_SERVICE), false);
+ }else if(notification instanceof BalanceFraudNotification){
+ ui.alert(((BalanceFraudNotification)notification).getMessage());
+ SettingsTabHandler.this.refresh();//Hoping this will be moved to the new Log Tab
+ }else if (notification instanceof UiDestroyEvent) {
+ if(((UiDestroyEvent) notification).isFor(ui)) {
+ ui.getFrontlineController().getEventBus().unregisterObserver(SettingsTabHandler.this);
+ }
}
}
}.execute();
diff --git a/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/dialogs/steps/createnewsettings/EnterPinDialog.java b/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/dialogs/steps/createnewsettings/EnterPinDialog.java
index b41a2004..fc2dcbca 100644
--- a/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/dialogs/steps/createnewsettings/EnterPinDialog.java
+++ b/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/dialogs/steps/createnewsettings/EnterPinDialog.java
@@ -1,6 +1,8 @@
package org.creditsms.plugins.paymentview.ui.handler.tabsettings.dialogs.steps.createnewsettings;
+import net.frontlinesms.events.EventBus;
import net.frontlinesms.messaging.sms.modem.SmsModem;
+import net.frontlinesms.payment.PaymentServiceStartedNotification;
import net.frontlinesms.payment.safaricom.MpesaPaymentService;
import net.frontlinesms.ui.UiGeneratorController;
@@ -60,7 +62,10 @@ public void setUpThePaymentService(final String pin, final String vPin) {
}
public void create() {
- ui.getFrontlineController().getEventBus().registerObserver(paymentService);
+ EventBus eventBus = ui.getFrontlineController().getEventBus();
+ eventBus.registerObserver(paymentService);
+ eventBus.notifyObservers(new PaymentServiceStartedNotification());
+
pluginController.setPaymentService(paymentService);
ui.alert("The Payment service has been created successfully!");
removeDialog(ui.find(DLG_VERIFICATION_CODE));
@@ -74,7 +79,7 @@ private boolean checkValidityOfPinFields(String pin, String vPin){
public void assertMaxLength(Object component) {
String text = ui.getText(component);
if(text.length() > EXPECTED_PIN_LENGTH) {
- ui.setText(component, text.substring(0, EXPECTED_PIN_LENGTH - 1));
+ ui.setText(component, text.substring(0, EXPECTED_PIN_LENGTH));
}
}
}
diff --git a/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/dialogs/steps/createnewsettings/MobilePaymentServiceSettingsInitialisationDialog.java b/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/dialogs/steps/createnewsettings/MobilePaymentServiceSettingsInitialisationDialog.java
index 6f440cde..78a9902c 100644
--- a/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/dialogs/steps/createnewsettings/MobilePaymentServiceSettingsInitialisationDialog.java
+++ b/src/main/java/org/creditsms/plugins/paymentview/ui/handler/tabsettings/dialogs/steps/createnewsettings/MobilePaymentServiceSettingsInitialisationDialog.java
@@ -38,14 +38,12 @@ private Object getComboChoice(SmsModem s) {
}
private void setUpPaymentServices(Object cmbSelectPaymentService) {
- //TODO: We should think of having modules at this case;Some Metaprogramming in the house!!
MpesaPaymentService mpesaPersonal = new MpesaPersonalService();
Object comboboxChoice1 = ui.createComboboxChoice(mpesaPersonal.toString(), mpesaPersonal);
MpesaPaymentService mpesaPaybill = new MpesaPayBillService();
Object comboboxChoice2 = ui.createComboboxChoice(mpesaPaybill.toString(), mpesaPaybill);
-
ui.add(cmbSelectPaymentService, comboboxChoice1);
ui.add(cmbSelectPaymentService, comboboxChoice2);
}
@@ -64,7 +62,7 @@ public void next() {
}
private void cleanUp() {
- //Memory Leaks; Should the Payment Services be Singletons
+ //Memory Leaks; Should the Payment Services be Singletons?
}
//> ACCESSORS
diff --git a/src/main/resources/ui/plugins/paymentview/settings/settingsTab.xml b/src/main/resources/ui/plugins/paymentview/settings/settingsTab.xml
index d5b7b677..adb1e9d2 100644
--- a/src/main/resources/ui/plugins/paymentview/settings/settingsTab.xml
+++ b/src/main/resources/ui/plugins/paymentview/settings/settingsTab.xml
@@ -4,10 +4,7 @@
columns="1" gap="10">
<panel columns="1" gap="5" name="pnl_accounts" weightx="1"
weighty="1">
- <panel weightx="1">
- <label text="Mobile Payment Account Settings" font="20 Bold"/>
- <button name="refresh" action="refresh" text="Refresh"/>
- </panel>
+ <label text="Mobile Payment Account Settings" font="20 Bold" weightx="1"/>
<table name="tbl_accounts" weightx="1" weighty="1" delete="showConfirmationDialog('deleteAccount')">
<header>
<column text="i18n.common.port" width="200" icon="/icons/port_open.png"/>
@@ -27,7 +24,7 @@
</panel>
<panel gap="5" bottom="5" name="pnl_buttons"
weightx="1">
- <button name="btn_analyse" icon="/icons/keyword_add.png" text="i18n.plugins.paymentview.action.createnew" action="createNew" />
+ <button name="btn_createNewService" icon="/icons/keyword_add.png" text="i18n.plugins.paymentview.action.createnew" action="createNew" />
<panel weightx="1"/>
<panel weightx="1"/>
<button action="updateAccountBalance" icon="/icons/connection.png" halign="right" name="btn_export"
diff --git a/src/test/java/net/frontlinesms/payment/safaricom/MpesaPaymentServiceTest.java b/src/test/java/net/frontlinesms/payment/safaricom/MpesaPaymentServiceTest.java
index 9d7f1d6f..4b581780 100644
--- a/src/test/java/net/frontlinesms/payment/safaricom/MpesaPaymentServiceTest.java
+++ b/src/test/java/net/frontlinesms/payment/safaricom/MpesaPaymentServiceTest.java
@@ -156,7 +156,7 @@ private void setUpDaos() {
FrontlineSMS fsms = mock(FrontlineSMS.class);
EventBus eventBus = mock(EventBus.class);
-
+ mpesaPaymentService.registerToEventBus(eventBus);
when(fsms.getEventBus()).thenReturn(eventBus);
when(ui.getFrontlineController()).thenReturn(fsms);
|
fd6b6d067bd20b0b9a2aa76fe529252f0356b780
|
tapiji
|
Fixes some critical auto-complete issues.
Addresses Issue 62
Open issues:
* Calling auto-complete in the middle of a string, leads to wrong outcome.
* Calling auto-complete in bundle context (without string literal context) leads to wrong result.
|
c
|
https://github.com/tapiji/tapiji
|
diff --git a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/auditor/ResourceAuditVisitor.java b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/auditor/ResourceAuditVisitor.java
index 76f07c62..efc84115 100644
--- a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/auditor/ResourceAuditVisitor.java
+++ b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/auditor/ResourceAuditVisitor.java
@@ -28,210 +28,212 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-
/**
* @author Martin
- *
+ *
*/
public class ResourceAuditVisitor extends ASTVisitor implements
- IResourceVisitor {
-
- private List<SLLocation> constants;
- private List<SLLocation> brokenStrings;
- private List<SLLocation> brokenRBReferences;
- private SortedMap<Long, IRegion> rbDefReferences = new TreeMap<Long, IRegion>();
- private SortedMap<Long, IRegion> keyPositions = new TreeMap<Long, IRegion>();
- private Map<IRegion, String> bundleKeys = new HashMap<IRegion, String>();
- private Map<IRegion, String> bundleReferences = new HashMap<IRegion, String>();
- private IFile file;
- private Map<IVariableBinding, VariableDeclarationFragment> variableBindingManagers = new HashMap<IVariableBinding, VariableDeclarationFragment>();
- private ResourceBundleManager manager;
-
- public ResourceAuditVisitor(IFile file, ResourceBundleManager manager) {
- constants = new ArrayList<SLLocation>();
- brokenStrings = new ArrayList<SLLocation>();
- brokenRBReferences = new ArrayList<SLLocation>();
- this.file = file;
- this.manager = manager;
- }
-
- public boolean visit(VariableDeclarationStatement varDeclaration) {
- for (Iterator<VariableDeclarationFragment> itFrag = varDeclaration
- .fragments().iterator(); itFrag.hasNext();) {
- VariableDeclarationFragment fragment = itFrag.next();
- parseVariableDeclarationFragment(fragment);
- }
- return true;
- }
-
- public boolean visit(FieldDeclaration fieldDeclaration) {
- for (Iterator<VariableDeclarationFragment> itFrag = fieldDeclaration
- .fragments().iterator(); itFrag.hasNext();) {
- VariableDeclarationFragment fragment = itFrag.next();
- parseVariableDeclarationFragment(fragment);
- }
- return true;
- }
-
- protected void parseVariableDeclarationFragment(
- VariableDeclarationFragment fragment) {
- IVariableBinding vBinding = fragment.resolveBinding();
- this.variableBindingManagers.put(vBinding, fragment);
- }
-
- public boolean visit(StringLiteral stringLiteral) {
- try {
- if (stringLiteral.getLiteralValue().trim().length() == 0)
- return true;
-
- ASTNode parent = stringLiteral.getParent();
-
- if (parent instanceof MethodInvocation) {
- MethodInvocation methodInvocation = (MethodInvocation) parent;
-
- IRegion region = new Region(stringLiteral.getStartPosition(),
- stringLiteral.getLength());
-
- // Check if this method invokes the getString-Method on a
- // ResourceBundle Implementation
- if (ASTutils.isMatchingMethodParamDesc(methodInvocation, stringLiteral,
- ASTutils.getRBAccessorDesc())) {
- // Check if the given Resource-Bundle reference is broken
- SLLocation rbName = ASTutils.resolveResourceBundleLocation(methodInvocation,
- ASTutils.getRBDefinitionDesc(), variableBindingManagers);
- if (rbName == null
- || manager.isKeyBroken(rbName.getLiteral(), stringLiteral
- .getLiteralValue())) {
- // report new problem
- SLLocation desc = new SLLocation(file, stringLiteral
- .getStartPosition(), stringLiteral
- .getStartPosition()
- + stringLiteral.getLength(), stringLiteral
- .getLiteralValue());
- desc.setData(rbName);
- brokenStrings.add(desc);
- }
-
- // store position of resource-bundle access
- keyPositions.put(Long.valueOf(stringLiteral
- .getStartPosition()), region);
- bundleKeys.put(region, stringLiteral.getLiteralValue());
- bundleReferences.put(region, rbName.getLiteral());
- return false;
- } else if (ASTutils.isMatchingMethodParamDesc(methodInvocation,
- stringLiteral, ASTutils.getRBDefinitionDesc())) {
- rbDefReferences.put(Long.valueOf(stringLiteral
- .getStartPosition()), region);
- boolean referenceBroken = true;
- for (String bundle : manager.getResourceBundleIdentifiers()) {
- if (bundle.trim().equals(stringLiteral.getLiteralValue())) {
- referenceBroken = false;
- }
- }
- if (referenceBroken) {
- this.brokenRBReferences.add(new SLLocation(file, stringLiteral
- .getStartPosition(), stringLiteral
- .getStartPosition()
- + stringLiteral.getLength(), stringLiteral
- .getLiteralValue()));
- }
-
- return false;
- }
- }
-
- // check if string is followed by a "$NON-NLS$" line comment
- if (ASTutils.existsNonInternationalisationComment(stringLiteral)) {
- return false;
- }
-
- // constant string literal found
- constants.add(new SLLocation(file,
- stringLiteral.getStartPosition(), stringLiteral
- .getStartPosition()
- + stringLiteral.getLength(), stringLiteral.getLiteralValue()));
- } catch (Exception e) {
- e.printStackTrace();
- }
- return false;
- }
-
- public List<SLLocation> getConstantStringLiterals() {
- return constants;
- }
-
- public List<SLLocation> getBrokenResourceReferences() {
- return brokenStrings;
+ IResourceVisitor {
+
+ private List<SLLocation> constants;
+ private List<SLLocation> brokenStrings;
+ private List<SLLocation> brokenRBReferences;
+ private SortedMap<Long, IRegion> rbDefReferences = new TreeMap<Long, IRegion>();
+ private SortedMap<Long, IRegion> keyPositions = new TreeMap<Long, IRegion>();
+ private Map<IRegion, String> bundleKeys = new HashMap<IRegion, String>();
+ private Map<IRegion, String> bundleReferences = new HashMap<IRegion, String>();
+ private IFile file;
+ private Map<IVariableBinding, VariableDeclarationFragment> variableBindingManagers = new HashMap<IVariableBinding, VariableDeclarationFragment>();
+ private ResourceBundleManager manager;
+
+ public ResourceAuditVisitor(IFile file, ResourceBundleManager manager) {
+ constants = new ArrayList<SLLocation>();
+ brokenStrings = new ArrayList<SLLocation>();
+ brokenRBReferences = new ArrayList<SLLocation>();
+ this.file = file;
+ this.manager = manager;
+ }
+
+ @Override
+ public boolean visit(VariableDeclarationStatement varDeclaration) {
+ for (Iterator<VariableDeclarationFragment> itFrag = varDeclaration
+ .fragments().iterator(); itFrag.hasNext();) {
+ VariableDeclarationFragment fragment = itFrag.next();
+ parseVariableDeclarationFragment(fragment);
}
-
- public List<SLLocation> getBrokenRBReferences() {
- return this.brokenRBReferences;
+ return true;
+ }
+
+ @Override
+ public boolean visit(FieldDeclaration fieldDeclaration) {
+ for (Iterator<VariableDeclarationFragment> itFrag = fieldDeclaration
+ .fragments().iterator(); itFrag.hasNext();) {
+ VariableDeclarationFragment fragment = itFrag.next();
+ parseVariableDeclarationFragment(fragment);
}
-
- public IRegion getKeyAt(Long position) {
- IRegion reg = null;
-
- Iterator<Long> keys = keyPositions.keySet().iterator();
- while (keys.hasNext()) {
- Long startPos = keys.next();
- if (startPos > position)
- break;
-
- IRegion region = keyPositions.get(startPos);
- if (region.getOffset() <= position
- && (region.getOffset() + region.getLength()) >= position) {
- reg = region;
- break;
+ return true;
+ }
+
+ protected void parseVariableDeclarationFragment(
+ VariableDeclarationFragment fragment) {
+ IVariableBinding vBinding = fragment.resolveBinding();
+ this.variableBindingManagers.put(vBinding, fragment);
+ }
+
+ @Override
+ public boolean visit(StringLiteral stringLiteral) {
+ try {
+ ASTNode parent = stringLiteral.getParent();
+
+ if (parent instanceof MethodInvocation) {
+ MethodInvocation methodInvocation = (MethodInvocation) parent;
+
+ IRegion region = new Region(stringLiteral.getStartPosition(),
+ stringLiteral.getLength());
+
+ // Check if this method invokes the getString-Method on a
+ // ResourceBundle Implementation
+ if (ASTutils.isMatchingMethodParamDesc(methodInvocation,
+ stringLiteral, ASTutils.getRBAccessorDesc())) {
+ // Check if the given Resource-Bundle reference is broken
+ SLLocation rbName = ASTutils.resolveResourceBundleLocation(
+ methodInvocation, ASTutils.getRBDefinitionDesc(),
+ variableBindingManagers);
+ if (rbName == null
+ || manager.isKeyBroken(rbName.getLiteral(),
+ stringLiteral.getLiteralValue())) {
+ // report new problem
+ SLLocation desc = new SLLocation(file,
+ stringLiteral.getStartPosition(),
+ stringLiteral.getStartPosition()
+ + stringLiteral.getLength(),
+ stringLiteral.getLiteralValue());
+ desc.setData(rbName);
+ brokenStrings.add(desc);
+ }
+
+ // store position of resource-bundle access
+ keyPositions.put(
+ Long.valueOf(stringLiteral.getStartPosition()),
+ region);
+ bundleKeys.put(region, stringLiteral.getLiteralValue());
+ bundleReferences.put(region, rbName.getLiteral());
+ return false;
+ } else if (ASTutils.isMatchingMethodParamDesc(methodInvocation,
+ stringLiteral, ASTutils.getRBDefinitionDesc())) {
+ rbDefReferences.put(
+ Long.valueOf(stringLiteral.getStartPosition()),
+ region);
+ boolean referenceBroken = true;
+ for (String bundle : manager.getResourceBundleIdentifiers()) {
+ if (bundle.trim().equals(
+ stringLiteral.getLiteralValue())) {
+ referenceBroken = false;
}
+ }
+ if (referenceBroken) {
+ this.brokenRBReferences.add(new SLLocation(file,
+ stringLiteral.getStartPosition(), stringLiteral
+ .getStartPosition()
+ + stringLiteral.getLength(),
+ stringLiteral.getLiteralValue()));
+ }
+
+ return false;
}
+ }
- return reg;
- }
-
- public String getKeyAt(IRegion region) {
- if (bundleKeys.containsKey(region))
- return bundleKeys.get(region);
- else
- return "";
+ // check if string is followed by a "$NON-NLS$" line comment
+ if (ASTutils.existsNonInternationalisationComment(stringLiteral)) {
+ return false;
+ }
+
+ // constant string literal found
+ constants.add(new SLLocation(file,
+ stringLiteral.getStartPosition(), stringLiteral
+ .getStartPosition() + stringLiteral.getLength(),
+ stringLiteral.getLiteralValue()));
+ } catch (Exception e) {
+ e.printStackTrace();
}
-
- public String getBundleReference(IRegion region) {
- return bundleReferences.get(region);
+ return false;
+ }
+
+ public List<SLLocation> getConstantStringLiterals() {
+ return constants;
+ }
+
+ public List<SLLocation> getBrokenResourceReferences() {
+ return brokenStrings;
+ }
+
+ public List<SLLocation> getBrokenRBReferences() {
+ return this.brokenRBReferences;
+ }
+
+ public IRegion getKeyAt(Long position) {
+ IRegion reg = null;
+
+ Iterator<Long> keys = keyPositions.keySet().iterator();
+ while (keys.hasNext()) {
+ Long startPos = keys.next();
+ if (startPos > position)
+ break;
+
+ IRegion region = keyPositions.get(startPos);
+ if (region.getOffset() <= position
+ && (region.getOffset() + region.getLength()) >= position) {
+ reg = region;
+ break;
+ }
}
- @Override
- public boolean visit(IResource resource) throws CoreException {
- // TODO Auto-generated method stub
- return false;
+ return reg;
+ }
+
+ public String getKeyAt(IRegion region) {
+ if (bundleKeys.containsKey(region))
+ return bundleKeys.get(region);
+ else
+ return "";
+ }
+
+ public String getBundleReference(IRegion region) {
+ return bundleReferences.get(region);
+ }
+
+ @Override
+ public boolean visit(IResource resource) throws CoreException {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public Collection<String> getDefinedResourceBundles(int offset) {
+ Collection<String> result = new HashSet<String>();
+ for (String s : bundleReferences.values()) {
+ if (s != null)
+ result.add(s);
}
-
- public Collection<String> getDefinedResourceBundles(int offset) {
- Collection<String> result = new HashSet<String>();
- for (String s : bundleReferences.values()) {
- if (s != null)
- result.add(s);
- }
- return result;
+ return result;
+ }
+
+ public IRegion getRBReferenceAt(Long offset) {
+ IRegion reg = null;
+
+ Iterator<Long> keys = rbDefReferences.keySet().iterator();
+ while (keys.hasNext()) {
+ Long startPos = keys.next();
+ if (startPos > offset)
+ break;
+
+ IRegion region = rbDefReferences.get(startPos);
+ if (region != null && region.getOffset() <= offset
+ && (region.getOffset() + region.getLength()) >= offset) {
+ reg = region;
+ break;
+ }
}
- public IRegion getRBReferenceAt(Long offset) {
- IRegion reg = null;
-
- Iterator<Long> keys = rbDefReferences.keySet().iterator();
- while (keys.hasNext()) {
- Long startPos = keys.next();
- if (startPos > offset)
- break;
-
- IRegion region = rbDefReferences.get(startPos);
- if (region != null &&
- region.getOffset() <= offset
- && (region.getOffset() + region.getLength()) >= offset) {
- reg = region;
- break;
- }
- }
-
- return reg;
- }
+ return reg;
+ }
}
diff --git a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/MessageCompletionProposalComputer.java b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/MessageCompletionProposalComputer.java
index ad0ad93f..04ea7969 100644
--- a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/MessageCompletionProposalComputer.java
+++ b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/MessageCompletionProposalComputer.java
@@ -182,12 +182,15 @@ protected List<ICompletionProposal> getResourceBundleCompletionProposals(
hit = true;
}
}
- if (!hit)
+ if (!hit) {
completions.add(new NewResourceBundleEntryProposal(resource,
offset - stringLiteralStart.length(), true, manager,
bundleName/*
* , csav.getDefinedResourceBundles (offset)
*/));
+
+ // TODO: reference to existing resource
+ }
} else {
for (String key : bundleGroup.getMessageKeys()) {
completions.add(new MessageCompletionProposal(posStart,
diff --git a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/autocompletion/NewResourceBundleEntryProposal.java b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/autocompletion/NewResourceBundleEntryProposal.java
index 16148a0d..239015dd 100644
--- a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/autocompletion/NewResourceBundleEntryProposal.java
+++ b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/autocompletion/NewResourceBundleEntryProposal.java
@@ -16,116 +16,119 @@
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
-
public class NewResourceBundleEntryProposal implements IJavaCompletionProposal {
- private int startPos;
- private int endPos;
- private String value;
- private boolean bundleContext;
- private ResourceBundleManager manager;
- private IResource resource;
- private String bundleName;
- private String reference;
-
- public NewResourceBundleEntryProposal(IResource resource, int startPos, boolean bundleContext,
- ResourceBundleManager manager, String bundleName) {
-
- CompilationUnit cu = ASTutils.getCompilationUnit(resource);
-
- StringLiteral string = ASTutils.getStringAtPos(cu, startPos);
-
- this.startPos = string.getStartPosition()+1;
- this.endPos = string.getLength()-2;
- this.bundleContext = bundleContext;
- this.manager = manager;
- this.value = string.getLiteralValue();
- this.resource = resource;
- this.bundleName = bundleName;
- }
+ private int startPos;
+ private int endPos;
+ private String value;
+ private boolean bundleContext;
+ private ResourceBundleManager manager;
+ private IResource resource;
+ private String bundleName;
+ private String reference;
- @Override
- public void apply(IDocument document) {
-
- CompilationUnit cu = ASTutils.getCompilationUnit(resource);
-
- StringLiteral lit = ASTutils.getStringAtPos(cu, startPos);
-
- CreateResourceBundleEntryDialog dialog = new CreateResourceBundleEntryDialog(
- Display.getDefault().getActiveShell(),
- manager,
- bundleContext ? value : "",
- bundleContext ? "" : value,
- bundleName == null ? "" : bundleName,
- "");
- if (dialog.open() != InputDialog.OK)
- return;
-
-
- String resourceBundleId = dialog.getSelectedResourceBundle();
- String key = dialog.getSelectedKey();
-
- try {
- if (!bundleContext)
- reference = ASTutils.insertNewBundleRef(document, resource, startPos, endPos, resourceBundleId, key);
- else {
- document.replace(startPos, endPos, key);
- reference = key + "\"";
- }
- ResourceBundleManager.refreshResource(resource);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
+ public NewResourceBundleEntryProposal(IResource resource, int startPos,
+ boolean bundleContext, ResourceBundleManager manager,
+ String bundleName) {
- @Override
- public String getAdditionalProposalInfo() {
- if (value != null && value.length() > 0) {
- return "Exports the focused string literal into a Java Resource-Bundle. This action results " +
- "in a Resource-Bundle reference!";
- } else
- return "";
- }
+ CompilationUnit cu = ASTutils.getCompilationUnit(resource);
- @Override
- public IContextInformation getContextInformation() {
- // TODO Auto-generated method stub
- return null;
- }
+ StringLiteral string = ASTutils.getStringAtPos(cu, startPos);
- @Override
- public String getDisplayString() {
- String displayStr = "";
- if (bundleContext)
- displayStr = "Create a new resource-bundle-entry";
- else
- displayStr = "Create a new localized string literal";
-
- if (value != null && value.length() > 0)
- displayStr += " for '" + value + "'";
-
- return displayStr;
+ if (string == null) {
+ this.startPos = startPos;
+ this.endPos = 0;
+ this.value = "";
+ } else {
+ this.startPos = string.getStartPosition() + 1;
+ this.endPos = string.getLength() - 2;
+ this.value = string.getLiteralValue();
}
+ this.bundleContext = bundleContext;
+ this.manager = manager;
+ this.resource = resource;
+ this.bundleName = bundleName;
+ }
- @Override
- public Image getImage() {
- return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(
- ISharedImages.IMG_OBJ_ADD).createImage();
- }
+ @Override
+ public void apply(IDocument document) {
- @Override
- public Point getSelection(IDocument document) {
- int refLength = reference == null ? 0 : reference.length() -1;
- return new Point (startPos + refLength, 0);
- }
+ CompilationUnit cu = ASTutils.getCompilationUnit(resource);
+
+ StringLiteral lit = ASTutils.getStringAtPos(cu, startPos);
+
+ CreateResourceBundleEntryDialog dialog = new CreateResourceBundleEntryDialog(
+ Display.getDefault().getActiveShell(), manager,
+ bundleContext ? value : "", bundleContext ? "" : value,
+ bundleName == null ? "" : bundleName, "");
+ if (dialog.open() != InputDialog.OK)
+ return;
- @Override
- public int getRelevance() {
- // TODO Auto-generated method stub
- if (this.value.trim().length() == 0)
- return 1096;
- else
- return 1096;
+ String resourceBundleId = dialog.getSelectedResourceBundle();
+ String key = dialog.getSelectedKey();
+
+ try {
+ if (!bundleContext)
+ reference = ASTutils.insertNewBundleRef(document, resource,
+ startPos, endPos, resourceBundleId, key);
+ else {
+ document.replace(startPos, endPos, key);
+ reference = key + "\"";
+ }
+ ResourceBundleManager.refreshResource(resource);
+ } catch (Exception e) {
+ e.printStackTrace();
}
+ }
+
+ @Override
+ public String getAdditionalProposalInfo() {
+ if (value != null && value.length() > 0) {
+ return "Exports the focused string literal into a Java Resource-Bundle. This action results "
+ + "in a Resource-Bundle reference!";
+ } else
+ return "";
+ }
+
+ @Override
+ public IContextInformation getContextInformation() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getDisplayString() {
+ String displayStr = "";
+ if (bundleContext)
+ displayStr = "Create a new resource-bundle-entry";
+ else
+ displayStr = "Create a new localized string literal";
+
+ if (value != null && value.length() > 0)
+ displayStr += " for '" + value + "'";
+
+ return displayStr;
+ }
+
+ @Override
+ public Image getImage() {
+ return PlatformUI.getWorkbench().getSharedImages()
+ .getImageDescriptor(ISharedImages.IMG_OBJ_ADD).createImage();
+ }
+
+ @Override
+ public Point getSelection(IDocument document) {
+ int refLength = reference == null ? 0 : reference.length() - 1;
+ return new Point(startPos + refLength, 0);
+ }
+
+ @Override
+ public int getRelevance() {
+ // TODO Auto-generated method stub
+ if (this.value.trim().length() == 0)
+ return 1096;
+ else
+ return 1096;
+ }
}
diff --git a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/util/ASTutils.java b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/util/ASTutils.java
index 2445b732..1c36df30 100644
--- a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/util/ASTutils.java
+++ b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/util/ASTutils.java
@@ -45,954 +45,991 @@
import org.eclipse.jface.text.IRegion;
import org.eclipse.text.edits.TextEdit;
-
public class ASTutils {
-
- private static MethodParameterDescriptor rbDefinition;
- private static MethodParameterDescriptor rbAccessor;
-
- public static MethodParameterDescriptor getRBDefinitionDesc () {
- if (rbDefinition == null) {
- // Init descriptor for Resource-Bundle-Definition
- List<String> definition = new ArrayList<String>();
- definition.add("getBundle");
- rbDefinition = new MethodParameterDescriptor(definition,
- "java.util.ResourceBundle", true, 0);
- }
-
- return rbDefinition;
- }
-
- public static MethodParameterDescriptor getRBAccessorDesc () {
- if (rbAccessor == null) {
- // Init descriptor for Resource-Bundle-Accessors
- List<String> accessors = new ArrayList<String>();
- accessors.add("getString");
- accessors.add("getStringArray");
- rbAccessor = new MethodParameterDescriptor(accessors,
- "java.util.ResourceBundle", true, 0);
- }
-
- return rbAccessor;
- }
-
- public static CompilationUnit getCompilationUnit(IResource resource) {
- IJavaElement je = JavaCore.create(resource, JavaCore.create(resource.getProject()));
- // get the type of the currently loaded resource
- ITypeRoot typeRoot = ((ICompilationUnit) je);
-
- if (typeRoot == null)
- return null;
-
- return getCompilationUnit(typeRoot);
- }
-
- public static CompilationUnit getCompilationUnit(ITypeRoot typeRoot) {
- // get a reference to the shared AST of the loaded CompilationUnit
- CompilationUnit cu = SharedASTProvider.getAST(typeRoot,
- // do not wait for AST creation
- SharedASTProvider.WAIT_YES, null);
-
- return cu;
- }
-
- public static String insertExistingBundleRef (IDocument document,
- IResource resource,
- int offset,
- int length,
- String resourceBundleId,
- String key,
- Locale locale) {
- String reference = "";
- String newName = null;
-
- CompilationUnit cu = getCompilationUnit(resource);
-
- String variableName = ASTutils.resolveRBReferenceVar(document, resource, offset, resourceBundleId, cu);
- if (variableName == null)
- newName = ASTutils.getNonExistingRBRefName(resourceBundleId, document, cu);
-
- try {
- reference = ASTutils.createResourceReference(
- resourceBundleId,
- key,
- locale,
- resource,
- offset,
- variableName == null ? newName : variableName,
- document,
- cu);
-
- document.replace(offset, length, reference);
-
- // create non-internationalisation-comment
- createReplaceNonInternationalisationComment(cu, document, offset);
- } catch (BadLocationException e) {
- e.printStackTrace();
- }
-
- // TODO retrieve cu in the same way as in createResourceReference
- // the current version does not parse method bodies
-
- if (variableName == null){
- ASTutils.createResourceBundleReference(resource, offset, document, resourceBundleId, locale, true, newName, cu);
-// createReplaceNonInternationalisationComment(cu, document, pos);
- }
- return reference;
- }
-
- public static String insertNewBundleRef (IDocument document,
- IResource resource,
- int startPos,
- int endPos,
- String resourceBundleId,
- String key) {
- String newName = null;
- String reference = "";
-
- CompilationUnit cu = getCompilationUnit(resource);
-
- if (cu == null)
- return null;
-
- String variableName = ASTutils.resolveRBReferenceVar(document, resource, startPos, resourceBundleId, cu);
- if (variableName == null)
- newName = ASTutils.getNonExistingRBRefName(resourceBundleId, document, cu);
-
- try {
- reference = ASTutils.createResourceReference(
- resourceBundleId,
- key,
- null,
- resource,
- startPos,
- variableName == null ? newName : variableName,
- document,
- cu);
-
- if (startPos > 0 && document.get().charAt(startPos-1) == '\"') {
- startPos --;
- endPos ++;
- }
-
- if ((startPos + endPos) < document.getLength() && document.get().charAt(startPos + endPos) == '\"')
- endPos ++;
-
- if ((startPos + endPos) < document.getLength() && document.get().charAt(startPos + endPos-1) == ';')
- endPos --;
-
- document.replace(startPos, endPos, reference);
-
- // create non-internationalisation-comment
- createReplaceNonInternationalisationComment(cu, document, startPos);
- } catch (BadLocationException e) {
- e.printStackTrace();
- }
-
- if (variableName == null) {
- // refresh reference to the shared AST of the loaded CompilationUnit
- cu = getCompilationUnit(resource);
-
- ASTutils.createResourceBundleReference(resource, startPos, document, resourceBundleId, null, true, newName, cu);
-// createReplaceNonInternationalisationComment(cu, document, pos);
- }
-
-
- return reference;
- }
-
- public static String resolveRBReferenceVar (IDocument document, IResource resource, int pos, final String bundleId, CompilationUnit cu) {
- String bundleVar;
-
- PositionalTypeFinder typeFinder = new PositionalTypeFinder(pos);
- cu.accept(typeFinder);
- AnonymousClassDeclaration atd = typeFinder.getEnclosingAnonymType();
- TypeDeclaration td = typeFinder.getEnclosingType();
- MethodDeclaration meth = typeFinder.getEnclosingMethod();
-
- if (atd == null) {
- BundleDeclarationFinder bdf = new BundleDeclarationFinder(bundleId, td,
- meth != null && (meth.getModifiers() & Modifier.STATIC) == Modifier.STATIC);
- td.accept(bdf);
-
- bundleVar = bdf.getVariableName();
- } else {
- BundleDeclarationFinder bdf = new BundleDeclarationFinder(bundleId, atd,
- meth != null && (meth.getModifiers() & Modifier.STATIC) == Modifier.STATIC);
- atd.accept(bdf);
-
- bundleVar = bdf.getVariableName();
- }
-
- // Check also method body
- if (meth != null) {
- try {
- InMethodBundleDeclFinder imbdf = new InMethodBundleDeclFinder(bundleId,
- pos);
- typeFinder.getEnclosingMethod().accept (imbdf);
- bundleVar = imbdf.getVariableName() != null ? imbdf.getVariableName() : bundleVar;
- } catch (Exception e) {
- // ignore
- }
- }
-
- return bundleVar;
- }
-
- public static String getNonExistingRBRefName (String bundleId, IDocument document, CompilationUnit cu) {
- String referenceName = null;
- int i = 0;
-
- while (referenceName == null) {
- String actRef = bundleId.substring(bundleId.lastIndexOf(".") + 1) + "Ref" + (i == 0 ? "" : i);
- actRef = actRef.toLowerCase();
-
- VariableFinder vf = new VariableFinder(actRef);
- cu.accept(vf);
-
- if (!vf.isVariableFound()) {
- referenceName = actRef;
- break;
- }
-
- i++;
- }
-
- return referenceName;
- }
-
- @Deprecated
- public static String resolveResourceBundle(MethodInvocation methodInvocation,
- MethodParameterDescriptor rbDefinition,
- Map<IVariableBinding, VariableDeclarationFragment> variableBindingManagers) {
- String bundleName = null;
-
- if (methodInvocation.getExpression() instanceof SimpleName) {
- SimpleName vName = (SimpleName) methodInvocation.getExpression();
- IVariableBinding vBinding = (IVariableBinding) vName
- .resolveBinding();
- VariableDeclarationFragment dec = variableBindingManagers
- .get(vBinding);
-
- if (dec.getInitializer() instanceof MethodInvocation) {
- MethodInvocation init = (MethodInvocation) dec.getInitializer();
-
- // Check declaring class
- boolean isValidClass = false;
- ITypeBinding type = init.resolveMethodBinding()
- .getDeclaringClass();
- while (type != null) {
- if (type.getQualifiedName().equals(
- rbDefinition.getDeclaringClass())) {
- isValidClass = true;
- break;
- } else {
- if (rbDefinition.isConsiderSuperclass())
- type = type.getSuperclass();
- else
- type = null;
- }
-
- }
- if (!isValidClass)
- return null;
-
- boolean isValidMethod = false;
- for (String mn : rbDefinition.getMethodName()) {
- if (init.getName().getFullyQualifiedName().equals(mn)) {
- isValidMethod = true;
- break;
- }
- }
- if (!isValidMethod)
- return null;
-
- // retrieve bundlename
- if (init.arguments().size() < rbDefinition.getPosition() + 1)
- return null;
-
- bundleName = ((StringLiteral) init.arguments().get(
- rbDefinition.getPosition())).getLiteralValue();
- }
+
+ private static MethodParameterDescriptor rbDefinition;
+ private static MethodParameterDescriptor rbAccessor;
+
+ public static MethodParameterDescriptor getRBDefinitionDesc() {
+ if (rbDefinition == null) {
+ // Init descriptor for Resource-Bundle-Definition
+ List<String> definition = new ArrayList<String>();
+ definition.add("getBundle");
+ rbDefinition = new MethodParameterDescriptor(definition,
+ "java.util.ResourceBundle", true, 0);
+ }
+
+ return rbDefinition;
+ }
+
+ public static MethodParameterDescriptor getRBAccessorDesc() {
+ if (rbAccessor == null) {
+ // Init descriptor for Resource-Bundle-Accessors
+ List<String> accessors = new ArrayList<String>();
+ accessors.add("getString");
+ accessors.add("getStringArray");
+ rbAccessor = new MethodParameterDescriptor(accessors,
+ "java.util.ResourceBundle", true, 0);
+ }
+
+ return rbAccessor;
+ }
+
+ public static CompilationUnit getCompilationUnit(IResource resource) {
+ IJavaElement je = JavaCore.create(resource,
+ JavaCore.create(resource.getProject()));
+ // get the type of the currently loaded resource
+ ITypeRoot typeRoot = ((ICompilationUnit) je);
+
+ if (typeRoot == null)
+ return null;
+
+ return getCompilationUnit(typeRoot);
+ }
+
+ public static CompilationUnit getCompilationUnit(ITypeRoot typeRoot) {
+ // get a reference to the shared AST of the loaded CompilationUnit
+ CompilationUnit cu = SharedASTProvider.getAST(typeRoot,
+ // do not wait for AST creation
+ SharedASTProvider.WAIT_YES, null);
+
+ return cu;
+ }
+
+ public static String insertExistingBundleRef(IDocument document,
+ IResource resource, int offset, int length,
+ String resourceBundleId, String key, Locale locale) {
+ String reference = "";
+ String newName = null;
+
+ CompilationUnit cu = getCompilationUnit(resource);
+
+ String variableName = ASTutils.resolveRBReferenceVar(document,
+ resource, offset, resourceBundleId, cu);
+ if (variableName == null)
+ newName = ASTutils.getNonExistingRBRefName(resourceBundleId,
+ document, cu);
+
+ try {
+ reference = ASTutils.createResourceReference(resourceBundleId, key,
+ locale, resource, offset, variableName == null ? newName
+ : variableName, document, cu);
+
+ document.replace(offset, length, reference);
+
+ // create non-internationalisation-comment
+ createReplaceNonInternationalisationComment(cu, document, offset);
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+
+ // TODO retrieve cu in the same way as in createResourceReference
+ // the current version does not parse method bodies
+
+ if (variableName == null) {
+ ASTutils.createResourceBundleReference(resource, offset, document,
+ resourceBundleId, locale, true, newName, cu);
+ // createReplaceNonInternationalisationComment(cu, document, pos);
+ }
+ return reference;
+ }
+
+ public static String insertNewBundleRef(IDocument document,
+ IResource resource, int startPos, int endPos,
+ String resourceBundleId, String key) {
+ String newName = null;
+ String reference = "";
+
+ CompilationUnit cu = getCompilationUnit(resource);
+
+ if (cu == null)
+ return null;
+
+ String variableName = ASTutils.resolveRBReferenceVar(document,
+ resource, startPos, resourceBundleId, cu);
+ if (variableName == null)
+ newName = ASTutils.getNonExistingRBRefName(resourceBundleId,
+ document, cu);
+
+ try {
+ reference = ASTutils.createResourceReference(resourceBundleId, key,
+ null, resource, startPos, variableName == null ? newName
+ : variableName, document, cu);
+
+ if (startPos > 0 && document.get().charAt(startPos - 1) == '\"') {
+ startPos--;
+ endPos++;
+ }
+
+ if ((startPos + endPos) < document.getLength()
+ && document.get().charAt(startPos + endPos) == '\"')
+ endPos++;
+
+ if ((startPos + endPos) < document.getLength()
+ && document.get().charAt(startPos + endPos - 1) == ';')
+ endPos--;
+
+ document.replace(startPos, endPos, reference);
+
+ // create non-internationalisation-comment
+ createReplaceNonInternationalisationComment(cu, document, startPos);
+ } catch (BadLocationException e) {
+ e.printStackTrace();
+ }
+
+ if (variableName == null) {
+ // refresh reference to the shared AST of the loaded CompilationUnit
+ cu = getCompilationUnit(resource);
+
+ ASTutils.createResourceBundleReference(resource, startPos,
+ document, resourceBundleId, null, true, newName, cu);
+ // createReplaceNonInternationalisationComment(cu, document, pos);
+ }
+
+ return reference;
+ }
+
+ public static String resolveRBReferenceVar(IDocument document,
+ IResource resource, int pos, final String bundleId,
+ CompilationUnit cu) {
+ String bundleVar;
+
+ PositionalTypeFinder typeFinder = new PositionalTypeFinder(pos);
+ cu.accept(typeFinder);
+ AnonymousClassDeclaration atd = typeFinder.getEnclosingAnonymType();
+ TypeDeclaration td = typeFinder.getEnclosingType();
+ MethodDeclaration meth = typeFinder.getEnclosingMethod();
+
+ if (atd == null) {
+ BundleDeclarationFinder bdf = new BundleDeclarationFinder(
+ bundleId,
+ td,
+ meth != null
+ && (meth.getModifiers() & Modifier.STATIC) == Modifier.STATIC);
+ td.accept(bdf);
+
+ bundleVar = bdf.getVariableName();
+ } else {
+ BundleDeclarationFinder bdf = new BundleDeclarationFinder(
+ bundleId,
+ atd,
+ meth != null
+ && (meth.getModifiers() & Modifier.STATIC) == Modifier.STATIC);
+ atd.accept(bdf);
+
+ bundleVar = bdf.getVariableName();
+ }
+
+ // Check also method body
+ if (meth != null) {
+ try {
+ InMethodBundleDeclFinder imbdf = new InMethodBundleDeclFinder(
+ bundleId, pos);
+ typeFinder.getEnclosingMethod().accept(imbdf);
+ bundleVar = imbdf.getVariableName() != null ? imbdf
+ .getVariableName() : bundleVar;
+ } catch (Exception e) {
+ // ignore
+ }
+ }
+
+ return bundleVar;
+ }
+
+ public static String getNonExistingRBRefName(String bundleId,
+ IDocument document, CompilationUnit cu) {
+ String referenceName = null;
+ int i = 0;
+
+ while (referenceName == null) {
+ String actRef = bundleId.substring(bundleId.lastIndexOf(".") + 1)
+ + "Ref" + (i == 0 ? "" : i);
+ actRef = actRef.toLowerCase();
+
+ VariableFinder vf = new VariableFinder(actRef);
+ cu.accept(vf);
+
+ if (!vf.isVariableFound()) {
+ referenceName = actRef;
+ break;
+ }
+
+ i++;
+ }
+
+ return referenceName;
+ }
+
+ @Deprecated
+ public static String resolveResourceBundle(
+ MethodInvocation methodInvocation,
+ MethodParameterDescriptor rbDefinition,
+ Map<IVariableBinding, VariableDeclarationFragment> variableBindingManagers) {
+ String bundleName = null;
+
+ if (methodInvocation.getExpression() instanceof SimpleName) {
+ SimpleName vName = (SimpleName) methodInvocation.getExpression();
+ IVariableBinding vBinding = (IVariableBinding) vName
+ .resolveBinding();
+ VariableDeclarationFragment dec = variableBindingManagers
+ .get(vBinding);
+
+ if (dec.getInitializer() instanceof MethodInvocation) {
+ MethodInvocation init = (MethodInvocation) dec.getInitializer();
+
+ // Check declaring class
+ boolean isValidClass = false;
+ ITypeBinding type = init.resolveMethodBinding()
+ .getDeclaringClass();
+ while (type != null) {
+ if (type.getQualifiedName().equals(
+ rbDefinition.getDeclaringClass())) {
+ isValidClass = true;
+ break;
+ } else {
+ if (rbDefinition.isConsiderSuperclass())
+ type = type.getSuperclass();
+ else
+ type = null;
+ }
+
}
+ if (!isValidClass)
+ return null;
- return bundleName;
- }
-
- public static SLLocation resolveResourceBundleLocation (MethodInvocation methodInvocation,
- MethodParameterDescriptor rbDefinition,
- Map<IVariableBinding, VariableDeclarationFragment> variableBindingManagers) {
- SLLocation bundleDesc = null;
-
- if (methodInvocation.getExpression() instanceof SimpleName) {
- SimpleName vName = (SimpleName) methodInvocation.getExpression();
- IVariableBinding vBinding = (IVariableBinding) vName
- .resolveBinding();
- VariableDeclarationFragment dec = variableBindingManagers
- .get(vBinding);
-
- if (dec.getInitializer() instanceof MethodInvocation) {
- MethodInvocation init = (MethodInvocation) dec.getInitializer();
-
- // Check declaring class
- boolean isValidClass = false;
- ITypeBinding type = init.resolveMethodBinding()
- .getDeclaringClass();
- while (type != null) {
- if (type.getQualifiedName().equals(
- rbDefinition.getDeclaringClass())) {
- isValidClass = true;
- break;
- } else {
- if (rbDefinition.isConsiderSuperclass())
- type = type.getSuperclass();
- else
- type = null;
- }
-
- }
- if (!isValidClass)
- return null;
-
- boolean isValidMethod = false;
- for (String mn : rbDefinition.getMethodName()) {
- if (init.getName().getFullyQualifiedName().equals(mn)) {
- isValidMethod = true;
- break;
- }
- }
- if (!isValidMethod)
- return null;
-
- // retrieve bundlename
- if (init.arguments().size() < rbDefinition.getPosition() + 1)
- return null;
-
- StringLiteral bundleLiteral = ((StringLiteral) init.arguments().get(
- rbDefinition.getPosition()));
- bundleDesc = new SLLocation (null, bundleLiteral.getStartPosition(), bundleLiteral.getLength() + bundleLiteral.getStartPosition(), bundleLiteral.getLiteralValue());
- }
+ boolean isValidMethod = false;
+ for (String mn : rbDefinition.getMethodName()) {
+ if (init.getName().getFullyQualifiedName().equals(mn)) {
+ isValidMethod = true;
+ break;
+ }
}
+ if (!isValidMethod)
+ return null;
- return bundleDesc;
+ // retrieve bundlename
+ if (init.arguments().size() < rbDefinition.getPosition() + 1)
+ return null;
+
+ bundleName = ((StringLiteral) init.arguments().get(
+ rbDefinition.getPosition())).getLiteralValue();
+ }
}
-
- private static boolean isMatchingMethodDescriptor (
- MethodInvocation methodInvocation,
- MethodParameterDescriptor desc) {
- boolean result = false;
-
- if (methodInvocation.resolveMethodBinding() == null)
- return false;
-
- String methodName = methodInvocation.resolveMethodBinding().getName();
+
+ return bundleName;
+ }
+
+ public static SLLocation resolveResourceBundleLocation(
+ MethodInvocation methodInvocation,
+ MethodParameterDescriptor rbDefinition,
+ Map<IVariableBinding, VariableDeclarationFragment> variableBindingManagers) {
+ SLLocation bundleDesc = null;
+
+ if (methodInvocation.getExpression() instanceof SimpleName) {
+ SimpleName vName = (SimpleName) methodInvocation.getExpression();
+ IVariableBinding vBinding = (IVariableBinding) vName
+ .resolveBinding();
+ VariableDeclarationFragment dec = variableBindingManagers
+ .get(vBinding);
+
+ if (dec.getInitializer() instanceof MethodInvocation) {
+ MethodInvocation init = (MethodInvocation) dec.getInitializer();
// Check declaring class
- ITypeBinding type = methodInvocation.resolveMethodBinding()
- .getDeclaringClass();
+ boolean isValidClass = false;
+ ITypeBinding type = init.resolveMethodBinding()
+ .getDeclaringClass();
while (type != null) {
- if (type.getQualifiedName().equals(desc.getDeclaringClass())) {
- result = true;
- break;
- } else {
- if (desc.isConsiderSuperclass())
- type = type.getSuperclass();
- else
- type = null;
- }
+ if (type.getQualifiedName().equals(
+ rbDefinition.getDeclaringClass())) {
+ isValidClass = true;
+ break;
+ } else {
+ if (rbDefinition.isConsiderSuperclass())
+ type = type.getSuperclass();
+ else
+ type = null;
+ }
}
+ if (!isValidClass)
+ return null;
- if (!result)
- return false;
+ boolean isValidMethod = false;
+ for (String mn : rbDefinition.getMethodName()) {
+ if (init.getName().getFullyQualifiedName().equals(mn)) {
+ isValidMethod = true;
+ break;
+ }
+ }
+ if (!isValidMethod)
+ return null;
- result = !result;
+ // retrieve bundlename
+ if (init.arguments().size() < rbDefinition.getPosition() + 1)
+ return null;
- // Check method name
- for (String method : desc.getMethodName()) {
- if (method.equals(methodName)) {
- result = true;
- break;
- }
- }
-
- return result;
+ StringLiteral bundleLiteral = ((StringLiteral) init.arguments()
+ .get(rbDefinition.getPosition()));
+ bundleDesc = new SLLocation(null,
+ bundleLiteral.getStartPosition(),
+ bundleLiteral.getLength()
+ + bundleLiteral.getStartPosition(),
+ bundleLiteral.getLiteralValue());
+ }
}
-
- public static boolean isMatchingMethodParamDesc(
- MethodInvocation methodInvocation, String literal,
- MethodParameterDescriptor desc) {
- boolean result = isMatchingMethodDescriptor (methodInvocation, desc);
- if (!result)
- return false;
+ return bundleDesc;
+ }
+
+ private static boolean isMatchingMethodDescriptor(
+ MethodInvocation methodInvocation, MethodParameterDescriptor desc) {
+ boolean result = false;
+
+ if (methodInvocation.resolveMethodBinding() == null)
+ return false;
+
+ String methodName = methodInvocation.resolveMethodBinding().getName();
+
+ // Check declaring class
+ ITypeBinding type = methodInvocation.resolveMethodBinding()
+ .getDeclaringClass();
+ while (type != null) {
+ if (type.getQualifiedName().equals(desc.getDeclaringClass())) {
+ result = true;
+ break;
+ } else {
+ if (desc.isConsiderSuperclass())
+ type = type.getSuperclass();
else
- result = false;
-
- if (methodInvocation.arguments().size() > desc.getPosition()) {
- if (methodInvocation.arguments().get(desc.getPosition()) instanceof StringLiteral) {
- StringLiteral sl = (StringLiteral) methodInvocation.arguments().get(desc.getPosition());
- if (sl.getLiteralValue().trim().toLowerCase().equals(literal.toLowerCase()))
- result = true;
- }
- }
-
- return result;
- }
-
- public static boolean isMatchingMethodParamDesc(
- MethodInvocation methodInvocation, StringLiteral literal,
- MethodParameterDescriptor desc) {
- int keyParameter = desc.getPosition();
- boolean result = isMatchingMethodDescriptor(methodInvocation, desc);
-
- if (!result)
- return false;
-
- // Check position within method call
- StructuralPropertyDescriptor spd = literal.getLocationInParent();
- if (spd.isChildListProperty()) {
- List<ASTNode> arguments = (List<ASTNode>) methodInvocation
- .getStructuralProperty(spd);
- result = (arguments.size() > keyParameter && arguments
- .get(keyParameter) == literal);
- }
+ type = null;
+ }
- return result;
- }
-
- public static ICompilationUnit createCompilationUnit (IResource resource) {
- // Instantiate a new AST parser
- ASTParser parser = ASTParser.newParser (AST.JLS3);
- parser.setResolveBindings(true);
-
- ICompilationUnit cu =
- JavaCore.createCompilationUnitFrom(resource.getProject().getFile(resource.getRawLocation()));
-
- return cu;
- }
-
- public static CompilationUnit createCompilationUnit (IDocument document) {
- // Instantiate a new AST parser
- ASTParser parser = ASTParser.newParser (AST.JLS3);
- parser.setResolveBindings(true);
-
- parser.setSource(document.get().toCharArray());
- return (CompilationUnit) parser.createAST(null);
- }
-
- public static void createImport (IDocument doc,
- IResource resource,
- CompilationUnit cu,
- AST ast,
- ASTRewrite rewriter,
- String qualifiedClassName)
- throws CoreException, BadLocationException {
-
- ImportFinder impFinder = new ImportFinder (qualifiedClassName);
-
- cu.accept(impFinder);
-
- if (!impFinder.isImportFound()) {
-// ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
-// IPath path = resource.getFullPath();
-//
-// bufferManager.connect(path, LocationKind.IFILE, null);
-// ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(doc);
-
- // TODO create new import
- ImportDeclaration id = ast.newImportDeclaration();
- id.setName(ast.newName(qualifiedClassName.split("\\.")));
- id.setStatic(false);
-
- ListRewrite lrw = rewriter.getListRewrite(cu, cu.IMPORTS_PROPERTY);
- lrw.insertFirst(id, null);
-
-// TextEdit te = rewriter.rewriteAST(doc, null);
-// te.apply(doc);
-//
-// if (textFileBuffer != null)
-// textFileBuffer.commit(null, false);
-// else
-// FileUtils.saveTextFile(resource.getProject().getFile(resource.getProjectRelativePath()),
-// doc.get());
-// bufferManager.disconnect(path, LocationKind.IFILE, null);
- }
-
- }
-
- // TODO export initializer specification into a methodinvocationdefinition
- public static void createResourceBundleReference (
- IResource resource,
- int typePos,
- IDocument doc,
- String bundleId,
- Locale locale,
- boolean globalReference,
- String variableName,
- CompilationUnit cu) {
-
- try {
-
- if (globalReference) {
-
- // retrieve compilation unit from document
- PositionalTypeFinder typeFinder = new PositionalTypeFinder( typePos );
- cu.accept(typeFinder);
- ASTNode node = typeFinder.getEnclosingType();
- ASTNode anonymNode = typeFinder.getEnclosingAnonymType();
- if (anonymNode != null)
- node = anonymNode;
-
- MethodDeclaration meth = typeFinder.getEnclosingMethod();
- AST ast = node.getAST();
-
- VariableDeclarationFragment vdf = ast.newVariableDeclarationFragment();
- vdf.setName(ast.newSimpleName(variableName));
-
- // set initializer
- vdf.setInitializer(createResourceBundleGetter(ast, bundleId, locale));
-
- FieldDeclaration fd = ast.newFieldDeclaration(vdf);
- fd.setType(ast.newSimpleType(ast.newName(new String [] {"ResourceBundle"} )));
-
- if (meth != null && (meth.getModifiers() & Modifier.STATIC) == Modifier.STATIC)
- fd.modifiers().addAll(ast.newModifiers(Modifier.STATIC));
-
-
- // rewrite AST
- ASTRewrite rewriter = ASTRewrite.create(ast);
- ListRewrite lrw = rewriter.getListRewrite(node,
- node instanceof TypeDeclaration ? TypeDeclaration.BODY_DECLARATIONS_PROPERTY :
- AnonymousClassDeclaration.BODY_DECLARATIONS_PROPERTY);
- lrw.insertAt(fd, /* findIndexOfLastField(node.bodyDeclarations())+1 */
- 0, null);
-
- // create import if required
- createImport(doc, resource, cu, ast, rewriter, getRBDefinitionDesc().getDeclaringClass());
-
- TextEdit te = rewriter.rewriteAST(doc, null);
- te.apply(doc);
- } else {
-
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
}
- private static int findIndexOfLastField(List bodyDeclarations) {
- for (int i= bodyDeclarations.size() - 1; i >= 0; i--) {
- BodyDeclaration each= (BodyDeclaration)bodyDeclarations.get(i);
- if (each instanceof FieldDeclaration)
- return i;
- }
- return -1;
- }
-
- protected static MethodInvocation createResourceBundleGetter (AST ast, String bundleId, Locale locale) {
- MethodInvocation mi = ast.newMethodInvocation();
-
- mi.setName(ast.newSimpleName("getBundle"));
- mi.setExpression(ast.newName(new String[] { "ResourceBundle" }));
-
- // Add bundle argument
- StringLiteral sl = ast.newStringLiteral();
- sl.setLiteralValue(bundleId);
- mi.arguments().add(sl);
-
- // TODO Add Locale argument
-
- return mi;
- }
-
- public static ASTNode getEnclosingType (CompilationUnit cu, int pos) {
- PositionalTypeFinder typeFinder = new PositionalTypeFinder(pos);
- cu.accept(typeFinder);
- return (typeFinder.getEnclosingAnonymType() != null) ? typeFinder.getEnclosingAnonymType() : typeFinder.getEnclosingType();
+ if (!result)
+ return false;
+
+ result = !result;
+
+ // Check method name
+ for (String method : desc.getMethodName()) {
+ if (method.equals(methodName)) {
+ result = true;
+ break;
+ }
}
-
- public static ASTNode getEnclosingType (ASTNode cu, int pos) {
- PositionalTypeFinder typeFinder = new PositionalTypeFinder(pos);
- cu.accept(typeFinder);
- return (typeFinder.getEnclosingAnonymType() != null) ? typeFinder.getEnclosingAnonymType() : typeFinder.getEnclosingType();
- }
-
- protected static MethodInvocation referenceResource (AST ast, String accessorName, String key, Locale locale) {
- MethodParameterDescriptor accessorDesc = getRBAccessorDesc();
- MethodInvocation mi = ast.newMethodInvocation();
-
- mi.setName(ast.newSimpleName(accessorDesc.getMethodName().get(0)));
-
- // Declare expression
- StringLiteral sl = ast.newStringLiteral();
- sl.setLiteralValue(key);
-
- // TODO define locale expression
- if (mi.arguments().size() == accessorDesc.getPosition())
- mi.arguments().add(sl);
-
- SimpleName name = ast.newSimpleName(accessorName);
- mi.setExpression(name);
-
- return mi;
- }
-
- public static String createResourceReference (String bundleId,
- String key,
- Locale locale,
- IResource resource,
- int typePos,
- String accessorName,
- IDocument doc,
- CompilationUnit cu) {
-
- PositionalTypeFinder typeFinder = new PositionalTypeFinder(typePos);
- cu.accept(typeFinder);
- AnonymousClassDeclaration atd = typeFinder.getEnclosingAnonymType();
- TypeDeclaration td = typeFinder.getEnclosingType();
-
+
+ return result;
+ }
+
+ public static boolean isMatchingMethodParamDesc(
+ MethodInvocation methodInvocation, String literal,
+ MethodParameterDescriptor desc) {
+ boolean result = isMatchingMethodDescriptor(methodInvocation, desc);
+
+ if (!result)
+ return false;
+ else
+ result = false;
+
+ if (methodInvocation.arguments().size() > desc.getPosition()) {
+ if (methodInvocation.arguments().get(desc.getPosition()) instanceof StringLiteral) {
+ StringLiteral sl = (StringLiteral) methodInvocation.arguments()
+ .get(desc.getPosition());
+ if (sl.getLiteralValue().trim().toLowerCase()
+ .equals(literal.toLowerCase()))
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+ public static boolean isMatchingMethodParamDesc(
+ MethodInvocation methodInvocation, StringLiteral literal,
+ MethodParameterDescriptor desc) {
+ int keyParameter = desc.getPosition();
+ boolean result = isMatchingMethodDescriptor(methodInvocation, desc);
+
+ if (!result)
+ return false;
+
+ // Check position within method call
+ StructuralPropertyDescriptor spd = literal.getLocationInParent();
+ if (spd.isChildListProperty()) {
+ List<ASTNode> arguments = (List<ASTNode>) methodInvocation
+ .getStructuralProperty(spd);
+ result = (arguments.size() > keyParameter && arguments
+ .get(keyParameter) == literal);
+ }
+
+ return result;
+ }
+
+ public static ICompilationUnit createCompilationUnit(IResource resource) {
+ // Instantiate a new AST parser
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setResolveBindings(true);
+
+ ICompilationUnit cu = JavaCore.createCompilationUnitFrom(resource
+ .getProject().getFile(resource.getRawLocation()));
+
+ return cu;
+ }
+
+ public static CompilationUnit createCompilationUnit(IDocument document) {
+ // Instantiate a new AST parser
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setResolveBindings(true);
+
+ parser.setSource(document.get().toCharArray());
+ return (CompilationUnit) parser.createAST(null);
+ }
+
+ public static void createImport(IDocument doc, IResource resource,
+ CompilationUnit cu, AST ast, ASTRewrite rewriter,
+ String qualifiedClassName) throws CoreException,
+ BadLocationException {
+
+ ImportFinder impFinder = new ImportFinder(qualifiedClassName);
+
+ cu.accept(impFinder);
+
+ if (!impFinder.isImportFound()) {
+ // ITextFileBufferManager bufferManager =
+ // FileBuffers.getTextFileBufferManager();
+ // IPath path = resource.getFullPath();
+ //
+ // bufferManager.connect(path, LocationKind.IFILE, null);
+ // ITextFileBuffer textFileBuffer =
+ // bufferManager.getTextFileBuffer(doc);
+
+ // TODO create new import
+ ImportDeclaration id = ast.newImportDeclaration();
+ id.setName(ast.newName(qualifiedClassName.split("\\.")));
+ id.setStatic(false);
+
+ ListRewrite lrw = rewriter.getListRewrite(cu, cu.IMPORTS_PROPERTY);
+ lrw.insertFirst(id, null);
+
+ // TextEdit te = rewriter.rewriteAST(doc, null);
+ // te.apply(doc);
+ //
+ // if (textFileBuffer != null)
+ // textFileBuffer.commit(null, false);
+ // else
+ // FileUtils.saveTextFile(resource.getProject().getFile(resource.getProjectRelativePath()),
+ // doc.get());
+ // bufferManager.disconnect(path, LocationKind.IFILE, null);
+ }
+
+ }
+
+ // TODO export initializer specification into a methodinvocationdefinition
+ public static void createResourceBundleReference(IResource resource,
+ int typePos, IDocument doc, String bundleId, Locale locale,
+ boolean globalReference, String variableName, CompilationUnit cu) {
+
+ try {
+
+ if (globalReference) {
+
// retrieve compilation unit from document
- ASTNode node = atd == null ? td : atd;
+ PositionalTypeFinder typeFinder = new PositionalTypeFinder(
+ typePos);
+ cu.accept(typeFinder);
+ ASTNode node = typeFinder.getEnclosingType();
+ ASTNode anonymNode = typeFinder.getEnclosingAnonymType();
+ if (anonymNode != null)
+ node = anonymNode;
+
+ MethodDeclaration meth = typeFinder.getEnclosingMethod();
AST ast = node.getAST();
-
- ExpressionStatement expressionStatement = ast
- .newExpressionStatement(referenceResource(ast, accessorName, key, locale));
-
- String exp = expressionStatement.toString();
-
- // remove semicolon and line break at the end of this expression statement
- if (exp.endsWith(";\n"))
- exp = exp.substring(0, exp.length()-2);
-
- return exp;
- }
-
- private static int findNonInternationalisationPosition(CompilationUnit cu, IDocument doc, int offset){
- LinePreStringsFinder lsfinder = null;
- try {
- lsfinder = new LinePreStringsFinder(offset, doc);
- cu.accept(lsfinder);
- } catch (BadLocationException e) {
- Logger.logError(e);
- }
- if (lsfinder == null) return 1;
-
- List<StringLiteral> strings = lsfinder.getStrings();
-
- return strings.size()+1;
- }
-
- public static void createReplaceNonInternationalisationComment(CompilationUnit cu, IDocument doc, int position) {
- int i = findNonInternationalisationPosition(cu, doc, position);
-
- IRegion reg;
- try {
- reg = doc.getLineInformationOfOffset(position);
- doc.replace(reg.getOffset()+reg.getLength(), 0, " //$NON-NLS-"+i+"$");
- } catch (BadLocationException e) {
- Logger.logError(e);
- }
+
+ VariableDeclarationFragment vdf = ast
+ .newVariableDeclarationFragment();
+ vdf.setName(ast.newSimpleName(variableName));
+
+ // set initializer
+ vdf.setInitializer(createResourceBundleGetter(ast, bundleId,
+ locale));
+
+ FieldDeclaration fd = ast.newFieldDeclaration(vdf);
+ fd.setType(ast.newSimpleType(ast
+ .newName(new String[] { "ResourceBundle" })));
+
+ if (meth != null
+ && (meth.getModifiers() & Modifier.STATIC) == Modifier.STATIC)
+ fd.modifiers().addAll(ast.newModifiers(Modifier.STATIC));
+
+ // rewrite AST
+ ASTRewrite rewriter = ASTRewrite.create(ast);
+ ListRewrite lrw = rewriter
+ .getListRewrite(
+ node,
+ node instanceof TypeDeclaration ? TypeDeclaration.BODY_DECLARATIONS_PROPERTY
+ : AnonymousClassDeclaration.BODY_DECLARATIONS_PROPERTY);
+ lrw.insertAt(fd, /*
+ * findIndexOfLastField(node.bodyDeclarations())
+ * +1
+ */
+ 0, null);
+
+ // create import if required
+ createImport(doc, resource, cu, ast, rewriter,
+ getRBDefinitionDesc().getDeclaringClass());
+
+ TextEdit te = rewriter.rewriteAST(doc, null);
+ te.apply(doc);
+ } else {
+
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
}
-
- private static void createASTNonInternationalisationComment(CompilationUnit cu, IDocument doc, ASTNode parent, ASTNode fd, ASTRewrite rewriter, ListRewrite lrw) {
- int i = 1;
-
-// ListRewrite lrw2 = rewriter.getListRewrite(node, Block.STATEMENTS_PROPERTY);
- ASTNode placeHolder= rewriter.createStringPlaceholder("//$NON-NLS-"+i+"$", ASTNode.LINE_COMMENT);
- lrw.insertAfter(placeHolder, fd, null);
- }
-
- public static boolean existsNonInternationalisationComment(StringLiteral literal) throws BadLocationException {
- CompilationUnit cu = (CompilationUnit) literal.getRoot();
- ICompilationUnit icu = (ICompilationUnit) cu.getJavaElement();
-
- IDocument doc = null;
- try {
- doc = new Document(icu.getSource());
- } catch (JavaModelException e) {
- Logger.logError(e);
- }
-
- // get whole line in which string literal
- int lineNo = doc.getLineOfOffset(literal.getStartPosition());
- int lineOffset = doc.getLineOffset(lineNo);
- int lineLength = doc.getLineLength(lineNo);
- String lineOfString = doc.get(lineOffset, lineLength);
-
- // search for a line comment in this line
- int indexComment = lineOfString.indexOf("//");
-
- if (indexComment == -1)
- return false;
-
- String comment = lineOfString.substring(indexComment);
-
- // remove first "//" of line comment
- comment = comment.substring(2).toLowerCase();
-
- // split line comments, necessary if more NON-NLS comments exist in one line, eg.: $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3
- String[] comments = comment.split("//");
-
- for (String commentFrag : comments) {
- commentFrag = commentFrag.trim();
-
- // if comment match format: "$non-nls$" then ignore whole line
- if (commentFrag.matches("^\\$non-nls\\$$")) {
- return true;
-
- // if comment match format: "$non-nls-{number}$" then only ignore string which is on given position
- } else if (commentFrag.matches("^\\$non-nls-\\d+\\$$")) {
- int iString = findNonInternationalisationPosition(cu, doc, literal.getStartPosition());
- int iComment = new Integer(commentFrag.substring(9,10));
- if (iString == iComment)
- return true;
- }
- }
+ }
+
+ private static int findIndexOfLastField(List bodyDeclarations) {
+ for (int i = bodyDeclarations.size() - 1; i >= 0; i--) {
+ BodyDeclaration each = (BodyDeclaration) bodyDeclarations.get(i);
+ if (each instanceof FieldDeclaration)
+ return i;
+ }
+ return -1;
+ }
+
+ protected static MethodInvocation createResourceBundleGetter(AST ast,
+ String bundleId, Locale locale) {
+ MethodInvocation mi = ast.newMethodInvocation();
+
+ mi.setName(ast.newSimpleName("getBundle"));
+ mi.setExpression(ast.newName(new String[] { "ResourceBundle" }));
+
+ // Add bundle argument
+ StringLiteral sl = ast.newStringLiteral();
+ sl.setLiteralValue(bundleId);
+ mi.arguments().add(sl);
+
+ // TODO Add Locale argument
+
+ return mi;
+ }
+
+ public static ASTNode getEnclosingType(CompilationUnit cu, int pos) {
+ PositionalTypeFinder typeFinder = new PositionalTypeFinder(pos);
+ cu.accept(typeFinder);
+ return (typeFinder.getEnclosingAnonymType() != null) ? typeFinder
+ .getEnclosingAnonymType() : typeFinder.getEnclosingType();
+ }
+
+ public static ASTNode getEnclosingType(ASTNode cu, int pos) {
+ PositionalTypeFinder typeFinder = new PositionalTypeFinder(pos);
+ cu.accept(typeFinder);
+ return (typeFinder.getEnclosingAnonymType() != null) ? typeFinder
+ .getEnclosingAnonymType() : typeFinder.getEnclosingType();
+ }
+
+ protected static MethodInvocation referenceResource(AST ast,
+ String accessorName, String key, Locale locale) {
+ MethodParameterDescriptor accessorDesc = getRBAccessorDesc();
+ MethodInvocation mi = ast.newMethodInvocation();
+
+ mi.setName(ast.newSimpleName(accessorDesc.getMethodName().get(0)));
+
+ // Declare expression
+ StringLiteral sl = ast.newStringLiteral();
+ sl.setLiteralValue(key);
+
+ // TODO define locale expression
+ if (mi.arguments().size() == accessorDesc.getPosition())
+ mi.arguments().add(sl);
+
+ SimpleName name = ast.newSimpleName(accessorName);
+ mi.setExpression(name);
+
+ return mi;
+ }
+
+ public static String createResourceReference(String bundleId, String key,
+ Locale locale, IResource resource, int typePos,
+ String accessorName, IDocument doc, CompilationUnit cu) {
+
+ PositionalTypeFinder typeFinder = new PositionalTypeFinder(typePos);
+ cu.accept(typeFinder);
+ AnonymousClassDeclaration atd = typeFinder.getEnclosingAnonymType();
+ TypeDeclaration td = typeFinder.getEnclosingType();
+
+ // retrieve compilation unit from document
+ ASTNode node = atd == null ? td : atd;
+ AST ast = node.getAST();
+
+ ExpressionStatement expressionStatement = ast
+ .newExpressionStatement(referenceResource(ast, accessorName,
+ key, locale));
+
+ String exp = expressionStatement.toString();
+
+ // remove semicolon and line break at the end of this expression
+ // statement
+ if (exp.endsWith(";\n"))
+ exp = exp.substring(0, exp.length() - 2);
+
+ return exp;
+ }
+
+ private static int findNonInternationalisationPosition(CompilationUnit cu,
+ IDocument doc, int offset) {
+ LinePreStringsFinder lsfinder = null;
+ try {
+ lsfinder = new LinePreStringsFinder(offset, doc);
+ cu.accept(lsfinder);
+ } catch (BadLocationException e) {
+ Logger.logError(e);
+ }
+ if (lsfinder == null)
+ return 1;
+
+ List<StringLiteral> strings = lsfinder.getStrings();
+
+ return strings.size() + 1;
+ }
+
+ public static void createReplaceNonInternationalisationComment(
+ CompilationUnit cu, IDocument doc, int position) {
+ int i = findNonInternationalisationPosition(cu, doc, position);
+
+ IRegion reg;
+ try {
+ reg = doc.getLineInformationOfOffset(position);
+ doc.replace(reg.getOffset() + reg.getLength(), 0, " //$NON-NLS-"
+ + i + "$");
+ } catch (BadLocationException e) {
+ Logger.logError(e);
+ }
+ }
+
+ private static void createASTNonInternationalisationComment(
+ CompilationUnit cu, IDocument doc, ASTNode parent, ASTNode fd,
+ ASTRewrite rewriter, ListRewrite lrw) {
+ int i = 1;
+
+ // ListRewrite lrw2 = rewriter.getListRewrite(node,
+ // Block.STATEMENTS_PROPERTY);
+ ASTNode placeHolder = rewriter.createStringPlaceholder("//$NON-NLS-"
+ + i + "$", ASTNode.LINE_COMMENT);
+ lrw.insertAfter(placeHolder, fd, null);
+ }
+
+ public static boolean existsNonInternationalisationComment(
+ StringLiteral literal) throws BadLocationException {
+ CompilationUnit cu = (CompilationUnit) literal.getRoot();
+ ICompilationUnit icu = (ICompilationUnit) cu.getJavaElement();
+
+ IDocument doc = null;
+ try {
+ doc = new Document(icu.getSource());
+ } catch (JavaModelException e) {
+ Logger.logError(e);
+ }
+
+ // get whole line in which string literal
+ int lineNo = doc.getLineOfOffset(literal.getStartPosition());
+ int lineOffset = doc.getLineOffset(lineNo);
+ int lineLength = doc.getLineLength(lineNo);
+ String lineOfString = doc.get(lineOffset, lineLength);
+
+ // search for a line comment in this line
+ int indexComment = lineOfString.indexOf("//");
+
+ if (indexComment == -1)
+ return false;
+
+ String comment = lineOfString.substring(indexComment);
+
+ // remove first "//" of line comment
+ comment = comment.substring(2).toLowerCase();
+
+ // split line comments, necessary if more NON-NLS comments exist in one line, eg.: $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3
+ String[] comments = comment.split("//");
+
+ for (String commentFrag : comments) {
+ commentFrag = commentFrag.trim();
+
+ // if comment match format: "$non-nls$" then ignore whole line
+ if (commentFrag.matches("^\\$non-nls\\$$")) {
+ return true;
+
+ // if comment match format: "$non-nls-{number}$" then only
+ // ignore string which is on given position
+ } else if (commentFrag.matches("^\\$non-nls-\\d+\\$$")) {
+ int iString = findNonInternationalisationPosition(cu, doc,
+ literal.getStartPosition());
+ int iComment = new Integer(commentFrag.substring(9, 10));
+ if (iString == iComment)
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static StringLiteral getStringAtPos(CompilationUnit cu, int position) {
+ StringFinder strFinder = new StringFinder(position);
+ cu.accept(strFinder);
+ return strFinder.getString();
+ }
+
+ static class PositionalTypeFinder extends ASTVisitor {
+
+ private int position;
+ private TypeDeclaration enclosingType;
+ private AnonymousClassDeclaration enclosingAnonymType;
+ private MethodDeclaration enclosingMethod;
+
+ public PositionalTypeFinder(int pos) {
+ position = pos;
+ }
+
+ public TypeDeclaration getEnclosingType() {
+ return enclosingType;
+ }
+
+ public AnonymousClassDeclaration getEnclosingAnonymType() {
+ return enclosingAnonymType;
+ }
+
+ public MethodDeclaration getEnclosingMethod() {
+ return enclosingMethod;
+ }
+
+ @Override
+ public boolean visit(MethodDeclaration node) {
+ if (position >= node.getStartPosition()
+ && position <= (node.getStartPosition() + node.getLength())) {
+ enclosingMethod = node;
+ return true;
+ } else
return false;
}
-
-
- public static StringLiteral getStringAtPos(CompilationUnit cu, int position) {
- StringFinder strFinder = new StringFinder(position);
- cu.accept(strFinder);
- return strFinder.getString();
- }
-
- static class PositionalTypeFinder extends ASTVisitor {
-
- private int position;
- private TypeDeclaration enclosingType;
- private AnonymousClassDeclaration enclosingAnonymType;
- private MethodDeclaration enclosingMethod;
-
- public PositionalTypeFinder (int pos) {
- position = pos;
- }
-
- public TypeDeclaration getEnclosingType() {
- return enclosingType;
- }
-
- public AnonymousClassDeclaration getEnclosingAnonymType () {
- return enclosingAnonymType;
- }
-
- public MethodDeclaration getEnclosingMethod () {
- return enclosingMethod;
- }
-
- public boolean visit (MethodDeclaration node) {
- if (position >= node.getStartPosition() &&
- position <= (node.getStartPosition() + node.getLength())) {
- enclosingMethod = node;
- return true;
- } else
- return false;
- }
-
- public boolean visit (TypeDeclaration node) {
- if (position >= node.getStartPosition() &&
- position <= (node.getStartPosition() + node.getLength())) {
- enclosingType = node;
- return true;
- } else
- return false;
- }
-
- public boolean visit (AnonymousClassDeclaration node) {
- if (position >= node.getStartPosition() &&
- position <= (node.getStartPosition() + node.getLength())) {
- enclosingAnonymType = node;
- return true;
- } else
- return false;
- }
+
+ @Override
+ public boolean visit(TypeDeclaration node) {
+ if (position >= node.getStartPosition()
+ && position <= (node.getStartPosition() + node.getLength())) {
+ enclosingType = node;
+ return true;
+ } else
+ return false;
}
-
- static class ImportFinder extends ASTVisitor {
-
- String qName;
- boolean importFound = false;
-
- public ImportFinder (String qName) {
- this.qName = qName;
- }
-
- public boolean isImportFound () {
- return importFound;
- }
-
- public boolean visit (ImportDeclaration id) {
- if (id.getName().getFullyQualifiedName().equals(
- qName
- ))
- importFound = true;
-
- return true;
- }
+
+ @Override
+ public boolean visit(AnonymousClassDeclaration node) {
+ if (position >= node.getStartPosition()
+ && position <= (node.getStartPosition() + node.getLength())) {
+ enclosingAnonymType = node;
+ return true;
+ } else
+ return false;
}
-
- static class VariableFinder extends ASTVisitor {
-
- boolean found = false;
- String variableName;
-
- public boolean isVariableFound () {
- return found;
- }
-
- public VariableFinder (String variableName) {
- this.variableName = variableName;
- }
-
- public boolean visit (VariableDeclarationFragment vdf) {
- if (vdf.getName().getFullyQualifiedName().equals(variableName)) {
- found = true;
- return false;
- }
-
- return true;
- }
+ }
+
+ static class ImportFinder extends ASTVisitor {
+
+ String qName;
+ boolean importFound = false;
+
+ public ImportFinder(String qName) {
+ this.qName = qName;
}
-
- static class InMethodBundleDeclFinder extends ASTVisitor {
- String varName;
- String bundleId;
- int pos;
-
- public InMethodBundleDeclFinder (String bundleId, int pos) {
- this.bundleId = bundleId;
- this.pos = pos;
- }
-
- public String getVariableName () {
- return varName;
- }
-
- public boolean visit (VariableDeclarationFragment fdvd) {
- if (fdvd.getStartPosition() > pos)
- return false;
-
-// boolean bStatic = (fdvd.resolveBinding().getModifiers() & Modifier.STATIC) == Modifier.STATIC;
-// if (!bStatic && isStatic)
-// return true;
-
- String tmpVarName = fdvd.getName().getFullyQualifiedName();
-
- if (fdvd.getInitializer() instanceof MethodInvocation) {
- MethodInvocation fdi = (MethodInvocation) fdvd.getInitializer();
- if (isMatchingMethodParamDesc(
- fdi, bundleId, getRBDefinitionDesc()))
- varName = tmpVarName;
- }
- return true;
- }
+
+ public boolean isImportFound() {
+ return importFound;
}
-
- static class BundleDeclarationFinder extends ASTVisitor {
-
- String varName;
- String bundleId;
- ASTNode typeDef;
- boolean isStatic;
-
- public BundleDeclarationFinder (String bundleId, ASTNode td, boolean isStatic) {
- this.bundleId = bundleId;
- this.typeDef = td;
- this.isStatic = isStatic;
- }
- public String getVariableName () {
- return varName;
- }
-
- public boolean visit (MethodDeclaration md) {
- return true;
- }
-
- public boolean visit (FieldDeclaration fd) {
- if (getEnclosingType(typeDef, fd.getStartPosition()) != typeDef)
- return false;
-
- boolean bStatic = (fd.getModifiers() & Modifier.STATIC) == Modifier.STATIC;
- if (!bStatic && isStatic)
- return true;
-
- if (fd.getType() instanceof SimpleType) {
- SimpleType fdType = (SimpleType) fd.getType();
- String typeName = fdType.getName().getFullyQualifiedName();
- String referenceName = getRBDefinitionDesc().getDeclaringClass();
- if (typeName.equals(referenceName) ||
- (referenceName.lastIndexOf(".") >= 0 && typeName.equals(referenceName.substring(referenceName.lastIndexOf(".")+1)))) {
- // Check VariableDeclarationFragment
- if (fd.fragments().size() == 1) {
- if (fd.fragments().get(0) instanceof VariableDeclarationFragment) {
- VariableDeclarationFragment fdvd = (VariableDeclarationFragment) fd.fragments().get(0);
- String tmpVarName = fdvd.getName().getFullyQualifiedName();
-
- if (fdvd.getInitializer() instanceof MethodInvocation) {
- MethodInvocation fdi = (MethodInvocation) fdvd.getInitializer();
- if (isMatchingMethodParamDesc(
- fdi, bundleId, getRBDefinitionDesc()))
- varName = tmpVarName;
- }
- }
- }
- }
- }
- return false;
- }
-
- }
-
- static class LinePreStringsFinder extends ASTVisitor{
- private int position;
- private int line;
- private List<StringLiteral> strings;
- private IDocument document;
-
- public LinePreStringsFinder(int position, IDocument document) throws BadLocationException{
- this.document=document;
- this.position = position;
- line = document.getLineOfOffset(position);
- strings = new ArrayList<StringLiteral>();
- }
-
- public List<StringLiteral> getStrings(){
- return strings;
- }
-
- @Override
- public boolean visit (StringLiteral node){
- try{
- if (line == document.getLineOfOffset(node.getStartPosition()) && node.getStartPosition() < position){
- strings.add(node);
- return true;
- }
- }catch(BadLocationException e){
+ @Override
+ public boolean visit(ImportDeclaration id) {
+ if (id.getName().getFullyQualifiedName().equals(qName))
+ importFound = true;
+
+ return true;
+ }
+ }
+
+ static class VariableFinder extends ASTVisitor {
+
+ boolean found = false;
+ String variableName;
+
+ public boolean isVariableFound() {
+ return found;
+ }
+
+ public VariableFinder(String variableName) {
+ this.variableName = variableName;
+ }
+
+ @Override
+ public boolean visit(VariableDeclarationFragment vdf) {
+ if (vdf.getName().getFullyQualifiedName().equals(variableName)) {
+ found = true;
+ return false;
+ }
+
+ return true;
+ }
+ }
+
+ static class InMethodBundleDeclFinder extends ASTVisitor {
+ String varName;
+ String bundleId;
+ int pos;
+
+ public InMethodBundleDeclFinder(String bundleId, int pos) {
+ this.bundleId = bundleId;
+ this.pos = pos;
+ }
+
+ public String getVariableName() {
+ return varName;
+ }
+
+ @Override
+ public boolean visit(VariableDeclarationFragment fdvd) {
+ if (fdvd.getStartPosition() > pos)
+ return false;
+
+ // boolean bStatic = (fdvd.resolveBinding().getModifiers() &
+ // Modifier.STATIC) == Modifier.STATIC;
+ // if (!bStatic && isStatic)
+ // return true;
+
+ String tmpVarName = fdvd.getName().getFullyQualifiedName();
+
+ if (fdvd.getInitializer() instanceof MethodInvocation) {
+ MethodInvocation fdi = (MethodInvocation) fdvd.getInitializer();
+ if (isMatchingMethodParamDesc(fdi, bundleId,
+ getRBDefinitionDesc()))
+ varName = tmpVarName;
+ }
+ return true;
+ }
+ }
+
+ static class BundleDeclarationFinder extends ASTVisitor {
+
+ String varName;
+ String bundleId;
+ ASTNode typeDef;
+ boolean isStatic;
+
+ public BundleDeclarationFinder(String bundleId, ASTNode td,
+ boolean isStatic) {
+ this.bundleId = bundleId;
+ this.typeDef = td;
+ this.isStatic = isStatic;
+ }
+
+ public String getVariableName() {
+ return varName;
+ }
+
+ @Override
+ public boolean visit(MethodDeclaration md) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(FieldDeclaration fd) {
+ if (getEnclosingType(typeDef, fd.getStartPosition()) != typeDef)
+ return false;
+
+ boolean bStatic = (fd.getModifiers() & Modifier.STATIC) == Modifier.STATIC;
+ if (!bStatic && isStatic)
+ return true;
+
+ if (fd.getType() instanceof SimpleType) {
+ SimpleType fdType = (SimpleType) fd.getType();
+ String typeName = fdType.getName().getFullyQualifiedName();
+ String referenceName = getRBDefinitionDesc()
+ .getDeclaringClass();
+ if (typeName.equals(referenceName)
+ || (referenceName.lastIndexOf(".") >= 0 && typeName
+ .equals(referenceName.substring(referenceName
+ .lastIndexOf(".") + 1)))) {
+ // Check VariableDeclarationFragment
+ if (fd.fragments().size() == 1) {
+ if (fd.fragments().get(0) instanceof VariableDeclarationFragment) {
+ VariableDeclarationFragment fdvd = (VariableDeclarationFragment) fd
+ .fragments().get(0);
+ String tmpVarName = fdvd.getName()
+ .getFullyQualifiedName();
+
+ if (fdvd.getInitializer() instanceof MethodInvocation) {
+ MethodInvocation fdi = (MethodInvocation) fdvd
+ .getInitializer();
+ if (isMatchingMethodParamDesc(fdi, bundleId,
+ getRBDefinitionDesc()))
+ varName = tmpVarName;
+ }
}
- return true;
+ }
}
+ }
+ return false;
}
-
- static class StringFinder extends ASTVisitor {
- private int position;
- private StringLiteral string;
-
- public StringFinder(int position) {
- this.position = position;
- }
-
- public StringLiteral getString(){
- return string;
- }
-
- @Override
- public boolean visit (StringLiteral node) {
- if (position > node.getStartPosition() && position < (node.getStartPosition()+node.getLength()))
- string = node;
- return true;
+
+ }
+
+ static class LinePreStringsFinder extends ASTVisitor {
+ private int position;
+ private int line;
+ private List<StringLiteral> strings;
+ private IDocument document;
+
+ public LinePreStringsFinder(int position, IDocument document)
+ throws BadLocationException {
+ this.document = document;
+ this.position = position;
+ line = document.getLineOfOffset(position);
+ strings = new ArrayList<StringLiteral>();
+ }
+
+ public List<StringLiteral> getStrings() {
+ return strings;
+ }
+
+ @Override
+ public boolean visit(StringLiteral node) {
+ try {
+ if (line == document.getLineOfOffset(node.getStartPosition())
+ && node.getStartPosition() < position) {
+ strings.add(node);
+ return true;
}
+ } catch (BadLocationException e) {
+ }
+ return true;
}
+ }
+
+ static class StringFinder extends ASTVisitor {
+ private int position;
+ private StringLiteral string;
+
+ public StringFinder(int position) {
+ this.position = position;
+ }
+
+ public StringLiteral getString() {
+ return string;
+ }
+
+ @Override
+ public boolean visit(StringLiteral node) {
+ if (position > node.getStartPosition()
+ && position < (node.getStartPosition() + node.getLength()))
+ string = node;
+ return true;
+ }
+ }
}
|
44af0246c480b9421f391dd71376298b43a99e2a
|
Vala
|
Warn about unused attributes
This may not be the best approach, but it's a start
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/compiler/valacompiler.vala b/compiler/valacompiler.vala
index 3f881244de..fe0fdb9ae0 100644
--- a/compiler/valacompiler.vala
+++ b/compiler/valacompiler.vala
@@ -457,6 +457,12 @@ class Vala.Compiler {
context.write_dependencies (dependencies);
}
+ context.used_attr.check_unused (context);
+
+ if (context.report.get_errors () > 0 || (fatal_warnings && context.report.get_warnings () > 0)) {
+ return quit ();
+ }
+
if (!ccode_only) {
var ccompiler = new CCodeCompiler ();
if (cc_command == null && Environment.get_variable ("CC") != null) {
diff --git a/vala/Makefile.am b/vala/Makefile.am
index c7fbc0e4ec..a5a99d173f 100644
--- a/vala/Makefile.am
+++ b/vala/Makefile.am
@@ -156,6 +156,7 @@ libvalacore_la_VALASOURCES = \
valaunlockstatement.vala \
valaunresolvedsymbol.vala \
valaunresolvedtype.vala \
+ valausedattr.vala \
valausingdirective.vala \
valavaluetype.vala \
valavariable.vala \
diff --git a/vala/valacodecontext.vala b/vala/valacodecontext.vala
index 00c242c507..b9ac824c2e 100644
--- a/vala/valacodecontext.vala
+++ b/vala/valacodecontext.vala
@@ -230,10 +230,16 @@ public class Vala.CodeContext {
*/
public CodeGenerator codegen { get; set; }
+ /**
+ * Mark attributes used by the compiler and report unused at the end.
+ */
+ public UsedAttr used_attr { get; set; }
+
public CodeContext () {
resolver = new SymbolResolver ();
analyzer = new SemanticAnalyzer ();
flow_analyzer = new FlowAnalyzer ();
+ used_attr = new UsedAttr ();
}
/**
diff --git a/vala/valausedattr.vala b/vala/valausedattr.vala
new file mode 100644
index 0000000000..ecd4c06221
--- /dev/null
+++ b/vala/valausedattr.vala
@@ -0,0 +1,186 @@
+/* valaunusedattr.vala
+ *
+ * Copyright (C) 2014-2015 Jürg Billeter
+ * Copyright (C) 2014-2015 Luca Bruno
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ * Author:
+ * Luca Bruno <[email protected]>
+ */
+
+using GLib;
+
+/**
+ * Code visitor to warn about unused attributes
+ */
+public class Vala.UsedAttr : CodeVisitor {
+ public Vala.Map<string,Vala.Set<string>> marked = new HashMap<string,Vala.Set<string>> (str_hash, str_equal);
+
+ const string valac_default_attrs[] = {
+ "CCode", "type_signature", "default_value", "set_value_function", "type_id", "cprefix", "cheader_filename",
+ "marshaller_type_name", "get_value_function", "cname", "cheader_filename", "destroy_function", "lvalue_access",
+ "has_type_id", "instance_pos", "const_cname", "take_value_function", "copy_function", "free_function",
+ "param_spec_function", "has_target", "type_cname", "ref_function", "ref_function_void", "unref_function", "type",
+ "has_construct_function", "returns_floating_reference", "gir_namespace", "gir_version", "construct_function",
+ "lower_case_cprefix", "simple_generics", "sentinel", "scope", "has_destroy_function",
+ "has_copy_function", "lower_case_csuffix", "ref_sink_function", "dup_function", "finish_function",
+ "array_length_type", "array_length", "array_length_cname", "array_length_cexpr", "array_null_terminated",
+ "vfunc_name", "finish_name", "free_function_address_of", "pos", "delegate_target", "delegate_target_cname", "",
+
+ "Immutable", "",
+ "Compact", "",
+ "Flags", "",
+ "Experimental", "",
+ "NoReturn", "",
+ "Assert", "",
+ "ErrorBase", "",
+ "Deprecated", "since", "replacement", "",
+
+ "IntegerType", "rank", "min", "max", "",
+ "FloatingType", "rank", "",
+ "BooleanType", "",
+ "SimpleType", "",
+ "PrintfFormat", "",
+
+ "GIR", "name", "",
+
+ };
+
+ public UsedAttr () {
+ // mark default valac attrs
+ var curattr = "";
+ foreach (unowned string val in valac_default_attrs) {
+ if (val == "") {
+ curattr = "";
+ } else {
+ if (curattr == "") {
+ curattr = val;
+ mark (curattr, null);
+ } else {
+ mark (curattr, val);
+ }
+ }
+ }
+ }
+
+ /**
+ * Mark the attribute or attribute argument as used by the compiler
+ */
+ public void mark (string attribute, string? argument) {
+ var set = marked.get (attribute);
+ if (set == null) {
+ set = new HashSet<string> (str_hash, str_equal);
+ marked.set (attribute, set);
+ }
+
+ if (argument != null) {
+ set.add (argument);
+ }
+ }
+
+ /**
+ * Traverse the code tree and warn about unused attributes.
+ *
+ * @param context a code context
+ */
+ public void check_unused (CodeContext context) {
+ context.root.accept (this);
+ }
+
+ void check_unused_attr (Symbol sym) {
+ // optimize by not looking at all the symbols
+ if (sym.used) {
+ foreach (unowned Attribute attr in sym.attributes) {
+ var set = marked.get (attr.name);
+ if (set == null) {
+ Report.warning (attr.source_reference, "attribute `%s' never used".printf (attr.name));
+ } else {
+ foreach (var arg in attr.args.get_keys()) {
+ if (!set.contains (arg)) {
+ Report.warning (attr.source_reference, "argument `%s' never used".printf (arg));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public override void visit_namespace (Namespace ns) {
+ check_unused_attr (ns);
+ ns.accept_children (this);
+ }
+
+ public override void visit_class (Class cl) {
+ check_unused_attr (cl);
+ cl.accept_children (this);
+ }
+
+ public override void visit_struct (Struct st) {
+ check_unused_attr (st);
+ st.accept_children (this);
+ }
+
+ public override void visit_interface (Interface iface) {
+ check_unused_attr (iface);
+ iface.accept_children (this);
+ }
+
+ public override void visit_enum (Enum en) {
+ check_unused_attr (en);
+ en.accept_children (this);
+ }
+
+ public override void visit_error_domain (ErrorDomain ed) {
+ check_unused_attr (ed);
+ ed.accept_children (this);
+ }
+
+ public override void visit_delegate (Delegate cb) {
+ check_unused_attr (cb);
+ cb.accept_children (this);
+ }
+
+ public override void visit_constant (Constant c) {
+ check_unused_attr (c);
+ }
+
+ public override void visit_field (Field f) {
+ check_unused_attr (f);
+ }
+
+ public override void visit_method (Method m) {
+ check_unused_attr (m);
+ m.accept_children (this);
+ }
+
+ public override void visit_creation_method (CreationMethod m) {
+ check_unused_attr (m);
+ m.accept_children (this);
+ }
+
+ public override void visit_formal_parameter (Parameter p) {
+ check_unused_attr (p);
+ }
+
+ public override void visit_property (Property prop) {
+ check_unused_attr (prop);
+ }
+
+ public override void visit_signal (Signal sig) {
+ check_unused_attr (sig);
+ sig.accept_children (this);
+ }
+}
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index 8ce14333b1..7a7c20ee47 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -5016,7 +5016,6 @@ namespace GLib {
}
[Compact]
- [CCode (copy_func = "g_variant_iter_copy", free_func = "g_variant_iter_free")]
public class VariantIter {
public VariantIter (Variant value);
public size_t n_children ();
|
ebe8052d559ef5fac8a93820cf5847a8de5e9e43
|
spring-framework
|
fixed detection of element type in case of nested- collections (SPR-7569)--
|
c
|
https://github.com/spring-projects/spring-framework
|
diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java b/org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
index 72d8d8454ded..59335f2b7a11 100644
--- a/org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
+++ b/org.springframework.core/src/main/java/org/springframework/core/convert/TypeDescriptor.java
@@ -76,6 +76,8 @@ public class TypeDescriptor {
private Field field;
+ private int fieldNestingLevel = 1;
+
private Object value;
private TypeDescriptor elementType;
@@ -133,6 +135,19 @@ public TypeDescriptor(Field field, Class<?> type) {
this.type = type;
}
+ /**
+ * Create a new type descriptor for a field.
+ * Use this constructor when a target conversion point originates from a field.
+ * @param field the field to wrap
+ * @param type the specific type to expose (may be an array/collection element)
+ */
+ private TypeDescriptor(Field field, int nestingLevel, Class<?> type) {
+ Assert.notNull(field, "Field must not be null");
+ this.field = field;
+ this.fieldNestingLevel = nestingLevel;
+ this.type = type;
+ }
+
/**
* Internal constructor for a NULL descriptor.
*/
@@ -397,10 +412,12 @@ public TypeDescriptor forElementType(Class<?> elementType) {
return TypeDescriptor.UNKNOWN;
}
else if (this.methodParameter != null) {
- return new TypeDescriptor(this.methodParameter, elementType);
+ MethodParameter nested = new MethodParameter(this.methodParameter);
+ nested.increaseNestingLevel();
+ return new TypeDescriptor(nested, elementType);
}
else if (this.field != null) {
- return new TypeDescriptor(this.field, elementType);
+ return new TypeDescriptor(this.field, this.fieldNestingLevel + 1, elementType);
}
else {
return TypeDescriptor.valueOf(elementType);
@@ -434,7 +451,7 @@ public int hashCode() {
}
/**
- * A textual representation of the type descriptor (eg. Map<String,Foo>) for use in messages
+ * A textual representation of the type descriptor (eg. Map<String,Foo>) for use in messages.
*/
public String asString() {
return toString();
@@ -442,28 +459,22 @@ public String asString() {
public String toString() {
if (this == TypeDescriptor.NULL) {
- return "[TypeDescriptor.NULL]";
+ return "null";
}
else {
StringBuilder builder = new StringBuilder();
- builder.append("[TypeDescriptor ");
Annotation[] anns = getAnnotations();
for (Annotation ann : anns) {
builder.append("@").append(ann.annotationType().getName()).append(' ');
}
builder.append(ClassUtils.getQualifiedName(getType()));
if (isMap()) {
- Class<?> mapKeyType = getMapKeyType();
- Class<?> valueKeyType = getMapValueType();
- builder.append("<").append(mapKeyType != null ? ClassUtils.getQualifiedName(mapKeyType) : "?");
- builder.append(", ").append(valueKeyType != null ? ClassUtils.getQualifiedName(valueKeyType) : "?");
- builder.append(">");
+ builder.append("<").append(getMapKeyTypeDescriptor());
+ builder.append(", ").append(getMapValueTypeDescriptor()).append(">");
}
else if (isCollection()) {
- Class<?> elementType = getElementType();
- builder.append("<").append(elementType != null ? ClassUtils.getQualifiedName(elementType) : "?").append(">");
+ builder.append("<").append(getElementTypeDescriptor()).append(">");
}
- builder.append("]");
return builder.toString();
}
}
@@ -486,7 +497,7 @@ else if (isCollection()) {
@SuppressWarnings("unchecked")
private Class<?> resolveCollectionElementType() {
if (this.field != null) {
- return GenericCollectionTypeResolver.getCollectionFieldType(this.field);
+ return GenericCollectionTypeResolver.getCollectionFieldType(this.field, this.fieldNestingLevel);
}
else if (this.methodParameter != null) {
return GenericCollectionTypeResolver.getCollectionParameterType(this.methodParameter);
@@ -497,7 +508,10 @@ else if (this.value instanceof Collection) {
return elementType;
}
}
- return (this.type != null ? GenericCollectionTypeResolver.getCollectionType((Class<? extends Collection>) this.type) : null);
+ else if (this.type != null) {
+ return GenericCollectionTypeResolver.getCollectionType((Class<? extends Collection>) this.type);
+ }
+ return null;
}
@SuppressWarnings("unchecked")
@@ -514,7 +528,10 @@ else if (this.value instanceof Map<?, ?>) {
return keyType;
}
}
- return (this.type != null && isMap() ? GenericCollectionTypeResolver.getMapKeyType((Class<? extends Map>) this.type) : null);
+ else if (this.type != null && isMap()) {
+ return GenericCollectionTypeResolver.getMapKeyType((Class<? extends Map>) this.type);
+ }
+ return null;
}
@SuppressWarnings("unchecked")
@@ -531,7 +548,10 @@ else if (this.value instanceof Map<?, ?>) {
return valueType;
}
}
- return (isMap() && this.type != null ? GenericCollectionTypeResolver.getMapValueType((Class<? extends Map>) this.type) : null);
+ else if (this.type != null && isMap()) {
+ return GenericCollectionTypeResolver.getMapValueType((Class<? extends Map>) this.type);
+ }
+ return null;
}
private Annotation[] resolveAnnotations() {
diff --git a/org.springframework.core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java b/org.springframework.core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java
index 4d00866c0840..64f04e66df9c 100644
--- a/org.springframework.core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java
+++ b/org.springframework.core/src/test/java/org/springframework/core/convert/TypeDescriptorTests.java
@@ -16,16 +16,16 @@
package org.springframework.core.convert;
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertTrue;
-import static org.junit.Assert.assertFalse;
-
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+import static org.junit.Assert.assertFalse;
import org.junit.Test;
/**
@@ -33,44 +33,75 @@
*/
public class TypeDescriptorTests {
- List<String> listOfString;
- int[] intArray;
- List<String>[] arrayOfListOfString;
+ public List<String> listOfString;
+
+ public List<List<String>> listOfListOfString = new ArrayList<List<String>>();
+
+ public List<List> listOfListOfUnknown = new ArrayList<List>();
+
+ public int[] intArray;
+
+ public List<String>[] arrayOfListOfString;
+
+ public List<Integer> listField = new ArrayList<Integer>();
+
+ public Map<String, Integer> mapField = new HashMap<String, Integer>();
+
@Test
- public void listDescriptors() throws Exception {
+ public void listDescriptor() throws Exception {
TypeDescriptor typeDescriptor = new TypeDescriptor(TypeDescriptorTests.class.getDeclaredField("listOfString"));
assertFalse(typeDescriptor.isArray());
- assertEquals(List.class,typeDescriptor.getType());
- assertEquals(String.class,typeDescriptor.getElementType());
+ assertEquals(List.class, typeDescriptor.getType());
+ assertEquals(String.class, typeDescriptor.getElementType());
// TODO caught shorten these names but it is OK that they are fully qualified for now
- assertEquals("[TypeDescriptor java.util.List<java.lang.String>]",typeDescriptor.asString());
+ assertEquals("java.util.List<java.lang.String>", typeDescriptor.asString());
+ }
+
+ @Test
+ public void listOfListOfStringDescriptor() throws Exception {
+ TypeDescriptor typeDescriptor = new TypeDescriptor(TypeDescriptorTests.class.getDeclaredField("listOfListOfString"));
+ assertFalse(typeDescriptor.isArray());
+ assertEquals(List.class, typeDescriptor.getType());
+ assertEquals(List.class, typeDescriptor.getElementType());
+ assertEquals(String.class, typeDescriptor.getElementTypeDescriptor().getElementType());
+ assertEquals("java.util.List<java.util.List<java.lang.String>>", typeDescriptor.asString());
}
-
+
@Test
- public void arrayTypeDescriptors() throws Exception {
+ public void listOfListOfUnknownDescriptor() throws Exception {
+ TypeDescriptor typeDescriptor = new TypeDescriptor(TypeDescriptorTests.class.getDeclaredField("listOfListOfUnknown"));
+ assertFalse(typeDescriptor.isArray());
+ assertEquals(List.class, typeDescriptor.getType());
+ assertEquals(List.class, typeDescriptor.getElementType());
+ assertEquals(Object.class, typeDescriptor.getElementTypeDescriptor().getElementType());
+ assertEquals("java.util.List<java.util.List<java.lang.Object>>", typeDescriptor.asString());
+ }
+
+ @Test
+ public void arrayTypeDescriptor() throws Exception {
TypeDescriptor typeDescriptor = new TypeDescriptor(TypeDescriptorTests.class.getDeclaredField("intArray"));
assertTrue(typeDescriptor.isArray());
assertEquals(Integer.TYPE,typeDescriptor.getElementType());
- assertEquals("[TypeDescriptor int[]]",typeDescriptor.asString());
+ assertEquals("int[]",typeDescriptor.asString());
}
@Test
- public void buildingArrayTypeDescriptors() throws Exception {
+ public void buildingArrayTypeDescriptor() throws Exception {
TypeDescriptor typeDescriptor = TypeDescriptor.valueOf(int[].class);
assertTrue(typeDescriptor.isArray());
- assertEquals(Integer.TYPE,typeDescriptor.getElementType());
+ assertEquals(Integer.TYPE ,typeDescriptor.getElementType());
}
-
+
@Test
- public void complexTypeDescriptors() throws Exception {
+ public void complexTypeDescriptor() throws Exception {
TypeDescriptor typeDescriptor = new TypeDescriptor(TypeDescriptorTests.class.getDeclaredField("arrayOfListOfString"));
assertTrue(typeDescriptor.isArray());
assertEquals(List.class,typeDescriptor.getElementType());
// TODO asc notice that the type of the list elements is lost: typeDescriptor.getElementType() should return a TypeDescriptor
- assertEquals("[TypeDescriptor java.util.List[]]",typeDescriptor.asString());
+ assertEquals("java.util.List[]",typeDescriptor.asString());
}
-
+
@Test
public void testEquals() throws Exception {
TypeDescriptor t1 = TypeDescriptor.valueOf(String.class);
@@ -94,9 +125,5 @@ public void testEquals() throws Exception {
TypeDescriptor t12 = new TypeDescriptor(getClass().getField("mapField"));
assertEquals(t11, t12);
}
-
- public List<Integer> listField = new ArrayList<Integer>();
-
- public Map<String, Integer> mapField = new HashMap<String, Integer>();
}
|
12aa442f95c567f3bc1488bb641fca1e9636e9f1
|
restlet-framework-java
|
Fixed issue 210 : a Language tag is composed of a- list of subtags--
|
c
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/module/org.restlet/src/org/restlet/data/Language.java b/module/org.restlet/src/org/restlet/data/Language.java
index 050fea006c..cae571f3ef 100644
--- a/module/org.restlet/src/org/restlet/data/Language.java
+++ b/module/org.restlet/src/org/restlet/data/Language.java
@@ -60,9 +60,6 @@ public final class Language extends Metadata {
public static final Language SPANISH = new Language("es",
"Spanish language");
- /** The metadata main tag taken from the metadata name like "en" for "en-us". */
- private String primaryTag;
-
/** The metadata main list of subtags taken from the metadata name. */
private List<String> subTags;
@@ -117,15 +114,7 @@ public Language(final String name) {
*/
public Language(final String name, final String description) {
super(name, description);
- String[] tags = getName().split("-");
- subTags = new ArrayList<String>();
-
- if (tags.length > 0) {
- primaryTag = tags[0];
- for (int i = 1; i < tags.length; i++) {
- subTags.add(tags[i]);
- }
- }
+ this.subTags = null;
}
/** {@inheritDoc} */
@@ -141,7 +130,29 @@ public boolean equals(final Object object) {
* @return The primary tag.
*/
public String getPrimaryTag() {
- return this.primaryTag;
+ int separator = getName().indexOf('-');
+
+ if (separator == -1) {
+ return getName();
+ } else {
+ return getName().substring(0, separator);
+ }
+ }
+
+ /**
+ * Returns the main tag.
+ *
+ * @return The main tag.
+ */
+ @Deprecated
+ public String getMainTag() {
+ int separator = getName().indexOf('-');
+
+ if (separator == -1) {
+ return getName();
+ } else {
+ return getName().substring(0, separator);
+ }
}
/**
@@ -150,6 +161,17 @@ public String getPrimaryTag() {
* @return The list of subtags for this language Tag.
*/
public List<String> getSubTags() {
+ if (subTags == null) {
+ String[] tags = getName().split("-");
+ subTags = new ArrayList<String>();
+
+ if (tags.length > 0) {
+ for (int i = 1; i < tags.length; i++) {
+ subTags.add(tags[i]);
+ }
+ }
+ }
+
return subTags;
}
|
741dd3b80dc20cf513cf374ad938a1a4fe965887
|
Vala
|
Change many static delegates to has_target = false
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/vapi/fuse.vapi b/vapi/fuse.vapi
index d00a021f35..5b4cc749a0 100644
--- a/vapi/fuse.vapi
+++ b/vapi/fuse.vapi
@@ -48,35 +48,60 @@ namespace Fuse {
void *private_data;
}
- [CCode (cname = "fuse_fill_dir_t")]
- public static delegate int FillDir (void* buf, string name, Posix.Stat? st, Posix.off_t offset);
+ [CCode (cname = "fuse_fill_dir_t", has_target = false)]
+ public delegate int FillDir (void* buf, string name, Posix.Stat? st, Posix.off_t offset);
- public static delegate int GetAttr (string path, Posix.Stat* st);
- public static delegate int Access (string path, int mask);
- public static delegate int ReadLink (string path, char* buf, size_t size);
- public static delegate int ReadDir (string path, void* buf, FillDir filler, Posix.off_t offset, FileInfo fi);
- public static delegate int MkNod (string path, Posix.mode_t mode, Posix.dev_t rdev);
- public static delegate int MkDir (string path, Posix.mode_t mode);
- public static delegate int Unlink (string path);
- public static delegate int RmDir (string path);
- public static delegate int Symlink (string from, string to);
- public static delegate int Rename (string from, string to);
- public static delegate int Link (string from, string to);
- public static delegate int Chmod (string path, Posix.mode_t mode);
- public static delegate int Chown (string path, Posix.uid_t uid, Posix.gid_t gid);
- public static delegate int Truncate (string path, Posix.off_t size);
- public static delegate int Utimens (string path, Posix.timespec[] ts);
- public static delegate int Open (string path, FileInfo fi);
- public static delegate int Read (string path, char* buf, size_t size, Posix.off_t offset, FileInfo fi);
- public static delegate int Write (string path, char* buf, size_t size, Posix.off_t offset, FileInfo fi);
- public static delegate int StatFs (string path, Posix.statvfs *stbuf);
- public static delegate int Release (string path, FileInfo fi);
- public static delegate int Fsync (string path, int isdatasync, FileInfo fi);
+ [CCode (has_target = false)]
+ public delegate int GetAttr (string path, Posix.Stat* st);
+ [CCode (has_target = false)]
+ public delegate int Access (string path, int mask);
+ [CCode (has_target = false)]
+ public delegate int ReadLink (string path, char* buf, size_t size);
+ [CCode (has_target = false)]
+ public delegate int ReadDir (string path, void* buf, FillDir filler, Posix.off_t offset, FileInfo fi);
+ [CCode (has_target = false)]
+ public delegate int MkNod (string path, Posix.mode_t mode, Posix.dev_t rdev);
+ [CCode (has_target = false)]
+ public delegate int MkDir (string path, Posix.mode_t mode);
+ [CCode (has_target = false)]
+ public delegate int Unlink (string path);
+ [CCode (has_target = false)]
+ public delegate int RmDir (string path);
+ [CCode (has_target = false)]
+ public delegate int Symlink (string from, string to);
+ [CCode (has_target = false)]
+ public delegate int Rename (string from, string to);
+ [CCode (has_target = false)]
+ public delegate int Link (string from, string to);
+ [CCode (has_target = false)]
+ public delegate int Chmod (string path, Posix.mode_t mode);
+ [CCode (has_target = false)]
+ public delegate int Chown (string path, Posix.uid_t uid, Posix.gid_t gid);
+ [CCode (has_target = false)]
+ public delegate int Truncate (string path, Posix.off_t size);
+ [CCode (has_target = false)]
+ public delegate int Utimens (string path, Posix.timespec[] ts);
+ [CCode (has_target = false)]
+ public delegate int Open (string path, FileInfo fi);
+ [CCode (has_target = false)]
+ public delegate int Read (string path, char* buf, size_t size, Posix.off_t offset, FileInfo fi);
+ [CCode (has_target = false)]
+ public delegate int Write (string path, char* buf, size_t size, Posix.off_t offset, FileInfo fi);
+ [CCode (has_target = false)]
+ public delegate int StatFs (string path, Posix.statvfs *stbuf);
+ [CCode (has_target = false)]
+ public delegate int Release (string path, FileInfo fi);
+ [CCode (has_target = false)]
+ public delegate int Fsync (string path, int isdatasync, FileInfo fi);
- public static delegate int SetXAttr (string path, string name, char* value, size_t size, int flags);
- public static delegate int GetXAttr (string path, string name, char* value, size_t size);
- public static delegate int ListXAttr (string path, char* list, size_t size);
- public static delegate int RemoveXAttr (string path, string name);
+ [CCode (has_target = false)]
+ public delegate int SetXAttr (string path, string name, char* value, size_t size, int flags);
+ [CCode (has_target = false)]
+ public delegate int GetXAttr (string path, string name, char* value, size_t size);
+ [CCode (has_target = false)]
+ public delegate int ListXAttr (string path, char* list, size_t size);
+ [CCode (has_target = false)]
+ public delegate int RemoveXAttr (string path, string name);
[CCode (cname = "struct fuse_operations")]
public struct Operations {
diff --git a/vapi/gnutls.vapi b/vapi/gnutls.vapi
index a6560d89fe..178357f533 100644
--- a/vapi/gnutls.vapi
+++ b/vapi/gnutls.vapi
@@ -425,8 +425,8 @@ namespace GnuTLS
public bool deinit;
}
- [CCode (cname = "gnutls_params_function *")]
- public static delegate int ParamsFunction (Session session, ParamsType type, Params params);
+ [CCode (cname = "gnutls_params_function *", has_target = false)]
+ public delegate int ParamsFunction (Session session, ParamsType type, Params params);
[CCode (cname = "gnutls_oprfi_callback_func", instance_pos = "1.2")]
public delegate int OprfiCallbackFunc (Session session,
@@ -447,24 +447,24 @@ namespace GnuTLS
[CCode (cname = "TLS_RANDOM_SIZE")]
public const int TLS_RANDOM_SIZE;
- [CCode (cname = "gnutls_db_store_func")]
- public static delegate int DBStoreFunc (void* ptr, Datum key, Datum data);
- [CCode (cname = "gnutls_db_remove_func")]
- public static delegate int DBRemoveFunc (void* ptr, Datum key);
- [CCode (cname = "gnutls_db_retr_func")]
- public static delegate Datum DBRetrieveFunc (void* ptr, Datum key);
+ [CCode (cname = "gnutls_db_store_func", has_target = false)]
+ public delegate int DBStoreFunc (void* ptr, Datum key, Datum data);
+ [CCode (cname = "gnutls_db_remove_func", has_target = false)]
+ public delegate int DBRemoveFunc (void* ptr, Datum key);
+ [CCode (cname = "gnutls_db_retr_func", has_target = false)]
+ public delegate Datum DBRetrieveFunc (void* ptr, Datum key);
- [CCode (cname = "gnutls_handshake_post_client_hello_func")]
- public static delegate int HandshakePostClientHelloFunc (Session session);
+ [CCode (cname = "gnutls_handshake_post_client_hello_func", has_target = false)]
+ public delegate int HandshakePostClientHelloFunc (Session session);
// External signing callback. Experimental.
[CCode (cname = "gnutls_sign_func", instance_pos = "1.9")]
public delegate int SignFunc (Session session, CertificateType cert_type, /* const */ ref Datum cert, /* const */ ref Datum hash, out Datum signature);
- [CCode (cname = "gnutls_pull_func")]
- public static delegate ssize_t PullFunc (void* transport_ptr, void* buffer, size_t count);
- [CCode (cname = "gnutls_push_func")]
- public static delegate ssize_t PushFunc (void* transport_ptr, void* buffer, size_t count);
+ [CCode (cname = "gnutls_pull_func", has_target = false)]
+ public delegate ssize_t PullFunc (void* transport_ptr, void* buffer, size_t count);
+ [CCode (cname = "gnutls_push_func", has_target = false)]
+ public delegate ssize_t PushFunc (void* transport_ptr, void* buffer, size_t count);
[Compact]
[CCode (cname = "struct gnutls_session_int", free_function = "gnutls_deinit")]
@@ -1290,7 +1290,8 @@ namespace GnuTLS
* gnutls_openpgp_set_recv_key_function().
*
*/
- public static delegate int RecvKeyFunc (Session session, uint8[] keyfpr, out Datum key);
+ [CCode (has_target = false)]
+ public delegate int RecvKeyFunc (Session session, uint8[] keyfpr, out Datum key);
[CCode (cname = "gnutls_openpgp_crt_fmt_t", cprefix = "GNUTLS_OPENPGP_FMT_")]
public enum CertificateFormat {
@@ -1434,11 +1435,10 @@ namespace GnuTLS
}
-
- [CCode (cname = "gnutls_certificate_client_retrieve_function *")]
- public static delegate int ClientCertificateRetrieveFunction (Session session, Datum[] req_ca_rdn, PKAlgorithm[] pk_algos, out RetrStruct st);
- [CCode (cname = "gnutls_certificate_server_retrieve_function *")]
- public static delegate int ServerCertificateRetrieveFunction (Session session, out RetrStruct st);
+ [CCode (cname = "gnutls_certificate_client_retrieve_function *", has_target = false)]
+ public delegate int ClientCertificateRetrieveFunction (Session session, Datum[] req_ca_rdn, PKAlgorithm[] pk_algos, out RetrStruct st);
+ [CCode (cname = "gnutls_certificate_server_retrieve_function *", has_target = false)]
+ public delegate int ServerCertificateRetrieveFunction (Session session, out RetrStruct st);
[Compact]
[CCode (cname = "struct gnutls_certificate_credentials_st",
@@ -1525,16 +1525,16 @@ namespace GnuTLS
[CCode (cname = "gnutls_strdup")]
public string strdup (string str);
- [CCode (cname = "gnutls_alloc_function")]
- public static delegate void* AllocFunction (size_t size);
- [CCode (cname = "gnutls_calloc_function")]
- public static delegate void* CallocFunction (size_t count, size_t block_size);
- [CCode (cname = "gnutls_is_secure_function")]
- public static delegate int IsSecureFunction (void* ptr);
- [CCode (cname = "gnutls_free_function")]
- public static delegate void FreeFunction (void* ptr);
- [CCode (cname = "gnutls_realloc_function")]
- public static delegate void* ReallocFunction (void* ptr, size_t new_size);
+ [CCode (cname = "gnutls_alloc_function", has_target = false)]
+ public delegate void* AllocFunction (size_t size);
+ [CCode (cname = "gnutls_calloc_function", has_target = false)]
+ public delegate void* CallocFunction (size_t count, size_t block_size);
+ [CCode (cname = "gnutls_is_secure_function", has_target = false)]
+ public delegate int IsSecureFunction (void* ptr);
+ [CCode (cname = "gnutls_free_function", has_target = false)]
+ public delegate void FreeFunction (void* ptr);
+ [CCode (cname = "gnutls_realloc_function", has_target = false)]
+ public delegate void* ReallocFunction (void* ptr, size_t new_size);
public int global_init ();
public void global_deinit ();
@@ -1544,8 +1544,8 @@ namespace GnuTLS
IsSecureFunction is_secure_func, ReallocFunction realloc_func,
FreeFunction free_func);
- [CCode (cname = "gnutls_log_func")]
- public static delegate void LogFunc (int level, string msg);
+ [CCode (cname = "gnutls_log_func", has_target = false)]
+ public delegate void LogFunc (int level, string msg);
[CCode (cname = "gnutls_global_set_log_function")]
public void set_log_function (LogFunc func);
[CCode (cname = "gnutls_global_set_log_level")]
@@ -1556,10 +1556,10 @@ namespace GnuTLS
// SRP stuff
- [CCode (cname = "gnutls_srp_server_credentials_function *")]
- public static delegate int SRPServerCredentialsFunction (Session session, string username,
- out Datum salt, out Datum verifier,
- out Datum generator, out Datum prime);
+ [CCode (cname = "gnutls_srp_server_credentials_function *", has_target = false)]
+ public delegate int SRPServerCredentialsFunction (Session session, string username,
+ out Datum salt, out Datum verifier,
+ out Datum generator, out Datum prime);
[Compact]
[CCode (cname = "struct gnutls_srp_server_credentials_st", free_function = "gnutls_srp_free_server_credentials")]
@@ -1586,8 +1586,8 @@ namespace GnuTLS
public void set_credentials_function (SRPServerCredentialsFunction func);
}
- [CCode (cname = "gnutls_srp_client_credentials_function *")]
- public static delegate int SRPClientCredentialsFunction (Session session, out string username, out string password);
+ [CCode (cname = "gnutls_srp_client_credentials_function *", has_target = false)]
+ public delegate int SRPClientCredentialsFunction (Session session, out string username, out string password);
[Compact]
[CCode (cname = "struct gnutls_srp_client_credentials_st", free_function = "gnutls_srp_free_client_credentials")]
@@ -1652,8 +1652,8 @@ namespace GnuTLS
HEX
}
- [CCode (cname = "gnutls_psk_server_credentials_function *")]
- public static delegate int PSKServerCredentialsFunction (Session session, string username, /* const */ ref Datum key);
+ [CCode (cname = "gnutls_psk_server_credentials_function *", has_target = false)]
+ public delegate int PSKServerCredentialsFunction (Session session, string username, /* const */ ref Datum key);
[Compact]
[CCode (cname = "struct gnutls_psk_server_credentials_st", free_function = "gnutls_psk_free_server_credentials")]
@@ -1686,8 +1686,8 @@ namespace GnuTLS
public void set_params_function (ParamsFunction func);
}
- [CCode (cname = "gnutls_psk_client_credentials_function *")]
- public static delegate int PSKClientCredentialsFunction (Session session, out string username, out Datum key);
+ [CCode (cname = "gnutls_psk_client_credentials_function *", has_target = false)]
+ public delegate int PSKClientCredentialsFunction (Session session, out string username, out Datum key);
[Compact]
[CCode (cname = "struct gnutls_psk_client_credentials_st", free_function = "gnutls_psk_free_client_credentials")]
diff --git a/vapi/gsl.vapi b/vapi/gsl.vapi
index caa9c09239..bdb5802327 100644
--- a/vapi/gsl.vapi
+++ b/vapi/gsl.vapi
@@ -517,9 +517,11 @@ namespace Gsl
SINGLE,
APPROX
}
-
- public static delegate void ErrorHandler (string reason, string file, int line, int errno);
- public static delegate void StreamHandler (string label, string file, int line, string reason);
+
+ [CCode (has_target = false)]
+ public delegate void ErrorHandler (string reason, string file, int line, int errno);
+ [CCode (has_target = false)]
+ public delegate void StreamHandler (string label, string file, int line, string reason);
[CCode (lower_case_cprefix="gsl_", cheader_filename="gsl/gsl_errno.h")]
namespace Error
@@ -565,9 +567,11 @@ namespace Gsl
}
/* The isnan, isinf and finite are define in the double type. The elementary functions are in GLib.Math */
-
- public static delegate double _Function (double x, void* params);
- public static delegate void _FunctionFdf (double x, void* params, out double f, out double df);
+
+ [CCode (has_target = false)]
+ public delegate double _Function (double x, void* params);
+ [CCode (has_target = false)]
+ public delegate void _FunctionFdf (double x, void* params, out double f, out double df);
[SimpleType]
[CCode (cname="gsl_function", cheader_filename="gsl/gsl_math.h")]
@@ -2537,9 +2541,12 @@ namespace Gsl
/*
* Random Number Generation
*/
- public static delegate void RNGSetState (void *state, ulong seed);
- public static delegate ulong RNGGetState (void* state);
- public static delegate double RNGGetDouble (void* state);
+ [CCode (has_target = false)]
+ public delegate void RNGSetState (void *state, ulong seed);
+ [CCode (has_target = false)]
+ public delegate ulong RNGGetState (void* state);
+ [CCode (has_target = false)]
+ public delegate double RNGGetDouble (void* state);
[SimpleType]
[CCode (cname="gsl_rng_type", cheader_filename="gsl/gsl_rng.h")]
@@ -2790,9 +2797,12 @@ namespace Gsl
/*
* Quasi-Random Sequences
*/
- public static delegate size_t QRNGStateSize (uint dimension);
- public static delegate int QRNGInitState (void* state, uint dimension);
- public static delegate int QRNGGetState2 (void* state, uint dimension, out double x);
+ [CCode (has_target = false)]
+ public delegate size_t QRNGStateSize (uint dimension);
+ [CCode (has_target = false)]
+ public delegate int QRNGInitState (void* state, uint dimension);
+ [CCode (has_target = false)]
+ public delegate int QRNGGetState2 (void* state, uint dimension, out double x);
[SimpleType]
[CCode (cname="gsl_qrng_type", cheader_filename="gsl/gsl_qrng.h")]
@@ -3206,7 +3216,8 @@ namespace Gsl
/*
* N-Tuples
*/
- public static delegate int NTupleFunc (void* ntuple_data, void* params);
+ [CCode (has_target = false)]
+ public delegate int NTupleFunc (void* ntuple_data, void* params);
[SimpleType]
[CCode (cname="gsl_ntuple_select_fn", cheader_filename="gsl/gsl_ntuple.h")]
@@ -3253,7 +3264,8 @@ namespace Gsl
STRATIFIED
}
- public static delegate double MonteFunc ([CCode (array_length = false)] double[] x_array, size_t dim, void* params);
+ [CCode (has_target = false)]
+ public delegate double MonteFunc ([CCode (array_length = false)] double[] x_array, size_t dim, void* params);
[SimpleType]
[CCode (cname="gsl_monte_function", cheader_filanema="gsl/gsl_monte.h")]
@@ -3372,13 +3384,20 @@ namespace Gsl
[CCode (lower_case_cprefix="gsl_siman_", cheader_filename="gsl/gsl_siman.h")]
namespace Siman
{
- public static delegate double Efunc_t (void *xp);
- public static delegate void step_t (RNG r, void *xp, double step_size);
- public static delegate double metric_t (void *xp, void* yp);
- public static delegate void print_t (void* xp);
- public static delegate void copy_t (void* source, void* dest);
- public static delegate void copy_construct_t (void* xp);
- public static delegate void destroy_t (void* xp);
+ [CCode (has_target = false)]
+ public delegate double Efunc_t (void *xp);
+ [CCode (has_target = false)]
+ public delegate void step_t (RNG r, void *xp, double step_size);
+ [CCode (has_target = false)]
+ public delegate double metric_t (void *xp, void* yp);
+ [CCode (has_target = false)]
+ public delegate void print_t (void* xp);
+ [CCode (has_target = false)]
+ public delegate void copy_t (void* source, void* dest);
+ [CCode (has_target = false)]
+ public delegate void copy_construct_t (void* xp);
+ [CCode (has_target = false)]
+ public delegate void destroy_t (void* xp);
public static void solve(RNG r, void *x0_p, Efunc_t Ef, step_t take_step, metric_t distance, print_t print_position, copy_t copyfunc, copy_construct_t copy_constructor, destroy_t destructor, size_t element_size, SimanParams params);
public static void solve_many (RNG r, void *x0_p, Efunc_t Ef, step_t take_step, metric_t distance, print_t print_position, size_t element_size, SimanParams params);
@@ -3396,17 +3415,28 @@ namespace Gsl
DEC
}
- public static delegate int OdeivFunction (double t, [CCode (array_length = false)] double[] y, [CCode (array_length = false)] double[] dydt, void* params);
- public static delegate int OdeivJacobian (double t, [CCode (array_length = false)] double[] y, [CCode (array_length = false)] double[] dfdy, [CCode (array_length = false)] double[] dfdt, void* params);
- public static delegate void* OdeivStepAlloc (size_t dim);
- public static delegate int OdeivStepApply (void* state, size_t dim, double t, double h, [CCode (array_length = false)] double[] y, [CCode (array_length = false)] double[] yerr, [CCode (array_length = false)] double[] dydt_in, [CCode (array_length = false)] double[] dydt_out, OdeivSystem* dydt);
- public static delegate int OdeivStepReset (void* state, size_t dim);
- public static delegate uint OdeivStepOrder (void* state);
- public static delegate void OdeivStepFree (void* state);
- public static delegate void* OdeivControlAlloc ();
- public static delegate int OdeivControlInit (void* state, double eps_abs, double eps_rel, double a_y, double a_dydt);
- public static delegate int OdeivControlHadjust (void* state, size_t dim, uint ord, [CCode (array_length = false)] double[] y, [CCode (array_length = false)] double[] yerr, [CCode (array_length = false)] double[] yp, [CCode (array_length = false)] double[] h);
- public static delegate void OdeivControlFree (void* state);
+ [CCode (has_target = false)]
+ public delegate int OdeivFunction (double t, [CCode (array_length = false)] double[] y, [CCode (array_length = false)] double[] dydt, void* params);
+ [CCode (has_target = false)]
+ public delegate int OdeivJacobian (double t, [CCode (array_length = false)] double[] y, [CCode (array_length = false)] double[] dfdy, [CCode (array_length = false)] double[] dfdt, void* params);
+ [CCode (has_target = false)]
+ public delegate void* OdeivStepAlloc (size_t dim);
+ [CCode (has_target = false)]
+ public delegate int OdeivStepApply (void* state, size_t dim, double t, double h, [CCode (array_length = false)] double[] y, [CCode (array_length = false)] double[] yerr, [CCode (array_length = false)] double[] dydt_in, [CCode (array_length = false)] double[] dydt_out, OdeivSystem* dydt);
+ [CCode (has_target = false)]
+ public delegate int OdeivStepReset (void* state, size_t dim);
+ [CCode (has_target = false)]
+ public delegate uint OdeivStepOrder (void* state);
+ [CCode (has_target = false)]
+ public delegate void OdeivStepFree (void* state);
+ [CCode (has_target = false)]
+ public delegate void* OdeivControlAlloc ();
+ [CCode (has_target = false)]
+ public delegate int OdeivControlInit (void* state, double eps_abs, double eps_rel, double a_y, double a_dydt);
+ [CCode (has_target = false)]
+ public delegate int OdeivControlHadjust (void* state, size_t dim, uint ord, [CCode (array_length = false)] double[] y, [CCode (array_length = false)] double[] yerr, [CCode (array_length = false)] double[] yp, [CCode (array_length = false)] double[] h);
+ [CCode (has_target = false)]
+ public delegate void OdeivControlFree (void* state);
[SimpleType]
[CCode (cname="gsl_odeiv_system", cheader_filename="gsl/gsl_odeiv.h")]
@@ -3522,13 +3552,20 @@ namespace Gsl
/*
* Interpolation
*/
- public static delegate void* InterpAlloc (size_t size);
- public static delegate int InterpInit (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size);
- public static delegate int InterpEval (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size, double x, InterpAccel* i, out double y);
- public static delegate int InterpEvalDeriv (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size, double x, InterpAccel* i, out double y_p);
- public static delegate int InterpEvalDeriv2 (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size, double x, InterpAccel* i, out double y_pp);
- public static delegate int InterpEvalInteg (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size, InterpAccel* i, double a, double b, out double result);
- public static delegate void InterpFree (void* t);
+ [CCode (has_target = false)]
+ public delegate void* InterpAlloc (size_t size);
+ [CCode (has_target = false)]
+ public delegate int InterpInit (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size);
+ [CCode (has_target = false)]
+ public delegate int InterpEval (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size, double x, InterpAccel* i, out double y);
+ [CCode (has_target = false)]
+ public delegate int InterpEvalDeriv (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size, double x, InterpAccel* i, out double y_p);
+ [CCode (has_target = false)]
+ public delegate int InterpEvalDeriv2 (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size, double x, InterpAccel* i, out double y_pp);
+ [CCode (has_target = false)]
+ public delegate int InterpEvalInteg (void* t, [CCode (array_length = false)] double[] xa, [CCode (array_length = false)] double[] ya, size_t size, InterpAccel* i, double a, double b, out double result);
+ [CCode (has_target = false)]
+ public delegate void InterpFree (void* t);
[Compact]
[CCode (cname="gsl_interp_accel", cheader_filname="gsl/gsl_interp.h")]
@@ -3723,7 +3760,8 @@ namespace Gsl
backward = -1
}
- public static delegate int WaveletInit (double** h1, double** g1, double** h2, double** g2, size_t* nc, size_t* offset, size_t member);
+ [CCode (has_target = false)]
+ public delegate int WaveletInit (double** h1, double** g1, double** h2, double** g2, size_t* nc, size_t* offset, size_t member);
[SimpleType]
[CCode (cname="gsl_wavelet_type", cheader_filename="gsl/gsl_wavelet.h")]
@@ -3830,10 +3868,14 @@ namespace Gsl
/*
* One dimensional Root-Finding
*/
- public static delegate int RootFsolverSet (void* state, Function* f, double* root, double x_lower, double x_upper);
- public static delegate int RootFsolverIterate (void* state, Function* f, double* root, double* x_lower, double* x_upper);
- public static delegate int RootFdfsolverSet (void* state, FunctionFdf* f, double* root);
- public static delegate int RootFdfsolverIterate (void* state, FunctionFdf* d, double* root);
+ [CCode (has_target = false)]
+ public delegate int RootFsolverSet (void* state, Function* f, double* root, double x_lower, double x_upper);
+ [CCode (has_target = false)]
+ public delegate int RootFsolverIterate (void* state, Function* f, double* root, double* x_lower, double* x_upper);
+ [CCode (has_target = false)]
+ public delegate int RootFdfsolverSet (void* state, FunctionFdf* f, double* root);
+ [CCode (has_target = false)]
+ public delegate int RootFdfsolverIterate (void* state, FunctionFdf* d, double* root);
[SimpleType]
[CCode (cname="gsl_root_fsolver_type", cheader_filename="gsl/gsl_roots.h")]
@@ -3917,9 +3959,12 @@ namespace Gsl
/*
* One dimensional Minimization
*/
- public static delegate int MinSet (void* state, Function* f, double xminimun, double f_minimum, double x_lower, double f_lower, double x_upper, double f_upper);
- public static delegate int MinIterate (void *state, Function* f, double* x_minimum, double* f_minimum, double* x_lower, double* f_lower, double* x_upper, double* f_upper);
- public static delegate int MinBracketingFunction (Function* f, double* x_minimum, double* f_minimum, double* x_lower, double* f_lower, double* x_upper, double* f_upper, size_t eval_max);
+ [CCode (has_target = false)]
+ public delegate int MinSet (void* state, Function* f, double xminimun, double f_minimum, double x_lower, double f_lower, double x_upper, double f_upper);
+ [CCode (has_target = false)]
+ public delegate int MinIterate (void *state, Function* f, double* x_minimum, double* f_minimum, double* x_lower, double* f_lower, double* x_upper, double* f_upper);
+ [CCode (has_target = false)]
+ public delegate int MinBracketingFunction (Function* f, double* x_minimum, double* f_minimum, double* x_lower, double* f_lower, double* x_upper, double* f_upper, size_t eval_max);
[SimpleType]
[CCode (cname="gsl_min_fminimizer_type", cheader_filename="gsl/gsl_min.h")]
@@ -3973,17 +4018,28 @@ namespace Gsl
/*
* Multidimensional Root-Finding
*/
- public static delegate int MultirootF (Vector x, void* params, Vector f);
- public static delegate int MultirootFAlloc (void* state, size_t n);
- public static delegate int MultirootFSet (void* state, MultirootFunction* function, Vector x, Vector f, Vector dx);
- public static delegate int MultirootFIterate (void* state, MultirootFunction* function, Vector x, Vector f, Vector dx);
- public static delegate void MultirootFFree (void* state);
- public static delegate int MultirootDF (Vector x, void* params, Matrix df);
- public static delegate int MultirootFDF (Vector x, void* params, Vector f, Matrix df);
- public static delegate int MultirootFdfAlloc (void* state, size_t n);
- public static delegate int MultirootFdfSet (void* state, MultirootFunctionFdf* fdf, Vector x, Vector f, Matrix J, Vector dx);
- public static delegate int MultirootFdfIterate (void* state, MultirootFunctionFdf* fdf, Vector x, Vector f, Matrix J, Vector dx);
- public static delegate int MultirootFdfFree (void* state);
+ [CCode (has_target = false)]
+ public delegate int MultirootF (Vector x, void* params, Vector f);
+ [CCode (has_target = false)]
+ public delegate int MultirootFAlloc (void* state, size_t n);
+ [CCode (has_target = false)]
+ public delegate int MultirootFSet (void* state, MultirootFunction* function, Vector x, Vector f, Vector dx);
+ [CCode (has_target = false)]
+ public delegate int MultirootFIterate (void* state, MultirootFunction* function, Vector x, Vector f, Vector dx);
+ [CCode (has_target = false)]
+ public delegate void MultirootFFree (void* state);
+ [CCode (has_target = false)]
+ public delegate int MultirootDF (Vector x, void* params, Matrix df);
+ [CCode (has_target = false)]
+ public delegate int MultirootFDF (Vector x, void* params, Vector f, Matrix df);
+ [CCode (has_target = false)]
+ public delegate int MultirootFdfAlloc (void* state, size_t n);
+ [CCode (has_target = false)]
+ public delegate int MultirootFdfSet (void* state, MultirootFunctionFdf* fdf, Vector x, Vector f, Matrix J, Vector dx);
+ [CCode (has_target = false)]
+ public delegate int MultirootFdfIterate (void* state, MultirootFunctionFdf* fdf, Vector x, Vector f, Matrix J, Vector dx);
+ [CCode (has_target = false)]
+ public delegate int MultirootFdfFree (void* state);
[SimpleType]
[CCode (cname="gsl_multiroot_function", cheader_filename="gsl/gsl_multiroots.h")]
@@ -4100,13 +4156,20 @@ namespace Gsl
/*
* Multidimensional Minimization
*/
- public static delegate double MultiminF (Vector x, void* params);
- public static delegate void MultiminDf (Vector x, void* params, Vector df);
- public static delegate void MultiminFdf (Vector x, void* params, double* f, Vector df);
- public static delegate int MultiminFAlloc (void *state, size_t n);
- public static delegate int MultiminFSet (void* state, MultiminFunction* f, Vector x, double* size);
- public static delegate int MultiminFIterate (void* state, MultiminFunction* f, Vector x, double* size, double* fval);
- public static delegate int MultiminFFree (void* state);
+ [CCode (has_target = false)]
+ public delegate double MultiminF (Vector x, void* params);
+ [CCode (has_target = false)]
+ public delegate void MultiminDf (Vector x, void* params, Vector df);
+ [CCode (has_target = false)]
+ public delegate void MultiminFdf (Vector x, void* params, double* f, Vector df);
+ [CCode (has_target = false)]
+ public delegate int MultiminFAlloc (void *state, size_t n);
+ [CCode (has_target = false)]
+ public delegate int MultiminFSet (void* state, MultiminFunction* f, Vector x, double* size);
+ [CCode (has_target = false)]
+ public delegate int MultiminFIterate (void* state, MultiminFunction* f, Vector x, double* size, double* fval);
+ [CCode (has_target = false)]
+ public delegate int MultiminFFree (void* state);
[SimpleType]
[CCode (cname="gsl_multimin_function", cheader_filename="gsl/gsl_multimin.h")]
@@ -4169,11 +4232,16 @@ namespace Gsl
public static int size (double size, double epsabs);
}
- public static delegate int MultiminFdfAlloc (void *state, size_t n);
- public static delegate int MultiminFdfSet (void* state, MultiminFunctionFdf* fdf, Vector x, double* f, Vector gradient, double step_size, double tol);
- public static delegate int MultiminFdfIterate (void* state, MultiminFunctionFdf* fdf, Vector x, double* f, Vector gradient, Vector dx);
- public static delegate int MultiminFdfRestart (void* state);
- public static delegate int MultiminFdfFree (void* state);
+ [CCode (has_target = false)]
+ public delegate int MultiminFdfAlloc (void *state, size_t n);
+ [CCode (has_target = false)]
+ public delegate int MultiminFdfSet (void* state, MultiminFunctionFdf* fdf, Vector x, double* f, Vector gradient, double step_size, double tol);
+ [CCode (has_target = false)]
+ public delegate int MultiminFdfIterate (void* state, MultiminFunctionFdf* fdf, Vector x, double* f, Vector gradient, Vector dx);
+ [CCode (has_target = false)]
+ public delegate int MultiminFdfRestart (void* state);
+ [CCode (has_target = false)]
+ public delegate int MultiminFdfFree (void* state);
[SimpleType]
[CCode (cname="gsl_multimin_fdfminimizer_type", cheader_filename="gsl/gsl_multimin.h")]
@@ -4273,17 +4341,28 @@ namespace Gsl
/*
* Nonlinear Least-Squares Fitting
*/
- public static delegate int MultifitF (Vector x, void* params, Vector f);
- public static delegate int MultifitFAlloc (void* state, size_t n, size_t p);
- public static delegate int MultifitFSet (void* state, MultifitFunction* function, Vector x, Vector f, Vector dx);
- public static delegate int MultifitFIterate (void* state, MultifitFunction* function, Vector x, Vector f, Vector dx);
- public static delegate void MultifitFFree (void* state);
- public static delegate int MultifitDf (Vector x, void* params, Matrix df);
- public static delegate int MultifitFdf (Vector x, void* params, Vector f, Matrix df);
- public static delegate int MultifitFdfAlloc (void* state, size_t n, size_t p);
- public static delegate int MultifitFdfSet (void* state, MultifitFunctionFdf fdf, Vector x, Vector f, Matrix J, Vector dx);
- public static delegate int MultifitFdfIterate (void* state, MultifitFunctionFdf fdf, Vector x, Vector f, Matrix J, Vector dx);
- public static delegate void MultifitFdfFree (void* state);
+ [CCode (has_target = false)]
+ public delegate int MultifitF (Vector x, void* params, Vector f);
+ [CCode (has_target = false)]
+ public delegate int MultifitFAlloc (void* state, size_t n, size_t p);
+ [CCode (has_target = false)]
+ public delegate int MultifitFSet (void* state, MultifitFunction* function, Vector x, Vector f, Vector dx);
+ [CCode (has_target = false)]
+ public delegate int MultifitFIterate (void* state, MultifitFunction* function, Vector x, Vector f, Vector dx);
+ [CCode (has_target = false)]
+ public delegate void MultifitFFree (void* state);
+ [CCode (has_target = false)]
+ public delegate int MultifitDf (Vector x, void* params, Matrix df);
+ [CCode (has_target = false)]
+ public delegate int MultifitFdf (Vector x, void* params, Vector f, Matrix df);
+ [CCode (has_target = false)]
+ public delegate int MultifitFdfAlloc (void* state, size_t n, size_t p);
+ [CCode (has_target = false)]
+ public delegate int MultifitFdfSet (void* state, MultifitFunctionFdf fdf, Vector x, Vector f, Matrix J, Vector dx);
+ [CCode (has_target = false)]
+ public delegate int MultifitFdfIterate (void* state, MultifitFunctionFdf fdf, Vector x, Vector f, Matrix J, Vector dx);
+ [CCode (has_target = false)]
+ public delegate void MultifitFdfFree (void* state);
[CCode (lower_case_cprefix="gsl_multifit_", cheader_filename="gsl/gsl_multifit_nlin.h")]
namespace Multifit
diff --git a/vapi/hal.vapi b/vapi/hal.vapi
index aa91f4eb37..53753a668b 100644
--- a/vapi/hal.vapi
+++ b/vapi/hal.vapi
@@ -22,8 +22,10 @@
[CCode (cheader_filename = "libhal.h", cprefix = "LibHal")]
namespace Hal {
- public static delegate void DeviceAdded (Context ctx, string udi);
- public static delegate void DeviceRemoved (Context ctx, string udi);
+ [CCode (has_target = false)]
+ public delegate void DeviceAdded (Context ctx, string udi);
+ [CCode (has_target = false)]
+ public delegate void DeviceRemoved (Context ctx, string udi);
[CCode (free_function = "libhal_ctx_free", cprefix = "libhal_ctx_")]
[Compact]
diff --git a/vapi/libbonoboui-2.0.vapi b/vapi/libbonoboui-2.0.vapi
index 3a533eda57..e1cb2a8677 100644
--- a/vapi/libbonoboui-2.0.vapi
+++ b/vapi/libbonoboui-2.0.vapi
@@ -16,5 +16,6 @@ namespace BonoboUI {
{
}
- public static delegate void VerbFn (Component component, void* user_data, string cname);
+ [CCode (has_target = false)]
+ public delegate void VerbFn (Component component, void* user_data, string cname);
}
diff --git a/vapi/libosso.vapi b/vapi/libosso.vapi
index d3c2dbb4fe..1328035004 100644
--- a/vapi/libosso.vapi
+++ b/vapi/libosso.vapi
@@ -146,27 +146,27 @@ namespace Osso {
}
/* Callbacks */
- [CCode (cname = "osso_rpc_cb_f")]
- public static delegate int RpcCallback (string iface, string method, GLib.Array arguments, void* data, out Rpc rpc);
- [CCode (cname = "osso_rpc_async_f")]
- public static delegate int RpcAsync (string iface, string method, out Rpc rpc, void* data);
+ [CCode (cname = "osso_rpc_cb_f", has_target = false)]
+ public delegate int RpcCallback (string iface, string method, GLib.Array arguments, void* data, out Rpc rpc);
+ [CCode (cname = "osso_rpc_async_f", has_target = false)]
+ public delegate int RpcAsync (string iface, string method, out Rpc rpc, void* data);
- [CCode (cname = "osso_application_top_cb_f")]
- public static delegate void ApplicationTopCallback (string arguments, void* data);
- [CCode (cname = "osso_application_autosave_cb_f")]
- public static delegate void ApplicationAutosaveCallback (void* data);
- [CCode (cname = "osso_time_cb_f")]
- public static delegate void TimeCallback (void* data);
- [CCode (cname = "osso_locale_change_cb_f")]
- public static delegate void LocaleChangeCallback (string new_locale, void* data);
- [CCode (cname = "osso_display_event_cb_f")]
- public static delegate void DisplayEventCallback (DisplayState state, void* data);
+ [CCode (cname = "osso_application_top_cb_f", has_target = false)]
+ public delegate void ApplicationTopCallback (string arguments, void* data);
+ [CCode (cname = "osso_application_autosave_cb_f", has_target = false)]
+ public delegate void ApplicationAutosaveCallback (void* data);
+ [CCode (cname = "osso_time_cb_f", has_target = false)]
+ public delegate void TimeCallback (void* data);
+ [CCode (cname = "osso_locale_change_cb_f", has_target = false)]
+ public delegate void LocaleChangeCallback (string new_locale, void* data);
+ [CCode (cname = "osso_display_event_cb_f", has_target = false)]
+ public delegate void DisplayEventCallback (DisplayState state, void* data);
- [CCode (cname = "osso_hw_cb_f*")]
- public static delegate void HWCallback (ref HWState state, void* data);
+ [CCode (cname = "osso_hw_cb_f*", has_target = false)]
+ public delegate void HWCallback (ref HWState state, void* data);
- [CCode (cname = "osso_mime_cb_f")]
- public static delegate void MimeCallback (void* data, string[] args);
+ [CCode (cname = "osso_mime_cb_f", has_target = false)]
+ public delegate void MimeCallback (void* data, string[] args);
/* Structs */
[CCode (cname = "osso_state_t")]
diff --git a/vapi/libusb-1.0.vapi b/vapi/libusb-1.0.vapi
index f9a553f049..3a225f8c1b 100644
--- a/vapi/libusb-1.0.vapi
+++ b/vapi/libusb-1.0.vapi
@@ -303,7 +303,8 @@ namespace LibUSB {
public TransferStatus status;
}
- public static delegate void transfer_cb_fn (Transfer transfer);
+ [CCode (has_target = false)]
+ public delegate void transfer_cb_fn (Transfer transfer);
[Compact, CCode (cname = "struct libusb_transfer", cprefix = "libusb_", free_function = "libusb_free_transfer")]
public class Transfer {
@@ -346,8 +347,10 @@ namespace LibUSB {
public unowned uchar[] get_iso_packet_buffer_simple (int packet);
}
- public static delegate void pollfd_added_cb (int fd, short events, void* user_data);
- public static delegate void pollfd_removed_cb (int fd, void* user_data);
+ [CCode (has_target = false)]
+ public delegate void pollfd_added_cb (int fd, short events, void* user_data);
+ [CCode (has_target = false)]
+ public delegate void pollfd_removed_cb (int fd, void* user_data);
[Compact, CCode (cname = "struct libusb_pollfd")]
public class PollFD {
diff --git a/vapi/libxml-2.0.vapi b/vapi/libxml-2.0.vapi
index f0dfc98130..54f1f80d70 100644
--- a/vapi/libxml-2.0.vapi
+++ b/vapi/libxml-2.0.vapi
@@ -26,11 +26,11 @@
namespace Xml {
/* nanoftp - minimal FTP implementation */
- [CCode (cname = "ftpDataCallback", cheader_filename = "libxml/nanoftp.h")]
- public static delegate void FtpDataCallback (void* userData, [CCode (array_length = false)] char[] data, int len);
+ [CCode (cname = "ftpDataCallback", cheader_filename = "libxml/nanoftp.h", has_target = false)]
+ public delegate void FtpDataCallback (void* userData, [CCode (array_length = false)] char[] data, int len);
- [CCode (cname = "ftpListCallback", cheader_filename = "libxml/nanoftp.h")]
- public static delegate void FtpListCallback (void* userData, string filename, string attrib, string owner, string group, ulong size, int links, int year, string month, int day, int hour, int minute);
+ [CCode (cname = "ftpListCallback", cheader_filename = "libxml/nanoftp.h", has_target = false)]
+ public delegate void FtpListCallback (void* userData, string filename, string attrib, string owner, string group, ulong size, int links, int year, string month, int day, int hour, int minute);
[Compact]
[CCode (cname = "void", free_function = "xmlNanoFTPFreeCtxt", cheader_filename = "libxml/nanoftp.h")]
@@ -802,11 +802,11 @@ namespace Xml {
/* xmlIO - interface for the I/O interfaces used by the parser */
- [CCode (cname = "xmlInputCloseCallback", cheader_filename = "libxml/xmlIO.h")]
- public static delegate int InputCloseCallback (void* context);
+ [CCode (cname = "xmlInputCloseCallback", cheader_filename = "libxml/xmlIO.h", has_target = false)]
+ public delegate int InputCloseCallback (void* context);
- [CCode (cname = "xmlInputReadCallback", cheader_filename = "libxml/xmlIO.h")]
- public static delegate int InputReadCallback (void* context, [CCode (array_length = false)] char[] buffer, int len);
+ [CCode (cname = "xmlInputReadCallback", cheader_filename = "libxml/xmlIO.h", has_target = false)]
+ public delegate int InputReadCallback (void* context, [CCode (array_length = false)] char[] buffer, int len);
/* xmlschemas - incomplete XML Schemas structure implementation */
@@ -1101,7 +1101,8 @@ namespace Xml {
READING
}
- public static delegate void TextReaderErrorFunc (void* arg, string msg, ParserSeverities severity, TextReaderLocator* locator);
+ [CCode (has_target = false)]
+ public delegate void TextReaderErrorFunc (void* arg, string msg, ParserSeverities severity, TextReaderLocator* locator);
/* xpath - XML Path Language implementation */
@@ -1205,98 +1206,98 @@ namespace Xml {
/* SAX CALLBACKS */
- [CCode (cname = "attributeDeclSAXFunc")]
- public static delegate void attributeDeclSAXFunc (void* ctx, string elem, string fullname, int type, int def, string defaultValue, Enumeration* tree);
+ [CCode (cname = "attributeDeclSAXFunc", has_target = false)]
+ public delegate void attributeDeclSAXFunc (void* ctx, string elem, string fullname, int type, int def, string defaultValue, Enumeration* tree);
- [CCode (cname = "attributeSAXFunc")]
- public static delegate void attributeSAXFunc (void* ctx, string name, string value);
+ [CCode (cname = "attributeSAXFunc", has_target = false)]
+ public delegate void attributeSAXFunc (void* ctx, string name, string value);
- [CCode (cname = "cdataBlockSAXFunc")]
- public static delegate void cdataBlockSAXFunc (void* ctx, string value, int len);
+ [CCode (cname = "cdataBlockSAXFunc", has_target = false)]
+ public delegate void cdataBlockSAXFunc (void* ctx, string value, int len);
- [CCode (cname = "charactersSAXFunc")]
- public static delegate void charactersSAXFunc (void* ctx, string ch, int len);
+ [CCode (cname = "charactersSAXFunc", has_target = false)]
+ public delegate void charactersSAXFunc (void* ctx, string ch, int len);
- [CCode (cname = "commentsSAXFunc")]
- public static delegate void commentSAXFunc (void* ctx, string value);
+ [CCode (cname = "commentsSAXFunc", has_target = false)]
+ public delegate void commentSAXFunc (void* ctx, string value);
- [CCode (cname = "elementDeclSAXFunc")]
- public static delegate void elementDeclSAXFunc (void* ctx, string name, int type, ElementContent content);
+ [CCode (cname = "elementDeclSAXFunc", has_target = false)]
+ public delegate void elementDeclSAXFunc (void* ctx, string name, int type, ElementContent content);
- [CCode (cname = "endDocumentSAXFunc")]
- public static delegate void endDocumentSAXFunc (void* ctx);
+ [CCode (cname = "endDocumentSAXFunc", has_target = false)]
+ public delegate void endDocumentSAXFunc (void* ctx);
- [CCode (cname = "endElementNsSAX2Func")]
- public static delegate void endElementNsSAX2Func (void* ctx, string localname, string prefix, string URI);
+ [CCode (cname = "endElementNsSAX2Func", has_target = false)]
+ public delegate void endElementNsSAX2Func (void* ctx, string localname, string prefix, string URI);
- [CCode (cname = "endElementSAXFunc")]
- public static delegate void endElementSAXFunc (void* ctx, string name);
+ [CCode (cname = "endElementSAXFunc", has_target = false)]
+ public delegate void endElementSAXFunc (void* ctx, string name);
- [CCode (cname = "entityDeclSAXFunc")]
- public static delegate void entityDeclSAXFunc (void* ctx, string name, int type, string publicId, string systemId, string content);
+ [CCode (cname = "entityDeclSAXFunc", has_target = false)]
+ public delegate void entityDeclSAXFunc (void* ctx, string name, int type, string publicId, string systemId, string content);
- [CCode (cname = "errorSAXFunc")]
- public static delegate void errorSAXFunc (void* ctx, string msg, ...);
+ [CCode (cname = "errorSAXFunc", has_target = false)]
+ public delegate void errorSAXFunc (void* ctx, string msg, ...);
- [CCode (cname = "externalSubsetSAXFunc")]
- public static delegate void externalSubsetSAXFunc (void* ctx, string name, string ExternalID, string SystemID);
+ [CCode (cname = "externalSubsetSAXFunc", has_target = false)]
+ public delegate void externalSubsetSAXFunc (void* ctx, string name, string ExternalID, string SystemID);
- [CCode (cname = "fatalErrorSAXFunc")]
- public static delegate void fatalErrorSAXFunc (void* ctx, string msg, ...);
+ [CCode (cname = "fatalErrorSAXFunc", has_target = false)]
+ public delegate void fatalErrorSAXFunc (void* ctx, string msg, ...);
- [CCode (cname = "getEntitySAXFunc")]
- public static delegate Entity* getEntitySAXFunc (void* ctx, string name);
+ [CCode (cname = "getEntitySAXFunc", has_target = false)]
+ public delegate Entity* getEntitySAXFunc (void* ctx, string name);
- [CCode (cname = "getParameterEntitySAXFunc")]
- public static delegate Entity* getParameterEntitySAXFunc (void* ctx, string name);
+ [CCode (cname = "getParameterEntitySAXFunc", has_target = false)]
+ public delegate Entity* getParameterEntitySAXFunc (void* ctx, string name);
- [CCode (cname = "hasExternalSubsetSAXFunc")]
- public static delegate int hasExternalSubsetSAXFunc (void* ctx);
+ [CCode (cname = "hasExternalSubsetSAXFunc", has_target = false)]
+ public delegate int hasExternalSubsetSAXFunc (void* ctx);
- [CCode (cname = "hasInternalSubsetSAXFunc")]
- public static delegate int hasInternalSubsetSAXFunc (void* ctx);
+ [CCode (cname = "hasInternalSubsetSAXFunc", has_target = false)]
+ public delegate int hasInternalSubsetSAXFunc (void* ctx);
- [CCode (cname = "ignorableWhitespaceSAXFunc")]
- public static delegate void ignorableWhitespaceSAXFunc (void* ctx, string ch, int len);
+ [CCode (cname = "ignorableWhitespaceSAXFunc", has_target = false)]
+ public delegate void ignorableWhitespaceSAXFunc (void* ctx, string ch, int len);
- [CCode (cname = "internalSubsetSAXFunc")]
- public static delegate void internalSubsetSAXFunc (void* ctx, string name, string ExternalID, string SystemID);
+ [CCode (cname = "internalSubsetSAXFunc", has_target = false)]
+ public delegate void internalSubsetSAXFunc (void* ctx, string name, string ExternalID, string SystemID);
- [CCode (cname = "isStandaloneSAXFunc")]
- public static delegate int isStandaloneSAXFunc (void* ctx);
+ [CCode (cname = "isStandaloneSAXFunc", has_target = false)]
+ public delegate int isStandaloneSAXFunc (void* ctx);
- [CCode (cname = "notationDeclSAXFunc")]
- public static delegate void notationDeclSAXFunc (void* ctx, string name, string publicId, string systemId);
+ [CCode (cname = "notationDeclSAXFunc", has_target = false)]
+ public delegate void notationDeclSAXFunc (void* ctx, string name, string publicId, string systemId);
- [CCode (cname = "processingInstructionSAXFunc")]
- public static delegate void processingInstructionSAXFunc (void* ctx, string target, string data);
+ [CCode (cname = "processingInstructionSAXFunc", has_target = false)]
+ public delegate void processingInstructionSAXFunc (void* ctx, string target, string data);
- [CCode (cname = "referenceSAXFunc")]
- public static delegate void referenceSAXFunc (void* ctx, string name);
+ [CCode (cname = "referenceSAXFunc", has_target = false)]
+ public delegate void referenceSAXFunc (void* ctx, string name);
- // [CCode (cname = "resolveEntitySAXFunc")]
- // public static delegate ParserInput resolveEntitySAXFunc (void* ctx, string publicId, string systemId);
+ // [CCode (cname = "resolveEntitySAXFunc", has_target = false)]
+ // public delegate ParserInput resolveEntitySAXFunc (void* ctx, string publicId, string systemId);
- // [CCode (cname = "setDocumentLocatorSAXFunc")]
- // public static delegate void setDocumentLocatorSAXFunc (void* ctx, SAXLocator loc);
+ // [CCode (cname = "setDocumentLocatorSAXFunc", has_target = false)]
+ // public delegate void setDocumentLocatorSAXFunc (void* ctx, SAXLocator loc);
- [CCode (cname = "startDocumentSAXFunc")]
- public static delegate void startDocumentSAXFunc (void* ctx);
+ [CCode (cname = "startDocumentSAXFunc", has_target = false)]
+ public delegate void startDocumentSAXFunc (void* ctx);
- [CCode (cname = "startElementNsSAX2Func")]
- public static delegate void startElementNsSAX2Func (void* ctx, string localname, string prefix, string URI, int nb_namespaces, [CCode (array_length = false)] string[] namespaces, int nb_attributes, int nb_defaulted, [CCode (array_length = false)] string[] attributes);
+ [CCode (cname = "startElementNsSAX2Func", has_target = false)]
+ public delegate void startElementNsSAX2Func (void* ctx, string localname, string prefix, string URI, int nb_namespaces, [CCode (array_length = false)] string[] namespaces, int nb_attributes, int nb_defaulted, [CCode (array_length = false)] string[] attributes);
- [CCode (cname = "startElementSAXFunc")]
- public static delegate void startElementSAXFunc (void* ctx, string name, [CCode (array_length = false)] string[] atts);
+ [CCode (cname = "startElementSAXFunc", has_target = false)]
+ public delegate void startElementSAXFunc (void* ctx, string name, [CCode (array_length = false)] string[] atts);
- [CCode (cname = "unparsedEntityDeclSAXFunc")]
- public static delegate void unparsedEntityDeclSAXFunc (void* ctx, string name, string publicId, string systemId, string notationName);
+ [CCode (cname = "unparsedEntityDeclSAXFunc", has_target = false)]
+ public delegate void unparsedEntityDeclSAXFunc (void* ctx, string name, string publicId, string systemId, string notationName);
- [CCode (cname = "warningSAXFunc")]
- public static delegate void warningSAXFunc (void* ctx, string msg, ...);
+ [CCode (cname = "warningSAXFunc", has_target = false)]
+ public delegate void warningSAXFunc (void* ctx, string msg, ...);
- [CCode (cname ="xmlStructuredErrorFunc")]
- public static delegate void xmlStructuredErrorFunc (void* ctx, Error* error);
+ [CCode (cname ="xmlStructuredErrorFunc", has_target = false)]
+ public delegate void xmlStructuredErrorFunc (void* ctx, Error* error);
[Compact]
[CCode (cname = "xmlSAXHandler")]
diff --git a/vapi/lua.vapi b/vapi/lua.vapi
index a79f9eeb76..71c081399d 100644
--- a/vapi/lua.vapi
+++ b/vapi/lua.vapi
@@ -121,8 +121,8 @@ namespace Lua {
/* Function prototypes */
- [CCode (cname = "lua_CFunction")]
- public static delegate int CallbackFunc (LuaVM vm);
+ [CCode (cname = "lua_CFunction", has_target = false)]
+ public delegate int CallbackFunc (LuaVM vm);
// functions that read/write blocks when loading/dumping Lua chunks
@@ -142,8 +142,8 @@ namespace Lua {
public delegate void* AllocFunc (void* ptr, size_t osize, size_t nsize);
// Function to be called by the debuger in specific events
- [CCode (cname = "lua_Hook")]
- public static delegate void HookFunc (LuaVM vm, ref Debug ar);
+ [CCode (cname = "lua_Hook", has_target = false)]
+ public delegate void HookFunc (LuaVM vm, ref Debug ar);
[SimpleType]
[CCode (cname = "lua_Debug")]
diff --git a/vapi/tiff.vapi b/vapi/tiff.vapi
index 1b4bf7f973..fc0b368c6c 100644
--- a/vapi/tiff.vapi
+++ b/vapi/tiff.vapi
@@ -187,41 +187,42 @@ namespace Tiff {
[CCode (cname = "uint32")]
public struct ttile_t : uint32 { }
- public static delegate int get (RGBAImage p1, uint32[] p2, uint32 p3, uint32 p4);
- [CCode (cname= "TIFFCloseProc")]
- public static delegate int CloseProc (thandle_t p1);
+ [CCode (has_target = false)]
+ public delegate int get (RGBAImage p1, uint32[] p2, uint32 p3, uint32 p4);
+ [CCode (cname = "TIFFCloseProc", has_target = false)]
+ public delegate int CloseProc (thandle_t p1);
/* ***********************************************************************************
- [CCode (cname= "TIFFErrorHandler")]
- public static delegate void ErrorHandler (string p1, string p2, void* p3);
- [CCode (cname= "TIFFErrorHandlerExt")]
- public static delegate void ErrorHandlerExt (thandle_t p1, string p2, string p3, ...);
+ [CCode (cname = "TIFFErrorHandler", has_target = false)]
+ public delegate void ErrorHandler (string p1, string p2, void* p3);
+ [CCode (cname = "TIFFErrorHandlerExt", has_target = false)]
+ public delegate void ErrorHandlerExt (thandle_t p1, string p2, string p3, ...);
*********************************************************************************** */
- [CCode (cname= "TIFFExtendProc")]
- public static delegate void ExtendProc (TIFF p1);
- [CCode (cname= "TIFFInitMethod")]
- public static delegate int InitMethod (TIFF p1, int p2);
- [CCode (cname= "TIFFMapFileProc")]
- public static delegate int MapFileProc (thandle_t p1, ref tdata_t p2, ref toff_t p3);
- [CCode (cname= "TIFFPrintMethod")]
- public static delegate void PrintMethod (TIFF p1, GLib.FileStream p2, long p3);
- [CCode (cname= "TIFFReadWriteProc")]
- public static delegate tsize_t ReadWriteProc (thandle_t p1, tdata_t p2, tsize_t p3);
- [CCode (cname= "TIFFSeekProc")]
- public static delegate toff_t SeekProc (thandle_t p1, toff_t p2, int p3);
- [CCode (cname= "TIFFSizeProc")]
- public static delegate toff_t SizeProc (thandle_t p1);
- [CCode (cname= "TIFFUnmapFileProc")]
- public static delegate void UnmapFileProc (thandle_t p1, tdata_t p2, toff_t p3);
+ [CCode (cname = "TIFFExtendProc", has_target = false)]
+ public delegate void ExtendProc (TIFF p1);
+ [CCode (cname = "TIFFInitMethod", has_target = false)]
+ public delegate int InitMethod (TIFF p1, int p2);
+ [CCode (cname = "TIFFMapFileProc", has_target = false)]
+ public delegate int MapFileProc (thandle_t p1, ref tdata_t p2, ref toff_t p3);
+ [CCode (cname = "TIFFPrintMethod", has_target = false)]
+ public delegate void PrintMethod (TIFF p1, GLib.FileStream p2, long p3);
+ [CCode (cname = "TIFFReadWriteProc", has_target = false)]
+ public delegate tsize_t ReadWriteProc (thandle_t p1, tdata_t p2, tsize_t p3);
+ [CCode (cname = "TIFFSeekProc", has_target = false)]
+ public delegate toff_t SeekProc (thandle_t p1, toff_t p2, int p3);
+ [CCode (cname = "TIFFSizeProc", has_target = false)]
+ public delegate toff_t SizeProc (thandle_t p1);
+ [CCode (cname = "TIFFUnmapFileProc", has_target = false)]
+ public delegate void UnmapFileProc (thandle_t p1, tdata_t p2, toff_t p3);
/* *************************************************************
- [CCode (cname= "TIFFVGetMethod")]
- public static delegate int VGetMethod (TIFF p1, ttag_t p2, ...);
- [CCode (cname= "TIFFVSetMethod")]
- public static delegate int VSetMethod (TIFF p1, ttag_t p2, ...);
+ [CCode (cname = "TIFFVGetMethod", has_target = false)]
+ public delegate int VGetMethod (TIFF p1, ttag_t p2, ...);
+ [CCode (cname = "TIFFVSetMethod", has_target = false)]
+ public delegate int VSetMethod (TIFF p1, ttag_t p2, ...);
************************************************************* */
- [CCode (cname= "tileContigRoutine")]
- public static delegate void TileContigRoutine (RGBAImage p1, uint32[] p2, uint32 p3, uint32 p4, uint32 p5, uint32 p6, int32 p7, int32 p8, uchar *p9);
- [CCode (cname= "tileSeparateRoutine")]
- public static delegate void TileSeparateRoutine (RGBAImage p1, uint32[] p2, uint32 p3, uint32 p4, uint32 p5, uint32 p6, int32 p7, int32 p8, uchar p9, uchar p10, uchar* p11, uchar* p12);
+ [CCode (cname = "tileContigRoutine", has_target = false)]
+ public delegate void TileContigRoutine (RGBAImage p1, uint32[] p2, uint32 p3, uint32 p4, uint32 p5, uint32 p6, int32 p7, int32 p8, uchar *p9);
+ [CCode (cname = "tileSeparateRoutine", has_target = false)]
+ public delegate void TileSeparateRoutine (RGBAImage p1, uint32[] p2, uint32 p3, uint32 p4, uint32 p5, uint32 p6, int32 p7, int32 p8, uchar p9, uchar p10, uchar* p11, uchar* p12);
public const ttag_t CIELABTORGB_TABLE_RANGE;
public const ttag_t CLEANFAXDATA_CLEAN;
|
bfa0d786a9f0b7db4945914ff0df8723b23604f2
|
arrayexpress$annotare2
|
Added user feedback dialog
|
p
|
https://github.com/arrayexpress/annotare2
|
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/common/client/FeedbackService.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/common/client/FeedbackService.java
new file mode 100644
index 000000000..1e6434c6a
--- /dev/null
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/common/client/FeedbackService.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2009-2014 European Molecular Biology Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package uk.ac.ebi.fg.annotare2.web.gwt.common.client;
+
+import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
+
+@RemoteServiceRelativePath(FeedbackService.NAME)
+public interface FeedbackService extends RemoteService {
+
+ public static final String NAME = "feedbackService";
+
+ public void submitFeedback(String message);
+}
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/common/client/FeedbackServiceAsync.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/common/client/FeedbackServiceAsync.java
new file mode 100644
index 000000000..6ab7aad88
--- /dev/null
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/common/client/FeedbackServiceAsync.java
@@ -0,0 +1,23 @@
+/*
+ * Copyright 2009-2014 European Molecular Biology Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package uk.ac.ebi.fg.annotare2.web.gwt.common.client;
+
+import com.google.gwt.user.client.rpc.AsyncCallback;
+
+public interface FeedbackServiceAsync {
+ void submitFeedback(String message, AsyncCallback<Void> async);
+}
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/activity/EditorTitleBarActivity.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/activity/EditorTitleBarActivity.java
index 7a81e362e..0cbf352f6 100644
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/activity/EditorTitleBarActivity.java
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/activity/EditorTitleBarActivity.java
@@ -24,10 +24,7 @@
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.ui.AcceptsOneWidget;
import com.google.inject.Inject;
-import uk.ac.ebi.fg.annotare2.web.gwt.common.client.AdfServiceAsync;
-import uk.ac.ebi.fg.annotare2.web.gwt.common.client.DataServiceAsync;
-import uk.ac.ebi.fg.annotare2.web.gwt.common.client.SubmissionServiceAsync;
-import uk.ac.ebi.fg.annotare2.web.gwt.common.client.SubmissionValidationServiceAsync;
+import uk.ac.ebi.fg.annotare2.web.gwt.common.client.*;
import uk.ac.ebi.fg.annotare2.web.gwt.common.client.rpc.AsyncCallbackWrapper;
import uk.ac.ebi.fg.annotare2.web.gwt.common.client.rpc.ReportingAsyncCallback;
import uk.ac.ebi.fg.annotare2.web.gwt.common.client.rpc.ReportingAsyncCallback.FailureMessage;
@@ -54,6 +51,7 @@ public class EditorTitleBarActivity extends AbstractActivity implements EditorTi
private final SubmissionValidationServiceAsync validationService;
private final DataServiceAsync dataService;
private final AdfServiceAsync adfService;
+ private final FeedbackServiceAsync feedbackSerivce;
private EventBus eventBus;
@@ -63,13 +61,15 @@ public EditorTitleBarActivity(EditorTitleBarView view,
SubmissionServiceAsync submissionService,
SubmissionValidationServiceAsync validationService,
DataServiceAsync dataService,
- AdfServiceAsync adfService) {
+ AdfServiceAsync adfService,
+ FeedbackServiceAsync feedbackSerivce) {
this.view = view;
this.placeController = placeController;
this.submissionService = submissionService;
this.validationService = validationService;
this.dataService = dataService;
this.adfService = adfService;
+ this.feedbackSerivce = feedbackSerivce;
}
public EditorTitleBarActivity withPlace(Place place) {
@@ -188,4 +188,13 @@ public void importFile(AsyncCallback<Void> callback) {
public String getSubmissionExportUrl() {
return GWT.getModuleBaseURL().replace("/" + GWT.getModuleName(), "") + "export?submissionId=" + getSubmissionId();
}
+
+ @Override
+ public void submitFeedback(String message) {
+ feedbackSerivce.submitFeedback(message, callbackWrap(
+ new ReportingAsyncCallback<Void>(FailureMessage.GENERIC_FAILURE) {
+ @Override
+ public void onSuccess(Void result) {}
+ }));
+ }
}
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/EditorTitleBarView.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/EditorTitleBarView.java
index 5a12f2c4f..f191f57d2 100644
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/EditorTitleBarView.java
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/EditorTitleBarView.java
@@ -21,6 +21,7 @@
import uk.ac.ebi.fg.annotare2.web.gwt.common.shared.SubmissionType;
import uk.ac.ebi.fg.annotare2.web.gwt.common.shared.ValidationResult;
import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.experiment.setup.SetupExpSubmissionView;
+import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget.FeedbackDialog;
/**
* @author Olga Melnichuk
@@ -41,7 +42,7 @@ public interface EditorTitleBarView extends IsWidget {
void criticalUpdateStopped();
- public interface Presenter extends SetupExpSubmissionView.Presenter {
+ public interface Presenter extends SetupExpSubmissionView.Presenter, FeedbackDialog.Presenter {
void validateSubmission(ValidationHandler handler);
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/EditorTitleBarViewImpl.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/EditorTitleBarViewImpl.java
index ebb73bd9a..4e8006aaa 100644
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/EditorTitleBarViewImpl.java
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/EditorTitleBarViewImpl.java
@@ -29,6 +29,7 @@
import uk.ac.ebi.fg.annotare2.web.gwt.common.shared.SubmissionType;
import uk.ac.ebi.fg.annotare2.web.gwt.common.shared.ValidationResult;
import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget.AutoSaveLabel;
+import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget.FeedbackDialog;
import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget.ValidateSubmissionDialog;
import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget.WaitingPopup;
@@ -68,11 +69,14 @@ interface Binder extends UiBinder<HTMLPanel, EditorTitleBarViewImpl> {
private Presenter presenter;
- private WaitingPopup waiting;
+ private final FeedbackDialog feedbackDialog;
+ private final WaitingPopup waitingPopup;
public EditorTitleBarViewImpl() {
Binder uiBinder = GWT.create(Binder.class);
initWidget(uiBinder.createAndBindUi(this));
+ feedbackDialog = new FeedbackDialog();
+ waitingPopup = new WaitingPopup();
}
@Override
@@ -83,6 +87,7 @@ public void setTitle(SubmissionType type, String accession) {
@Override
public void setPresenter(Presenter presenter) {
this.presenter = presenter;
+ feedbackDialog.setPresenter(presenter);
}
@Override
@@ -111,17 +116,15 @@ public void autoSaveStopped(String errorMessage) {
@Override
public void criticalUpdateStarted() {
- if (waiting == null) {
- waiting = new WaitingPopup();
- } else if (!waiting.isShowing()) {
- waiting.show();
+ if (!waitingPopup.isShowing()) {
+ waitingPopup.center();
}
}
@Override
public void criticalUpdateStopped() {
- if (waiting != null && waiting.isShowing()) {
- waiting.hide();
+ if (waitingPopup.isShowing()) {
+ waitingPopup.hide();
}
}
@@ -130,6 +133,11 @@ void onHelpButtonClick(ClickEvent event) {
Window.open("http://www.ebi.ac.uk/fgpt/annotare_help/", "_blank", "");
}
+ @UiHandler("feedbackButton")
+ void onFeedbackButtonClick(ClickEvent event) {
+ feedbackDialog.center();
+ }
+
@UiHandler("validateButton")
void onValidateButtonClick(ClickEvent event) {
final ValidateSubmissionDialog dialog = new ValidateSubmissionDialog();
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FTPUploadDialog.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FTPUploadDialog.java
index 67180c7e1..55c95ba6e 100644
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FTPUploadDialog.java
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FTPUploadDialog.java
@@ -135,6 +135,7 @@ protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
}
}
}
+
private List<String> getPastedData() {
String pastedRows = values.getValue();
List<String> result = new ArrayList<String>();
@@ -143,6 +144,7 @@ private List<String> getPastedData() {
}
return result;
}
+
public interface Presenter {
void onFtpDataSubmit(List<String> data, AsyncCallback<String> callback);
}
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FeedbackDialog.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FeedbackDialog.java
new file mode 100644
index 000000000..5469da62d
--- /dev/null
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FeedbackDialog.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright 2009-2014 European Molecular Biology Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget;
+
+import com.google.gwt.core.client.GWT;
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.uibinder.client.UiBinder;
+import com.google.gwt.uibinder.client.UiField;
+import com.google.gwt.uibinder.client.UiHandler;
+import com.google.gwt.user.client.Command;
+import com.google.gwt.user.client.Event;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.DialogBox;
+import com.google.gwt.user.client.ui.TextArea;
+import com.google.gwt.user.client.ui.Widget;
+
+public class FeedbackDialog extends DialogBox {
+
+ interface Binder extends UiBinder<Widget, FeedbackDialog> {
+ Binder BINDER = GWT.create(Binder.class);
+ }
+
+ @UiField
+ TextArea message;
+
+ @UiField
+ Button cancelButton;
+
+ @UiField
+ Button okButton;
+
+ private Presenter presenter;
+
+ public FeedbackDialog() {
+ setModal(true);
+ setGlassEnabled(true);
+ setText("Have your say");
+
+ setWidget(Binder.BINDER.createAndBindUi(this));
+ }
+
+ public void setPresenter(Presenter presenter) {
+ this.presenter = presenter;
+ }
+
+ @Override
+ public void show() {
+ message.setValue("");
+ super.show();
+ Scheduler.get().scheduleDeferred(new Command() {
+ public void execute() {
+ message.setFocus(true);
+ }
+ });
+ }
+
+ @UiHandler("okButton")
+ void okButtonClicked(ClickEvent event) {
+ presenter.submitFeedback(message.getValue().trim());
+ hide();
+ }
+
+ @UiHandler("cancelButton")
+ void cancelButtonClicked(ClickEvent event) {
+ hide();
+ }
+
+ @Override
+ protected void onPreviewNativeEvent(Event.NativePreviewEvent event) {
+ super.onPreviewNativeEvent(event);
+ if (Event.ONKEYDOWN == event.getTypeInt()) {
+ if (KeyCodes.KEY_ESCAPE == event.getNativeEvent().getKeyCode()) {
+ hide();
+ }
+ }
+ }
+
+ public interface Presenter {
+ void submitFeedback(String message);
+ }
+
+}
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FtpFileDetails.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FtpFileDetails.java
deleted file mode 100644
index ed78ba286..000000000
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FtpFileDetails.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * Copyright 2009-2014 European Molecular Biology Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package uk.ac.ebi.fg.annotare2.web.gwt.editor.client.view.widget;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.*;
-import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.event.DeleteEvent;
-import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.event.DeleteEventHandler;
-import uk.ac.ebi.fg.annotare2.web.gwt.editor.client.event.HasDeleteEventHandlers;
-
-/**
- * @author Olga Melnichuk
- */
-public class FtpFileDetails extends Composite implements HasDeleteEventHandlers {
-
- interface Binder extends UiBinder<Widget, FtpFileDetails> {
- Binder BINDER = GWT.create(Binder.class);
- }
-
- @UiField
- TextBox fileNameBox;
-
- @UiField
- TextBox md5Box;
-
- @UiField
- Anchor cancelIcon;
-
- @UiField
- InlineLabel md5Error;
-
- @UiField
- InlineLabel fileNameError;
-
- @UiField
- InlineLabel error;
-
- private final NotEmptyTextBox notEmptyFileName;
- private final NotEmptyTextBox notEmptyMd5;
-
- public FtpFileDetails() {
- initWidget(Binder.BINDER.createAndBindUi(this));
- notEmptyFileName = new NotEmptyTextBox(fileNameBox, fileNameError);
- notEmptyMd5 = new NotEmptyTextBox(md5Box, md5Error);
- }
-
- public String getFileName() {
- return fileNameBox.getValue().trim();
- }
-
- public String getMd5() {
- return md5Box.getValue().trim();
- }
-
- public boolean isValid() {
- return notEmptyFileName.isValid() && notEmptyMd5.isValid();
- }
-
- public void setError(String errorMessage) {
- error.setText(errorMessage);
- }
-
- public void setEnabled(boolean enabled) {
- fileNameBox.setEnabled(enabled);
- md5Box.setEnabled(enabled);
- cancelIcon.setVisible(enabled);
- }
-
- @Override
- public HandlerRegistration addDeleteEventHandler(DeleteEventHandler handler) {
- return addHandler(handler, DeleteEvent.getType());
- }
-
- @UiHandler("cancelIcon")
- void onCancelClick(ClickEvent event) {
- DeleteEvent.fire(this);
- }
-
- private static class NotEmptyTextBox {
- private final Label label;
- private final TextBox textBox;
-
- private NotEmptyTextBox(TextBox textBox, Label label) {
- this.label = label;
- this.textBox = textBox;
- textBox.addChangeHandler(new ChangeHandler() {
- @Override
- public void onChange(ChangeEvent event) {
- validate();
- }
- });
- }
-
- boolean isValid() {
- return validate();
- }
-
- private boolean validate() {
- boolean isEmpty = isNullOrEmpty(textBox.getValue());
- label.setText(isEmpty ? "Please, specify a value" : "");
- return !isEmpty;
- }
-
- private boolean isNullOrEmpty(String value) {
- return value == null || value.trim().isEmpty();
- }
- }
-}
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/WaitingPopup.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/WaitingPopup.java
index 1cb1805b0..e9cf6f47b 100644
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/WaitingPopup.java
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/WaitingPopup.java
@@ -27,18 +27,6 @@ public WaitingPopup() {
super(false, true);
setWidget(new LoadingIndicator());
setGlassEnabled(true);
- center();
- }
-
- //public void showError(Throwable caught) {
- // panel.showError(caught);
- //}
- //public void showSuccess(String message) {
- // panel.showSuccess(message);
- //}
-
- //public void positionAtWindowCenter(){
- // setPopupPosition(Window.getClientWidth() / 2, Window.getClientHeight() / 2);
- //}
+ }
}
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/AppServletModule.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/AppServletModule.java
index 7f0ad4092..3315ec79c 100644
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/AppServletModule.java
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/AppServletModule.java
@@ -140,6 +140,7 @@ protected void configureServlets() {
serveAndBindRpcService(AdfService.NAME, AdfServiceImpl.class, "EditorApp");
serveAndBindRpcService(SubmissionValidationService.NAME, SubmissionValidationServiceImpl.class, "EditorApp");
serveAndBindRpcService(DataService.NAME, DataServiceImpl.class, "EditorApp");
+ serveAndBindRpcService(FeedbackService.NAME, FeedbackServiceImpl.class, "EditorApp");
bind(HibernateSessionFactoryProvider.class).asEagerSingleton();
bind(HibernateSessionFactory.class).toProvider(HibernateSessionFactoryProvider.class);
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/properties/AnnotareProperties.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/properties/AnnotareProperties.java
index 2c49da463..14a50bc20 100644
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/properties/AnnotareProperties.java
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/properties/AnnotareProperties.java
@@ -117,8 +117,12 @@ public String getEmailSmtpPort() {
return getProperty("mail.smtp.port");
}
- public String getEmailFromAddress() {
- return getProperty("mail.from.address");
+ public String getEmailFromAddress(String templateName) {
+ if (hasProperty("mail.from." + templateName.trim()))
+ return getProperty("mail.from." + templateName.trim());
+ else {
+ return getProperty("mail.from.address");
+ }
}
public String getEmailBccAddress() {
@@ -256,6 +260,10 @@ private String getProperty(String key) {
return properties.getProperty(key);
}
+ private boolean hasProperty(String key) {
+ return properties.containsKey(key);
+ }
+
private Properties load() {
Properties defaults = load("/Annotare-default.properties", new Properties());
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/rpc/FeedbackServiceImpl.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/rpc/FeedbackServiceImpl.java
new file mode 100644
index 000000000..90dd0f461
--- /dev/null
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/rpc/FeedbackServiceImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2009-2014 European Molecular Biology Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package uk.ac.ebi.fg.annotare2.web.server.rpc;
+
+import com.google.common.collect.ImmutableMap;
+import com.google.inject.Inject;
+import uk.ac.ebi.fg.annotare2.db.model.User;
+import uk.ac.ebi.fg.annotare2.web.gwt.common.client.FeedbackService;
+import uk.ac.ebi.fg.annotare2.web.server.services.AccountService;
+import uk.ac.ebi.fg.annotare2.web.server.services.EmailSender;
+
+import javax.mail.MessagingException;
+
+public class FeedbackServiceImpl extends AuthBasedRemoteService implements FeedbackService {
+
+ private final EmailSender email;
+
+ @Inject
+ public FeedbackServiceImpl(AccountService accountService, EmailSender emailSender) {
+ super(accountService, emailSender);
+ this.email = emailSender;
+ }
+
+ public void submitFeedback(String message) {
+ User u = getCurrentUser();
+ try {
+ email.sendFromTemplate(EmailSender.FEEDBACK_TEMPLATE,
+ ImmutableMap.of(
+ "from.name", u.getName(),
+ "from.email", u.getEmail(),
+ "feedback.message", message
+ ));
+ } catch (MessagingException x) {
+ //
+ }
+ }
+}
diff --git a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/services/EmailSender.java b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/services/EmailSender.java
index 6ae9c983a..4e4c8e626 100644
--- a/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/services/EmailSender.java
+++ b/app/web/src/main/java/uk/ac/ebi/fg/annotare2/web/server/services/EmailSender.java
@@ -58,6 +58,7 @@ public class EmailSender {
public static final String REJECTED_SUBMISSION_TEMPLATE = "rejected-submission";
public static final String ACCESSION_UPDATE_TEMPLATE = "accession-update-submission";
public static final String EXCEPTION_REPORT_TEMPLATE = "exception-report";
+ public static final String FEEDBACK_TEMPLATE = "general-feedback";
@Inject
public EmailSender(AnnotareProperties properties) {
@@ -91,12 +92,14 @@ public void sendException(String note, Throwable x) {
public void sendFromTemplate(String template, Map<String, String> parameters)
throws MessagingException {
StrSubstitutor sub = new StrSubstitutor(parameters);
+
+ String from = sub.replace(properties.getEmailFromAddress(template));
String to = sub.replace(properties.getEmailToAddress(template));
String bcc = properties.getEmailBccAddress();
String subject = sub.replace(properties.getEmailSubject(template));
String body = sub.replace(properties.getEmailTemplate(template));
if (null != to) {
- send(to, bcc, subject, body, properties.getEmailFromAddress());
+ send(to, bcc, subject, body, from);
}
}
@@ -133,15 +136,15 @@ private void send(String recipients, String hiddenRecipients, String subject, St
}
InternetAddress[] parseAddresses(String addresses) throws AddressException {
- InternetAddress[] recips = InternetAddress.parse(addresses, false);
- for(int i=0; i<recips.length; i++) {
+ InternetAddress[] recipients = InternetAddress.parse(addresses, false);
+ for(int i=0; i<recipients.length; i++) {
try {
- recips[i] = new InternetAddress(recips[i].getAddress(), recips[i].getPersonal(), UTF8);
+ recipients[i] = new InternetAddress(recipients[i].getAddress(), recipients[i].getPersonal(), UTF8);
} catch(UnsupportedEncodingException e) {
throw new RuntimeException("Unable to set encoding", e);
}
}
- return recips;
+ return recipients;
}
private String getStackTrace(Throwable x) {
diff --git a/app/web/src/main/resources/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FeedbackDialog.ui.xml b/app/web/src/main/resources/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FeedbackDialog.ui.xml
new file mode 100644
index 000000000..b72ed75ed
--- /dev/null
+++ b/app/web/src/main/resources/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FeedbackDialog.ui.xml
@@ -0,0 +1,55 @@
+<!--
+ ~ Copyright 2009-2014 European Molecular Biology Laboratory
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
+<ui:UiBinder
+ xmlns:ui="urn:ui:com.google.gwt.uibinder"
+ xmlns:g="urn:import:com.google.gwt.user.client.ui">
+
+ <ui:style>
+ .textarea {
+ height: 100%;
+ width: 100%;
+ position: relative;
+ box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ }
+ </ui:style>
+
+ <g:ResizeLayoutPanel width="540px" height="320px">
+ <g:DockLayoutPanel>
+ <g:north size="30">
+ <g:Label>We value your feedback. Please leave your comments below:</g:Label>
+ </g:north>
+ <g:center>
+ <g:TextArea ui:field="message" addStyleNames="{style.textarea}"/>
+ </g:center>
+ <g:south size="50">
+ <g:HTMLPanel>
+ <table style="width:100%;height:100%">
+ <tr>
+ <td align="right" valign="bottom">
+ <g:Button ui:field="cancelButton">Cancel</g:Button>
+ <g:Button ui:field="okButton">Send</g:Button>
+ </td>
+ </tr>
+ </table>
+ </g:HTMLPanel>
+ </g:south>
+ </g:DockLayoutPanel>
+ </g:ResizeLayoutPanel>
+</ui:UiBinder>
\ No newline at end of file
diff --git a/app/web/src/main/resources/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FtpFileDetails.ui.xml b/app/web/src/main/resources/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FtpFileDetails.ui.xml
deleted file mode 100644
index 98b57df69..000000000
--- a/app/web/src/main/resources/uk/ac/ebi/fg/annotare2/web/gwt/editor/client/view/widget/FtpFileDetails.ui.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<!--
- ~ Copyright 2009-2014 European Molecular Biology Laboratory
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or impl
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
-<ui:UiBinder
- xmlns:ui="urn:ui:com.google.gwt.uibinder"
- xmlns:g="urn:import:com.google.gwt.user.client.ui">
- <ui:style>
- .label {
- font-weight: bolder;
- }
- .error {
- color: red;
- font-weight: normal;
- }
- </ui:style>
- <g:HTMLPanel>
- <table width="100%">
- <tr>
- <td>
- <table width="100%">
- <tr>
- <td width="50%" class="{style.label}">Filename:
- <g:InlineLabel ui:field="fileNameError" addStyleNames="{style.error}"/>
- </td>
- <td width="50%" class="{style.label}">MD5:
- <g:InlineLabel ui:field="md5Error" addStyleNames="{style.error}"/>
- </td>
- </tr>
- <tr>
- <td>
- <g:TextBox ui:field="fileNameBox" width="100%"/>
- </td>
- <td>
- <g:TextBox ui:field="md5Box" width="100%"/>
- </td>
- </tr>
- </table>
- </td>
- <td width="50px" valign="bottom" style="padding-bottom:10px">
- <g:Anchor ui:field="cancelIcon" styleName="wgt-button" title="Delete File Details">
- <span class="wgt-cancelIcon"/>
- </g:Anchor>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <g:InlineLabel ui:field="error" addStyleNames="{style.error}"/>
- </td>
- </tr>
- </table>
- </g:HTMLPanel>
-</ui:UiBinder>
\ No newline at end of file
|
869a002cae63a4e8ab52ec7f2d15d5a2cfbe0c02
|
drools
|
[DROOLS-839] fix LogicTransformer with Accumulate--
|
c
|
https://github.com/kiegroup/drools
|
diff --git a/drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java b/drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java
index a51607b4be5..db57691e305 100644
--- a/drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java
+++ b/drools-compiler/src/test/java/org/drools/compiler/integrationtests/AccumulateTest.java
@@ -84,10 +84,10 @@
public class AccumulateTest extends CommonTestMethodBase {
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateModify() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateModify.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateModify.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -113,7 +113,7 @@ public void testAccumulateModify() throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -124,9 +124,9 @@ public void testAccumulateModify() throws Exception {
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 24,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -136,9 +136,9 @@ public void testAccumulateModify() throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 31,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 4th scenario
wm.delete( cheeseHandles[3] );
@@ -146,15 +146,15 @@ public void testAccumulateModify() throws Exception {
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulate() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_Accumulate.drl");
+ KieSession wm = getKieSessionFromResources( "test_Accumulate.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -173,10 +173,10 @@ public void testAccumulate() throws Exception {
150 ) );
wm.fireAllRules();
-
+
System.out.println( results );
-
- assertEquals( 5,
+
+ assertEquals( 5,
results.size() );
assertEquals( 165, results.get( 0 ) );
@@ -186,11 +186,11 @@ public void testAccumulate() throws Exception {
assertEquals( 210, results.get( 4 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testMVELAccumulate() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateMVEL.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateMVEL.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
results );
@@ -216,10 +216,10 @@ public void testMVELAccumulate() throws Exception {
assertEquals( 210, results.get( 4 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateModifyMVEL() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateModifyMVEL.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateModifyMVEL.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -245,7 +245,7 @@ public void testAccumulateModifyMVEL() throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -256,9 +256,9 @@ public void testAccumulateModifyMVEL() throws Exception {
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 24,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -268,24 +268,24 @@ public void testAccumulateModifyMVEL() throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 31,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
+ wm.delete( cheeseHandles[3] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateReverseModify() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateReverseModify.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateReverseModify.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
results );
@@ -310,7 +310,7 @@ public void testAccumulateReverseModify() throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -321,9 +321,9 @@ public void testAccumulateReverseModify() throws Exception {
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 24,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -336,24 +336,24 @@ public void testAccumulateReverseModify() throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 36,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
+ wm.delete( cheeseHandles[3] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateReverseModify2() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateReverseModify2.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateReverseModify2.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -379,7 +379,7 @@ public void testAccumulateReverseModify2() throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -390,9 +390,9 @@ public void testAccumulateReverseModify2() throws Exception {
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 24,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -405,24 +405,24 @@ public void testAccumulateReverseModify2() throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 36,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
+ wm.delete( cheeseHandles[3] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
-
- @Test (timeout = 10000)
+
+ @Test(timeout = 10000)
public void testAccumulateReverseModifyInsertLogical2() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateReverseModifyInsertLogical2.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateReverseModifyInsertLogical2.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -453,18 +453,18 @@ public void testAccumulateReverseModifyInsertLogical2() throws Exception {
// alice = 31, bob = 17, carol = 0, doug = 17
// !alice = 34, !bob = 31, !carol = 65, !doug = 31
wm.fireAllRules();
- assertEquals( 31, ((Number) results.get( results.size() - 1 )).intValue() );
+ assertEquals( 31, ( (Number) results.get( results.size() - 1 ) ).intValue() );
// delete stilton=2 ==> bob = 15, doug = 15, !alice = 30, !carol = 61
- wm.delete(cheeseHandles[1]);
+ wm.delete( cheeseHandles[1] );
wm.fireAllRules();
- assertEquals( 30, ((Number) results.get( results.size() - 1 )).intValue() );
- }
+ assertEquals( 30, ( (Number) results.get( results.size() - 1 ) ).intValue() );
+ }
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateReverseModifyMVEL() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateReverseModifyMVEL.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateReverseModifyMVEL.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -490,7 +490,7 @@ public void testAccumulateReverseModifyMVEL() throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -501,9 +501,9 @@ public void testAccumulateReverseModifyMVEL() throws Exception {
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 24,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -513,24 +513,24 @@ public void testAccumulateReverseModifyMVEL() throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 31,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
+ wm.delete( cheeseHandles[3] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateReverseModifyMVEL2() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateReverseModifyMVEL2.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateReverseModifyMVEL2.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -556,7 +556,7 @@ public void testAccumulateReverseModifyMVEL2() throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -569,7 +569,7 @@ public void testAccumulateReverseModifyMVEL2() throws Exception {
assertEquals( 1,
results.size() );
assertEquals( 24,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -581,22 +581,22 @@ public void testAccumulateReverseModifyMVEL2() throws Exception {
assertEquals( 2,
results.size() );
assertEquals( 31,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
+ wm.delete( cheeseHandles[3] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithFromChaining() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateWithFromChaining.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateWithFromChaining.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -629,7 +629,7 @@ public void testAccumulateWithFromChaining() throws Exception {
assertEquals( 1,
results.size() );
assertEquals( 3,
- ((List) results.get( results.size() - 1 )).size() );
+ ( (List) results.get( results.size() - 1 ) ).size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -651,9 +651,9 @@ public void testAccumulateWithFromChaining() throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 3,
- ((List) results.get( results.size() - 1 )).size() );
+ ( (List) results.get( results.size() - 1 ) ).size() );
// ---------------- 4th scenario
cheesery.getCheeses().remove( cheese[3] );
@@ -663,11 +663,11 @@ public void testAccumulateWithFromChaining() throws Exception {
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testMVELAccumulate2WM() throws Exception {
// read in the source
@@ -725,11 +725,11 @@ public void testMVELAccumulate2WM() throws Exception {
assertEquals( 210, results2.get( 4 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateInnerClass() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateInnerClass.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateInnerClass.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -743,11 +743,11 @@ public void testAccumulateInnerClass() throws Exception {
assertEquals( 15, results.get( 0 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateReturningNull() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateReturningNull.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateReturningNull.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -757,120 +757,120 @@ public void testAccumulateReturningNull() throws Exception {
10 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateSumJava() throws Exception {
execTestAccumulateSum( "test_AccumulateSum.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateSumMVEL() throws Exception {
execTestAccumulateSum( "test_AccumulateSumMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMultiPatternWithFunctionJava() throws Exception {
execTestAccumulateSum( "test_AccumulateMultiPatternFunctionJava.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMultiPatternWithFunctionMVEL() throws Exception {
execTestAccumulateSum( "test_AccumulateMultiPatternFunctionMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateCountJava() throws Exception {
execTestAccumulateCount( "test_AccumulateCount.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateCountMVEL() throws Exception {
execTestAccumulateCount( "test_AccumulateCountMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateAverageJava() throws Exception {
execTestAccumulateAverage( "test_AccumulateAverage.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateAverageMVEL() throws Exception {
execTestAccumulateAverage( "test_AccumulateAverageMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMinJava() throws Exception {
execTestAccumulateMin( "test_AccumulateMin.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMinMVEL() throws Exception {
execTestAccumulateMin( "test_AccumulateMinMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMaxJava() throws Exception {
execTestAccumulateMax( "test_AccumulateMax.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMaxMVEL() throws Exception {
execTestAccumulateMax( "test_AccumulateMaxMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMultiPatternJava() throws Exception {
execTestAccumulateReverseModifyMultiPattern( "test_AccumulateMultiPattern.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMultiPatternMVEL() throws Exception {
execTestAccumulateReverseModifyMultiPattern( "test_AccumulateMultiPatternMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateCollectListJava() throws Exception {
execTestAccumulateCollectList( "test_AccumulateCollectList.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateCollectListMVEL() throws Exception {
execTestAccumulateCollectList( "test_AccumulateCollectListMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateCollectSetJava() throws Exception {
execTestAccumulateCollectSet( "test_AccumulateCollectSet.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateCollectSetMVEL() throws Exception {
execTestAccumulateCollectSet( "test_AccumulateCollectSetMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMultipleFunctionsJava() throws Exception {
execTestAccumulateMultipleFunctions( "test_AccumulateMultipleFunctions.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMultipleFunctionsMVEL() throws Exception {
execTestAccumulateMultipleFunctions( "test_AccumulateMultipleFunctionsMVEL.drl" );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMultipleFunctionsConstraint() throws Exception {
execTestAccumulateMultipleFunctionsConstraint( "test_AccumulateMultipleFunctionsConstraint.drl" );
}
-
- @Test (timeout = 10000)
+
+ @Test(timeout = 10000)
public void testAccumulateWithAndOrCombinations() throws Exception {
// JBRULES-3482
// once this compils, update it to actually assert on correct outputs.
-
+
String rule = "package org.drools.compiler.test;\n" +
"import org.drools.compiler.Cheese;\n" +
"import org.drools.compiler.Person;\n" +
-
+
"rule \"Class cast causer\"\n" +
" when\n" +
" $person : Person( $likes : likes )\n" +
@@ -889,63 +889,63 @@ public void testAccumulateWithAndOrCombinations() throws Exception {
wm.insert( new Person( "Bob", "stilton" ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithSameSubnetwork() throws Exception {
String rule = "package org.drools.compiler.test;\n" +
- "import org.drools.compiler.Cheese;\n" +
- "import org.drools.compiler.Person;\n" +
- "global java.util.List list; \n" +
- "rule r1 salience 100 \n" +
- " when\n" +
- " $person : Person( name == 'Alice', $likes : likes )\n" +
- " $total : Number() from accumulate( $p : Person(likes != $likes, $l : likes) and $c : Cheese( type == $l ),\n" +
- " min($c.getPrice()) )\n" +
- " then\n" +
- " list.add( 'r1' + ':' + $total);\n" +
- "end\n" +
- "rule r2 \n" +
- " when\n" +
- " $person : Person( name == 'Alice', $likes : likes )\n" +
- " $total : Number() from accumulate( $p : Person(likes != $likes, $l : likes) and $c : Cheese( type == $l ),\n" +
- " max($c.getPrice()) )\n" +
- " then\n" +
- " list.add( 'r2' + ':' + $total);\n" +
- "end\n" +
+ "import org.drools.compiler.Cheese;\n" +
+ "import org.drools.compiler.Person;\n" +
+ "global java.util.List list; \n" +
+ "rule r1 salience 100 \n" +
+ " when\n" +
+ " $person : Person( name == 'Alice', $likes : likes )\n" +
+ " $total : Number() from accumulate( $p : Person(likes != $likes, $l : likes) and $c : Cheese( type == $l ),\n" +
+ " min($c.getPrice()) )\n" +
+ " then\n" +
+ " list.add( 'r1' + ':' + $total);\n" +
+ "end\n" +
+ "rule r2 \n" +
+ " when\n" +
+ " $person : Person( name == 'Alice', $likes : likes )\n" +
+ " $total : Number() from accumulate( $p : Person(likes != $likes, $l : likes) and $c : Cheese( type == $l ),\n" +
+ " max($c.getPrice()) )\n" +
+ " then\n" +
+ " list.add( 'r2' + ':' + $total);\n" +
+ "end\n" +
- "";
+ "";
// read in the source
KnowledgeBase kbase = loadKnowledgeBaseFromString( rule );
StatefulKnowledgeSession wm = createKnowledgeSession( kbase );
List list = new ArrayList();
- wm.setGlobal("list", list);
+ wm.setGlobal( "list", list );
// Check the network formation, to ensure the RiaNode is shared.
- ObjectTypeNode cheeseOtn = LinkingTest.getObjectTypeNode(kbase, Cheese.class);
+ ObjectTypeNode cheeseOtn = LinkingTest.getObjectTypeNode( kbase, Cheese.class );
ObjectSink[] oSinks = cheeseOtn.getSinkPropagator().getSinks();
assertEquals( 1, oSinks.length );
- JoinNode cheeseJoin = ( JoinNode ) oSinks[0];
+ JoinNode cheeseJoin = (JoinNode) oSinks[0];
LeftTupleSink[] ltSinks = cheeseJoin.getSinkPropagator().getSinks();
assertEquals( 1, ltSinks.length );
- RightInputAdapterNode rian = ( RightInputAdapterNode ) ltSinks[0];
+ RightInputAdapterNode rian = (RightInputAdapterNode) ltSinks[0];
assertEquals( 2, rian.getSinkPropagator().size() ); // RiaNode is shared, if this has two outputs
- wm.insert(new Cheese("stilton", 10));
+ wm.insert( new Cheese( "stilton", 10 ) );
wm.insert( new Person( "Alice", "brie" ) );
wm.insert( new Person( "Bob", "stilton" ) );
wm.fireAllRules();
- assertEquals(2, list.size() );
- assertEquals( "r1:10.0", list.get(0));
- assertEquals( "r2:10.0", list.get(1));
+ assertEquals( 2, list.size() );
+ assertEquals( "r1:10.0", list.get( 0 ) );
+ assertEquals( "r2:10.0", list.get( 1 ) );
}
public void execTestAccumulateSum( String fileName ) throws Exception {
// read in the source
- KieSession session = getKieSessionFromResources(fileName);
+ KieSession session = getKieSessionFromResources( fileName );
DataSet data = new DataSet();
data.results = new ArrayList<Object>();
@@ -978,12 +978,12 @@ public void execTestAccumulateSum( String fileName ) throws Exception {
// ---------------- 1st scenario
session.fireAllRules();
assertEquals( 1,
- data.results.size() );
+ data.results.size() );
assertEquals( 27,
- ((Number) data.results.get( data.results.size() - 1 )).intValue() );
+ ( (Number) data.results.get( data.results.size() - 1 ) ).intValue() );
- session = SerializationHelper.getSerialisedStatefulKnowledgeSession(session,
- true);
+ session = SerializationHelper.getSerialisedStatefulKnowledgeSession( session,
+ true );
updateReferences( session,
data );
@@ -996,9 +996,9 @@ public void execTestAccumulateSum( String fileName ) throws Exception {
assertEquals( 1, count );
assertEquals( 2,
- data.results.size() );
+ data.results.size() );
assertEquals( 20,
- ((Number) data.results.get( data.results.size() - 1 )).intValue() );
+ ( (Number) data.results.get( data.results.size() - 1 ) ).intValue() );
// ---------------- 3rd scenario
data.bob.setLikes( "brie" );
@@ -1007,9 +1007,9 @@ public void execTestAccumulateSum( String fileName ) throws Exception {
session.fireAllRules();
assertEquals( 3,
- data.results.size() );
+ data.results.size() );
assertEquals( 15,
- ((Number) data.results.get( data.results.size() - 1 )).intValue() );
+ ( (Number) data.results.get( data.results.size() - 1 ) ).intValue() );
// ---------------- 4th scenario
session.delete( data.cheeseHandles[3] );
@@ -1017,14 +1017,14 @@ public void execTestAccumulateSum( String fileName ) throws Exception {
// should not have fired as per constraint
assertEquals( 3,
- data.results.size() );
+ data.results.size() );
}
private void updateReferences( final KieSession session,
final DataSet data ) {
- data.results = (List< ? >) session.getGlobal( "results" );
- for ( Iterator< ? > it = session.getObjects().iterator(); it.hasNext(); ) {
+ data.results = (List<?>) session.getGlobal( "results" );
+ for ( Iterator<?> it = session.getObjects().iterator(); it.hasNext(); ) {
Object next = it.next();
if ( next instanceof Cheese ) {
Cheese c = (Cheese) next;
@@ -1040,7 +1040,7 @@ private void updateReferences( final KieSession session,
public void execTestAccumulateCount( String fileName ) throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources(fileName);
+ KieSession wm = getKieSessionFromResources( fileName );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1066,9 +1066,9 @@ public void execTestAccumulateCount( String fileName ) throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 3,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 2nd scenario
final int index = 1;
@@ -1079,9 +1079,9 @@ public void execTestAccumulateCount( String fileName ) throws Exception {
// 1 fire
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 3,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -1091,23 +1091,23 @@ public void execTestAccumulateCount( String fileName ) throws Exception {
// 2 fires
assertEquals( 3,
- results.size() );
+ results.size() );
assertEquals( 2,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
+ wm.delete( cheeseHandles[3] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 3,
- results.size() );
+ results.size() );
}
public void execTestAccumulateAverage( String fileName ) throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources(fileName);
+ KieSession wm = getKieSessionFromResources( fileName );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1133,7 +1133,7 @@ public void execTestAccumulateAverage( String fileName ) throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -1144,9 +1144,9 @@ public void execTestAccumulateAverage( String fileName ) throws Exception {
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 10,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -1156,24 +1156,24 @@ public void execTestAccumulateAverage( String fileName ) throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 16,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
- wm.delete(cheeseHandles[4]);
+ wm.delete( cheeseHandles[3] );
+ wm.delete( cheeseHandles[4] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
public void execTestAccumulateMin( String fileName ) throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources(fileName);
+ KieSession wm = getKieSessionFromResources( fileName );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1199,7 +1199,7 @@ public void execTestAccumulateMin( String fileName ) throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -1210,9 +1210,9 @@ public void execTestAccumulateMin( String fileName ) throws Exception {
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 3,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -1222,24 +1222,24 @@ public void execTestAccumulateMin( String fileName ) throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 1,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
- wm.delete(cheeseHandles[4]);
+ wm.delete( cheeseHandles[3] );
+ wm.delete( cheeseHandles[4] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
public void execTestAccumulateMax( String fileName ) throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources(fileName);
+ KieSession wm = getKieSessionFromResources( fileName );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1265,7 +1265,7 @@ public void execTestAccumulateMax( String fileName ) throws Exception {
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -1276,9 +1276,9 @@ public void execTestAccumulateMax( String fileName ) throws Exception {
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 9,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -1288,24 +1288,24 @@ public void execTestAccumulateMax( String fileName ) throws Exception {
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 17,
- ((Number) results.get( results.size() - 1 )).intValue() );
+ ( (Number) results.get( results.size() - 1 ) ).intValue() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
- wm.delete(cheeseHandles[4]);
+ wm.delete( cheeseHandles[3] );
+ wm.delete( cheeseHandles[4] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
public void execTestAccumulateCollectList( String fileName ) throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources(fileName);
+ KieSession wm = getKieSessionFromResources( fileName );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1326,9 +1326,9 @@ public void execTestAccumulateCollectList( String fileName ) throws Exception {
// ---------------- 1st scenario
wm.fireAllRules();
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 6,
- ((List) results.get( results.size() - 1 )).size() );
+ ( (List) results.get( results.size() - 1 ) ).size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -1339,24 +1339,24 @@ public void execTestAccumulateCollectList( String fileName ) throws Exception {
// fire again
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 6,
- ((List) results.get( results.size() - 1 )).size() );
+ ( (List) results.get( results.size() - 1 ) ).size() );
// ---------------- 3rd scenario
- wm.delete(cheeseHandles[3]);
- wm.delete(cheeseHandles[4]);
+ wm.delete( cheeseHandles[3] );
+ wm.delete( cheeseHandles[4] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
public void execTestAccumulateCollectSet( String fileName ) throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources(fileName);
+ KieSession wm = getKieSessionFromResources( fileName );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1377,9 +1377,9 @@ public void execTestAccumulateCollectSet( String fileName ) throws Exception {
// ---------------- 1st scenario
wm.fireAllRules();
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 3,
- ((Set) results.get( results.size() - 1 )).size() );
+ ( (Set) results.get( results.size() - 1 ) ).size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -1390,32 +1390,32 @@ public void execTestAccumulateCollectSet( String fileName ) throws Exception {
// fire again
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 3,
- ((Set) results.get( results.size() - 1 )).size() );
+ ( (Set) results.get( results.size() - 1 ) ).size() );
// ---------------- 3rd scenario
- wm.delete(cheeseHandles[3]);
+ wm.delete( cheeseHandles[3] );
wm.fireAllRules();
// fire again
assertEquals( 3,
- results.size() );
+ results.size() );
assertEquals( 3,
- ((Set) results.get( results.size() - 1 )).size() );
+ ( (Set) results.get( results.size() - 1 ) ).size() );
// ---------------- 4rd scenario
- wm.delete(cheeseHandles[4]);
+ wm.delete( cheeseHandles[4] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 3,
- results.size() );
+ results.size() );
}
public void execTestAccumulateReverseModifyMultiPattern( String fileName ) throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources(fileName);
+ KieSession wm = getKieSessionFromResources( fileName );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1444,7 +1444,7 @@ public void execTestAccumulateReverseModifyMultiPattern( String fileName ) throw
wm.fireAllRules();
// no fire, as per rule constraints
assertEquals( 0,
- results.size() );
+ results.size() );
// ---------------- 2nd scenario
final int index = 1;
@@ -1455,9 +1455,9 @@ public void execTestAccumulateReverseModifyMultiPattern( String fileName ) throw
// 1 fire
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 32,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 3rd scenario
bob.setLikes( "brie" );
@@ -1467,25 +1467,25 @@ public void execTestAccumulateReverseModifyMultiPattern( String fileName ) throw
// 2 fires
assertEquals( 2,
- results.size() );
+ results.size() );
assertEquals( 39,
- ((Cheesery) results.get( results.size() - 1 )).getTotalAmount() );
+ ( (Cheesery) results.get( results.size() - 1 ) ).getTotalAmount() );
// ---------------- 4th scenario
- wm.delete(cheeseHandles[3]);
+ wm.delete( cheeseHandles[3] );
wm.fireAllRules();
// should not have fired as per constraint
assertEquals( 2,
- results.size() );
+ results.size() );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithPreviouslyBoundVariables() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulatePreviousBinds.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulatePreviousBinds.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1508,10 +1508,10 @@ public void testAccumulateWithPreviouslyBoundVariables() throws Exception {
results.get( 0 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMVELWithModify() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateMVELwithModify.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateMVELwithModify.drl" );
final List<Number> results = new ArrayList<Number>();
wm.setGlobal( "results",
results );
@@ -1545,11 +1545,11 @@ public void testAccumulateMVELWithModify() throws Exception {
0.0 );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateGlobals() throws Exception {
// read in the source
- KieSession wm = getKieSessionFromResources("test_AccumulateGlobals.drl");
+ KieSession wm = getKieSessionFromResources( "test_AccumulateGlobals.drl" );
final List<?> results = new ArrayList<Object>();
wm.setGlobal( "results",
@@ -1574,12 +1574,12 @@ public void testAccumulateGlobals() throws Exception {
results.get( 0 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateNonExistingFunction() throws Exception {
final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add( ResourceFactory.newClassPathResource("test_NonExistingAccumulateFunction.drl",
- getClass()),
+ kbuilder.add( ResourceFactory.newClassPathResource( "test_NonExistingAccumulateFunction.drl",
+ getClass() ),
ResourceType.DRL );
// should report a proper error, not raise an exception
@@ -1591,7 +1591,7 @@ public void testAccumulateNonExistingFunction() throws Exception {
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateZeroParams() {
String rule = "global java.util.List list;\n" +
"rule fromIt\n" +
@@ -1601,40 +1601,40 @@ public void testAccumulateZeroParams() {
" list.add( $c );\n" +
"end";
- KnowledgeBase kbase = loadKnowledgeBaseFromString(rule);
+ KnowledgeBase kbase = loadKnowledgeBaseFromString( rule );
StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
List list = new ArrayList();
- ksession.setGlobal("list", list);
+ ksession.setGlobal( "list", list );
- ksession.insert( new Integer(1) );
- ksession.insert(new Integer(2));
- ksession.insert( new Integer(3) );
+ ksession.insert( new Integer( 1 ) );
+ ksession.insert( new Integer( 2 ) );
+ ksession.insert( new Integer( 3 ) );
ksession.fireAllRules();
assertEquals( 1, list.size() );
- assertEquals( 3, list.get(0) );
+ assertEquals( 3, list.get( 0 ) );
}
public void execTestAccumulateMultipleFunctions( String fileName ) throws Exception {
- KieSession ksession = getKieSessionFromResources(fileName);
+ KieSession ksession = getKieSessionFromResources( fileName );
AgendaEventListener ael = mock( AgendaEventListener.class );
ksession.addEventListener( ael );
final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
- 10 ),
- new Cheese( "stilton",
- 3 ),
- new Cheese( "stilton",
- 5 ),
- new Cheese( "brie",
- 15 ),
- new Cheese( "brie",
- 17 ),
- new Cheese( "provolone",
- 8 )};
+ 10 ),
+ new Cheese( "stilton",
+ 3 ),
+ new Cheese( "stilton",
+ 5 ),
+ new Cheese( "brie",
+ 15 ),
+ new Cheese( "brie",
+ 17 ),
+ new Cheese( "provolone",
+ 8 )};
final Person bob = new Person( "Bob",
"stilton" );
@@ -1648,14 +1648,14 @@ public void execTestAccumulateMultipleFunctions( String fileName ) throws Except
ksession.fireAllRules();
ArgumentCaptor<AfterMatchFiredEvent> cap = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
- Mockito.verify( ael ).afterMatchFired(cap.capture());
+ Mockito.verify( ael ).afterMatchFired( cap.capture() );
Match activation = cap.getValue().getMatch();
- assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$sum" ) ).intValue(),
is( 18 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$min" ) ).intValue(),
is( 3 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$avg" ) ).intValue(),
is( 6 ) );
Mockito.reset( ael );
@@ -1666,14 +1666,14 @@ public void execTestAccumulateMultipleFunctions( String fileName ) throws Except
cheese[index] );
ksession.fireAllRules();
- Mockito.verify( ael ).afterMatchFired(cap.capture());
+ Mockito.verify( ael ).afterMatchFired( cap.capture() );
activation = cap.getValue().getMatch();
- assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$sum" ) ).intValue(),
is( 24 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$min" ) ).intValue(),
is( 5 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$avg" ) ).intValue(),
is( 8 ) );
Mockito.reset( ael );
@@ -1683,50 +1683,50 @@ public void execTestAccumulateMultipleFunctions( String fileName ) throws Except
bob );
ksession.fireAllRules();
- Mockito.verify( ael ).afterMatchFired(cap.capture());
+ Mockito.verify( ael ).afterMatchFired( cap.capture() );
activation = cap.getValue().getMatch();
- assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$sum" ) ).intValue(),
is( 32 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$min" ) ).intValue(),
is( 15 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$avg" ) ).intValue(),
is( 16 ) );
Mockito.reset( ael );
// ---------------- 4th scenario
- ksession.delete(cheeseHandles[3]);
+ ksession.delete( cheeseHandles[3] );
ksession.fireAllRules();
- Mockito.verify( ael ).afterMatchFired(cap.capture());
+ Mockito.verify( ael ).afterMatchFired( cap.capture() );
activation = cap.getValue().getMatch();
- assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$sum" ) ).intValue(),
is( 17 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$min" ) ).intValue(),
is( 17 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$avg" ) ).intValue(),
is( 17 ) );
}
public void execTestAccumulateMultipleFunctionsConstraint( String fileName ) throws Exception {
- KieSession ksession = getKieSessionFromResources(fileName);
+ KieSession ksession = getKieSessionFromResources( fileName );
AgendaEventListener ael = mock( AgendaEventListener.class );
ksession.addEventListener( ael );
final Cheese[] cheese = new Cheese[]{new Cheese( "stilton",
- 10 ),
- new Cheese( "stilton",
- 3 ),
- new Cheese( "stilton",
- 5 ),
- new Cheese( "brie",
- 3 ),
- new Cheese( "brie",
- 17 ),
- new Cheese( "provolone",
- 8 )};
+ 10 ),
+ new Cheese( "stilton",
+ 3 ),
+ new Cheese( "stilton",
+ 5 ),
+ new Cheese( "brie",
+ 3 ),
+ new Cheese( "brie",
+ 17 ),
+ new Cheese( "provolone",
+ 8 )};
final Person bob = new Person( "Bob",
"stilton" );
@@ -1740,14 +1740,14 @@ public void execTestAccumulateMultipleFunctionsConstraint( String fileName ) thr
ksession.fireAllRules();
ArgumentCaptor<AfterMatchFiredEvent> cap = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
- Mockito.verify( ael ).afterMatchFired(cap.capture());
+ Mockito.verify( ael ).afterMatchFired( cap.capture() );
Match activation = cap.getValue().getMatch();
- assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$sum" ) ).intValue(),
is( 18 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$min" ) ).intValue(),
is( 3 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$avg" ) ).intValue(),
is( 6 ) );
Mockito.reset( ael );
@@ -1758,7 +1758,7 @@ public void execTestAccumulateMultipleFunctionsConstraint( String fileName ) thr
cheese[index] );
ksession.fireAllRules();
- Mockito.verify( ael, Mockito.never() ).afterMatchFired(Mockito.any(AfterMatchFiredEvent.class));
+ Mockito.verify( ael, Mockito.never() ).afterMatchFired( Mockito.any( AfterMatchFiredEvent.class ) );
Mockito.reset( ael );
// ---------------- 3rd scenario
@@ -1767,29 +1767,29 @@ public void execTestAccumulateMultipleFunctionsConstraint( String fileName ) thr
bob );
ksession.fireAllRules();
- Mockito.verify( ael ).afterMatchFired(cap.capture());
+ Mockito.verify( ael ).afterMatchFired( cap.capture() );
activation = cap.getValue().getMatch();
- assertThat( ((Number) activation.getDeclarationValue( "$sum" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$sum" ) ).intValue(),
is( 20 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$min" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$min" ) ).intValue(),
is( 3 ) );
- assertThat( ((Number) activation.getDeclarationValue( "$avg" )).intValue(),
+ assertThat( ( (Number) activation.getDeclarationValue( "$avg" ) ).intValue(),
is( 10 ) );
-
+
ksession.dispose();
}
public static class DataSet {
- public Cheese[] cheese;
+ public Cheese[] cheese;
public FactHandle[] cheeseHandles;
- public Person bob;
- public FactHandle bobHandle;
- public List< ? > results;
+ public Person bob;
+ public FactHandle bobHandle;
+ public List<?> results;
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateMinMax() throws Exception {
String drl = "package org.drools.compiler.test \n" +
"import org.drools.compiler.Cheese \n" +
@@ -1802,28 +1802,28 @@ public void testAccumulateMinMax() throws Exception {
"end \n";
KnowledgeBase kbase = loadKnowledgeBaseFromString( drl );
- StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
+ StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
final List<Number> results = new ArrayList<Number>();
ksession.setGlobal( "results",
results );
final Cheese[] cheese = new Cheese[]{new Cheese( "Emmentaler",
- 4 ),
- new Cheese( "Appenzeller",
- 6 ),
- new Cheese( "Greyerzer",
- 2 ),
- new Cheese( "Raclette",
- 3 ),
- new Cheese( "Olmützer Quargel",
- 15 ),
- new Cheese( "Brie",
- 17 ),
- new Cheese( "Dolcelatte",
- 8 )};
-
- for (Cheese aCheese : cheese) {
- ksession.insert(aCheese);
+ 4 ),
+ new Cheese( "Appenzeller",
+ 6 ),
+ new Cheese( "Greyerzer",
+ 2 ),
+ new Cheese( "Raclette",
+ 3 ),
+ new Cheese( "Olmützer Quargel",
+ 15 ),
+ new Cheese( "Brie",
+ 17 ),
+ new Cheese( "Dolcelatte",
+ 8 )};
+
+ for ( Cheese aCheese : cheese ) {
+ ksession.insert( aCheese );
}
// ---------------- 1st scenario
@@ -1835,53 +1835,53 @@ public void testAccumulateMinMax() throws Exception {
assertEquals( results.get( 1 ).intValue(),
17 );
}
-
- @Test (timeout = 10000)
+
+ @Test(timeout = 10000)
public void testAccumulateCE() throws Exception {
String drl = "package org.drools.compiler\n" +
- "global java.util.List results\n" +
- "rule \"ocount\"\n" +
- "when\n" +
- " accumulate( Cheese(), $c: count(1) )\n" +
- "then\n" +
- " results.add( $c + \" facts\" );\n" +
- "end\n";
+ "global java.util.List results\n" +
+ "rule \"ocount\"\n" +
+ "when\n" +
+ " accumulate( Cheese(), $c: count(1) )\n" +
+ "then\n" +
+ " results.add( $c + \" facts\" );\n" +
+ "end\n";
KnowledgeBase kbase = loadKnowledgeBaseFromString( drl );
- StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
+ StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
final List<String> results = new ArrayList<String>();
ksession.setGlobal( "results",
results );
final Cheese[] cheese = new Cheese[]{new Cheese( "Emmentaler",
- 4 ),
- new Cheese( "Appenzeller",
- 6 ),
- new Cheese( "Greyerzer",
- 2 ),
- new Cheese( "Raclette",
- 3 ),
- new Cheese( "Olmützer Quargel",
- 15 ),
- new Cheese( "Brie",
- 17 ),
- new Cheese( "Dolcelatte",
- 8 )};
-
- for (Cheese aCheese : cheese) {
- ksession.insert(aCheese);
+ 4 ),
+ new Cheese( "Appenzeller",
+ 6 ),
+ new Cheese( "Greyerzer",
+ 2 ),
+ new Cheese( "Raclette",
+ 3 ),
+ new Cheese( "Olmützer Quargel",
+ 15 ),
+ new Cheese( "Brie",
+ 17 ),
+ new Cheese( "Dolcelatte",
+ 8 )};
+
+ for ( Cheese aCheese : cheese ) {
+ ksession.insert( aCheese );
}
// ---------------- 1st scenario
ksession.fireAllRules();
assertEquals( 1,
results.size() );
- assertEquals( "7 facts",
+ assertEquals( "7 facts",
results.get( 0 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateAndRetract() {
String drl = "package org.drools.compiler;\n" +
"\n" +
@@ -1920,34 +1920,34 @@ public void testAccumulateAndRetract() {
"end" +
"\n";
- KieSession ks = getKieSessionFromContentStrings(drl);
+ KieSession ks = getKieSessionFromContentStrings( drl );
ArrayList resList = new ArrayList();
- ks.setGlobal("list",resList);
+ ks.setGlobal( "list", resList );
ArrayList<String> list = new ArrayList<String>();
- list.add("x");
- list.add("y");
- list.add("z");
+ list.add( "x" );
+ list.add( "y" );
+ list.add( "z" );
- ks.insert(list);
+ ks.insert( list );
ks.fireAllRules();
- assertEquals(3L, resList.get(0));
+ assertEquals( 3L, resList.get( 0 ) );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithNull() {
String drl = "rule foo\n" +
- "when\n" +
- "Object() from accumulate( Object(),\n" +
- "init( Object res = null; )\n" +
- "action( res = null; )\n" +
- "result( res ) )\n" +
- "then\n" +
- "end";
+ "when\n" +
+ "Object() from accumulate( Object(),\n" +
+ "init( Object res = null; )\n" +
+ "action( res = null; )\n" +
+ "result( res ) )\n" +
+ "then\n" +
+ "end";
- KieSession ksession = getKieSessionFromContentStrings(drl);
+ KieSession ksession = getKieSessionFromContentStrings( drl );
ksession.fireAllRules();
ksession.dispose();
}
@@ -1956,15 +1956,15 @@ public static class MyObj {
public static class NestedObj {
public long value;
- public NestedObj(long value) {
+ public NestedObj( long value ) {
this.value = value;
}
}
private final NestedObj nestedObj;
- public MyObj(long value) {
- nestedObj = new NestedObj(value);
+ public MyObj( long value ) {
+ nestedObj = new NestedObj( value );
}
public NestedObj getNestedObj() {
@@ -1972,39 +1972,39 @@ public NestedObj getNestedObj() {
}
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithBoundExpression() {
String drl = "package org.drools.compiler;\n" +
- "import " + AccumulateTest.MyObj.class.getCanonicalName() + ";\n" +
- "global java.util.List results\n" +
- "rule init\n" +
- " when\n" +
- " then\n" +
- " insert( new MyObj(5) );\n" +
- " insert( new MyObj(4) );\n" +
- "end\n" +
- "rule foo\n" +
- " salience -10\n" +
- " when\n" +
- " $n : Number() from accumulate( MyObj( $val : nestedObj.value ),\n" +
- " sum( $val ) )\n" +
- " then\n" +
- " System.out.println($n);\n" +
- " results.add($n);\n" +
- "end";
+ "import " + AccumulateTest.MyObj.class.getCanonicalName() + ";\n" +
+ "global java.util.List results\n" +
+ "rule init\n" +
+ " when\n" +
+ " then\n" +
+ " insert( new MyObj(5) );\n" +
+ " insert( new MyObj(4) );\n" +
+ "end\n" +
+ "rule foo\n" +
+ " salience -10\n" +
+ " when\n" +
+ " $n : Number() from accumulate( MyObj( $val : nestedObj.value ),\n" +
+ " sum( $val ) )\n" +
+ " then\n" +
+ " System.out.println($n);\n" +
+ " results.add($n);\n" +
+ "end";
KieBase kbase = loadKnowledgeBaseFromString( drl );
KieSession ksession = kbase.newKieSession();
final List<Number> results = new ArrayList<Number>();
ksession.setGlobal( "results",
- results );
+ results );
ksession.fireAllRules();
ksession.dispose();
assertEquals( 1,
- results.size() );
+ results.size() );
assertEquals( 9.0,
- results.get( 0 ) );
+ results.get( 0 ) );
}
@Test(timeout = 5000)
@@ -2028,11 +2028,11 @@ public void testInfiniteLoopAddingPkgAfterSession() throws Exception {
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
// To reproduce, Need to have 3 object asserted (not less) :
- ksession.insert(new Triple("<http://deductions.sf.net/samples/princing.n3p.n3#CN1>", "<http://deductions.sf.net/samples/princing.n3p.n3#number>", "200"));
- ksession.insert(new Triple("<http://deductions.sf.net/samples/princing.n3p.n3#CN2>", "<http://deductions.sf.net/samples/princing.n3p.n3#number>", "100"));
- ksession.insert(new Triple("<http://deductions.sf.net/samples/princing.n3p.n3#CN3>", "<http://deductions.sf.net/samples/princing.n3p.n3#number>", "100"));
+ ksession.insert( new Triple( "<http://deductions.sf.net/samples/princing.n3p.n3#CN1>", "<http://deductions.sf.net/samples/princing.n3p.n3#number>", "200" ) );
+ ksession.insert( new Triple( "<http://deductions.sf.net/samples/princing.n3p.n3#CN2>", "<http://deductions.sf.net/samples/princing.n3p.n3#number>", "100" ) );
+ ksession.insert( new Triple( "<http://deductions.sf.net/samples/princing.n3p.n3#CN3>", "<http://deductions.sf.net/samples/princing.n3p.n3#number>", "100" ) );
- kbase.addKnowledgePackages( loadKnowledgePackagesFromString(rule) );
+ kbase.addKnowledgePackages( loadKnowledgePackagesFromString( rule ) );
ksession.fireAllRules();
}
@@ -2041,10 +2041,13 @@ public static class Triple {
private String predicate;
private String object;
- /** for javabeans */
- public Triple() {}
+ /**
+ * for javabeans
+ */
+ public Triple() {
+ }
- public Triple(String subject, String predicate, String object) {
+ public Triple( String subject, String predicate, String object ) {
this.subject = subject;
this.predicate = predicate;
this.object = object;
@@ -2064,7 +2067,7 @@ public String getObject() {
}
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithVarsOutOfHashOrder() throws Exception {
// JBRULES-3494
String rule = "package com.sample;\n" +
@@ -2096,9 +2099,9 @@ public void testAccumulateWithVarsOutOfHashOrder() throws Exception {
fail( kbuilder.getErrors().toString() );
}
final KnowledgeBase kbase = getKnowledgeBase();
- StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
+ StatefulKnowledgeSession ksession = createKnowledgeSession( kbase );
- kbase.addKnowledgePackages(loadKnowledgePackagesFromString(rule) );
+ kbase.addKnowledgePackages( loadKnowledgePackagesFromString( rule ) );
ksession.fireAllRules();
QueryResults res = ksession.getQueryResults( "getResults", "1", Variable.v );
@@ -2106,111 +2109,111 @@ public void testAccumulateWithVarsOutOfHashOrder() throws Exception {
Object o = res.iterator().next().get( "$holders" );
assertTrue( o instanceof List );
- assertEquals( 1, ((List) o).size() );
+ assertEquals( 1, ( (List) o ).size() );
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithWindow() {
String str = "global java.util.Map map;\n" +
- " \n" +
- "declare Double\n" +
- "@role(event)\n" +
- "end\n" +
- " \n" +
- "declare window Streem\n" +
- " Double() over window:length( 10 )\n" +
- "end\n" +
- " \n" +
- "rule \"See\"\n" +
- "when\n" +
- " $a : Double() from accumulate (\n" +
- " $d: Double()\n" +
- " from window Streem,\n" +
- " sum( $d )\n" +
- " )\n" +
- "then\n" +
- " System.out.println( \"We have a sum \" + $a );\n" +
- "end\n";
+ " \n" +
+ "declare Double\n" +
+ "@role(event)\n" +
+ "end\n" +
+ " \n" +
+ "declare window Streem\n" +
+ " Double() over window:length( 10 )\n" +
+ "end\n" +
+ " \n" +
+ "rule \"See\"\n" +
+ "when\n" +
+ " $a : Double() from accumulate (\n" +
+ " $d: Double()\n" +
+ " from window Streem,\n" +
+ " sum( $d )\n" +
+ " )\n" +
+ "then\n" +
+ " System.out.println( \"We have a sum \" + $a );\n" +
+ "end\n";
- KieSession ksession = getKieSessionFromContentStrings(str);
+ KieSession ksession = getKieSessionFromContentStrings( str );
Map res = new HashMap();
ksession.setGlobal( "map", res );
ksession.fireAllRules();
for ( int j = 0; j < 33; j++ ) {
- ksession.insert(1.0 * j);
+ ksession.insert( 1.0 * j );
ksession.fireAllRules();
}
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithEntryPoint() {
String str = "global java.util.Map map;\n" +
- " \n" +
- "declare Double\n" +
- "@role(event)\n" +
- "end\n" +
- " \n" +
- "rule \"See\"\n" +
- "when\n" +
- " $a : Double() from accumulate (\n" +
- " $d: Double()\n" +
- " from entry-point data,\n" +
- " sum( $d )\n" +
- " )\n" +
- "then\n" +
- " System.out.println( \"We have a sum \" + $a );\n" +
- "end\n";
+ " \n" +
+ "declare Double\n" +
+ "@role(event)\n" +
+ "end\n" +
+ " \n" +
+ "rule \"See\"\n" +
+ "when\n" +
+ " $a : Double() from accumulate (\n" +
+ " $d: Double()\n" +
+ " from entry-point data,\n" +
+ " sum( $d )\n" +
+ " )\n" +
+ "then\n" +
+ " System.out.println( \"We have a sum \" + $a );\n" +
+ "end\n";
- KieSession ksession = getKieSessionFromContentStrings(str);
+ KieSession ksession = getKieSessionFromContentStrings( str );
Map res = new HashMap();
ksession.setGlobal( "map", res );
ksession.fireAllRules();
for ( int j = 0; j < 33; j++ ) {
- ksession.getEntryPoint( "data" ).insert(1.0 * j);
+ ksession.getEntryPoint( "data" ).insert( 1.0 * j );
ksession.fireAllRules();
}
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void testAccumulateWithWindowAndEntryPoint() {
String str = "global java.util.Map map;\n" +
- " \n" +
- "declare Double\n" +
- "@role(event)\n" +
- "end\n" +
- " \n" +
- "declare window Streem\n" +
- " Double() over window:length( 10 ) from entry-point data\n" +
- "end\n" +
- " \n" +
- "rule \"See\"\n" +
- "when\n" +
- " $a : Double() from accumulate (\n" +
- " $d: Double()\n" +
- " from window Streem,\n" +
- " sum( $d )\n" +
- " )\n" +
- "then\n" +
- " System.out.println( \"We have a sum \" + $a );\n" +
- "end\n";
+ " \n" +
+ "declare Double\n" +
+ "@role(event)\n" +
+ "end\n" +
+ " \n" +
+ "declare window Streem\n" +
+ " Double() over window:length( 10 ) from entry-point data\n" +
+ "end\n" +
+ " \n" +
+ "rule \"See\"\n" +
+ "when\n" +
+ " $a : Double() from accumulate (\n" +
+ " $d: Double()\n" +
+ " from window Streem,\n" +
+ " sum( $d )\n" +
+ " )\n" +
+ "then\n" +
+ " System.out.println( \"We have a sum \" + $a );\n" +
+ "end\n";
- KieSession ksession = getKieSessionFromContentStrings(str);
+ KieSession ksession = getKieSessionFromContentStrings( str );
Map res = new HashMap();
ksession.setGlobal( "map", res );
ksession.fireAllRules();
for ( int j = 0; j < 33; j++ ) {
- ksession.getEntryPoint( "data" ).insert(1.0 * j);
+ ksession.getEntryPoint( "data" ).insert( 1.0 * j );
ksession.fireAllRules();
}
}
- @Test (timeout = 10000)
+ @Test(timeout = 10000)
public void test2AccumulatesWithOr() throws Exception {
// JBRULES-3538
String str =
@@ -2247,49 +2250,49 @@ public void test2AccumulatesWithOr() throws Exception {
" map.put('count', ((Integer)map.get('count')) + 1 );\n " +
"end\n";
- KieSession ksession = getKieSessionFromContentStrings(str);
+ KieSession ksession = getKieSessionFromContentStrings( str );
List list = new ArrayList();
Map map = new HashMap();
- ksession.setGlobal( "map", map);
+ ksession.setGlobal( "map", map );
map.put( "Jos Jr Jr", new HashMap() );
map.put( "Jos", new HashMap() );
- map.put( "count",0 );
+ map.put( "count", 0 );
- MyPerson josJr = new MyPerson("Jos Jr Jr", 20,
- Arrays.asList(new MyPerson("John Jr 1st", 10,
- Arrays.asList(new MyPerson("John Jr Jrx", 4, Collections.<MyPerson>emptyList()))),
- new MyPerson("John Jr 2nd", 8, Collections.<MyPerson>emptyList())));
+ MyPerson josJr = new MyPerson( "Jos Jr Jr", 20,
+ Arrays.asList( new MyPerson( "John Jr 1st", 10,
+ Arrays.asList( new MyPerson( "John Jr Jrx", 4, Collections.<MyPerson>emptyList() ) ) ),
+ new MyPerson( "John Jr 2nd", 8, Collections.<MyPerson>emptyList() ) ) );
- MyPerson jos = new MyPerson("Jos", 30,
- Arrays.asList(new MyPerson("Jeff Jr 1st", 10, Collections.<MyPerson>emptyList()),
- new MyPerson("Jeff Jr 2nd", 8, Collections.<MyPerson>emptyList())) );
+ MyPerson jos = new MyPerson( "Jos", 30,
+ Arrays.asList( new MyPerson( "Jeff Jr 1st", 10, Collections.<MyPerson>emptyList() ),
+ new MyPerson( "Jeff Jr 2nd", 8, Collections.<MyPerson>emptyList() ) ) );
- ksession.execute(new InsertElementsCommand(Arrays.asList(new Object[]{ josJr, jos })));
+ ksession.execute( new InsertElementsCommand( Arrays.asList( new Object[]{josJr, jos} ) ) );
ksession.fireAllRules();
System.out.println( map );
- assertEquals( 2, map.get("count") );
- Map pMap = (Map) map.get("Jos Jr Jr");
- assertEquals( 50.0, pMap.get("total") );
- List kids = ( List ) pMap.get("k");
+ assertEquals( 2, map.get( "count" ) );
+ Map pMap = (Map) map.get( "Jos Jr Jr" );
+ assertEquals( 50.0, pMap.get( "total" ) );
+ List kids = (List) pMap.get( "k" );
assertEquals( 1, kids.size() );
- assertEquals( "John Jr Jrx", ((MyPerson)kids.get(0)).getName() );
- assertEquals( josJr, pMap.get("p") );
- assertEquals( josJr, pMap.get("r") );
+ assertEquals( "John Jr Jrx", ( (MyPerson) kids.get( 0 ) ).getName() );
+ assertEquals( josJr, pMap.get( "p" ) );
+ assertEquals( josJr, pMap.get( "r" ) );
- pMap = (Map) map.get("Jos");
- assertEquals( 50.0, pMap.get("total") );
- kids = ( List ) pMap.get("k");
+ pMap = (Map) map.get( "Jos" );
+ assertEquals( 50.0, pMap.get( "total" ) );
+ kids = (List) pMap.get( "k" );
assertEquals( 1, kids.size() );
- assertEquals( "John Jr Jrx", ((MyPerson)kids.get(0)).getName() );
- assertEquals( josJr, pMap.get("p") );
- assertEquals( jos, pMap.get("r") );
+ assertEquals( "John Jr Jrx", ( (MyPerson) kids.get( 0 ) ).getName() );
+ assertEquals( josJr, pMap.get( "p" ) );
+ assertEquals( jos, pMap.get( "r" ) );
}
public static class MyPerson {
- public MyPerson(String name, Integer age, Collection<MyPerson> kids) {
+ public MyPerson( String name, Integer age, Collection<MyPerson> kids ) {
this.name = name;
this.age = age;
this.kids = kids;
@@ -2305,7 +2308,7 @@ public String getName() {
return name;
}
- public void setName(String name) {
+ public void setName( String name ) {
this.name = name;
}
@@ -2313,7 +2316,7 @@ public Integer getAge() {
return age;
}
- public void setAge(Integer age) {
+ public void setAge( Integer age ) {
this.age = age;
}
@@ -2321,7 +2324,7 @@ public Collection<MyPerson> getKids() {
return kids;
}
- public void setKids(Collection<MyPerson> kids) {
+ public void setKids( Collection<MyPerson> kids ) {
this.kids = kids;
}
}
@@ -2329,7 +2332,7 @@ public void setKids(Collection<MyPerson> kids) {
public static class Course {
private int minWorkingDaySize;
- public Course(int minWorkingDaySize) {
+ public Course( int minWorkingDaySize ) {
this.minWorkingDaySize = minWorkingDaySize;
}
@@ -2337,7 +2340,7 @@ public int getMinWorkingDaySize() {
return minWorkingDaySize;
}
- public void setMinWorkingDaySize(int minWorkingDaySize) {
+ public void setMinWorkingDaySize( int minWorkingDaySize ) {
this.minWorkingDaySize = minWorkingDaySize;
}
}
@@ -2346,7 +2349,7 @@ public static class Lecture {
private Course course;
private int day;
- public Lecture(Course course, int day) {
+ public Lecture( Course course, int day ) {
this.course = course;
this.day = day;
}
@@ -2355,7 +2358,7 @@ public Course getCourse() {
return course;
}
- public void setCourse(Course course) {
+ public void setCourse( Course course ) {
this.course = course;
}
@@ -2363,7 +2366,7 @@ public int getDay() {
return day;
}
- public void setDay(int day) {
+ public void setDay( int day ) {
this.day = day;
}
}
@@ -2389,31 +2392,31 @@ public void testAccumulateWithExists() {
" list.add( $dayCount );\n" +
"end\n";
- KieSession ksession = getKieSessionFromContentStrings(str);
+ KieSession ksession = getKieSessionFromContentStrings( str );
List list = new ArrayList();
- ksession.setGlobal("list", list);
+ ksession.setGlobal( "list", list );
Integer day1 = 1;
Integer day2 = 2;
Integer day3 = 3;
- Course c = new Course(2);
+ Course c = new Course( 2 );
- Lecture l1 = new Lecture(c, day1);
- Lecture l2 = new Lecture(c, day2);
+ Lecture l1 = new Lecture( c, day1 );
+ Lecture l2 = new Lecture( c, day2 );
- ksession.insert(day1);
- ksession.insert(day2);
- ksession.insert(day3);
- ksession.insert(c);
- ksession.insert(l1);
- ksession.insert(l2);
+ ksession.insert( day1 );
+ ksession.insert( day2 );
+ ksession.insert( day3 );
+ ksession.insert( c );
+ ksession.insert( l1 );
+ ksession.insert( l2 );
- assertEquals(1, ksession.fireAllRules());
+ assertEquals( 1, ksession.fireAllRules() );
assertEquals( 2, list.size() );
- assertEquals( c, list.get(0));
- assertEquals( 2l, list.get(1));
+ assertEquals( c, list.get( 0 ) );
+ assertEquals( 2l, list.get( 1 ) );
}
@Test
@@ -2433,24 +2436,24 @@ public void testAccumulatesExpireVsCancel() throws Exception {
" $d : FactTest() over window:time(1m), $tot : count($d); $tot > 0 )\n" +
"then\n" +
" System.out.println( $tot ); \n" +
- " list.add( $tot.intValue() ); \n "+
+ " list.add( $tot.intValue() ); \n " +
"end\n" +
"\n";
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add(ResourceFactory.newByteArrayResource( drl.getBytes() ), ResourceType.DRL);
+ kbuilder.add( ResourceFactory.newByteArrayResource( drl.getBytes() ), ResourceType.DRL );
assertFalse( kbuilder.hasErrors() );
KieBaseConfiguration kbConf = KnowledgeBaseFactory.newKnowledgeBaseConfiguration();
- kbConf.setOption(EventProcessingOption.STREAM);
+ kbConf.setOption( EventProcessingOption.STREAM );
- KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase(kbConf);
- kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
+ KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase( kbConf );
+ kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
KieSessionConfiguration ksConf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
- ksConf.setOption( ClockTypeOption.get("pseudo") );
- StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(ksConf,null);
+ ksConf.setOption( ClockTypeOption.get( "pseudo" ) );
+ StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession( ksConf, null );
ArrayList list = new ArrayList();
ksession.setGlobal( "list", list );
@@ -2504,15 +2507,15 @@ public void testManySlidingWindows() throws Exception {
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
- kbuilder.add(ResourceFactory.newByteArrayResource( drl.getBytes() ), ResourceType.DRL);
+ kbuilder.add( ResourceFactory.newByteArrayResource( drl.getBytes() ), ResourceType.DRL );
System.out.println( kbuilder.getErrors() );
assertFalse( kbuilder.hasErrors() );
KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
- kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
+ kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
- List list = new ArrayList( );
+ List list = new ArrayList();
ksession.setGlobal( "list", list );
ksession.insert( new Integer( 20 ) );
@@ -2540,96 +2543,104 @@ public void testManySlidingWindows() throws Exception {
assertEquals( list, Arrays.asList( 2, 5 ) );
}
-
+
@Test
public void testImportAccumulateFunction() throws Exception {
String drl = "package org.foo.bar\n"
- + "import accumulate "+TestFunction.class.getCanonicalName()+" f\n"
- + "rule X when\n"
- + " accumulate( $s : String(),\n"
- + " $v : f( $s ) )\n"
- + "then\n"
- + "end\n";
- ReleaseId releaseId = new ReleaseIdImpl("foo", "bar", "1.0");
+ + "import accumulate " + TestFunction.class.getCanonicalName() + " f\n"
+ + "rule X when\n"
+ + " accumulate( $s : String(),\n"
+ + " $v : f( $s ) )\n"
+ + "then\n"
+ + "end\n";
+ ReleaseId releaseId = new ReleaseIdImpl( "foo", "bar", "1.0" );
KieServices ks = KieServices.Factory.get();
createAndDeployJar( ks, releaseId, drl );
-
+
KieContainer kc = ks.newKieContainer( releaseId );
KieSession ksession = kc.newKieSession();
-
- AgendaEventListener ael = mock(AgendaEventListener.class);
- ksession.addEventListener(ael);
-
- ksession.insert("x");
+
+ AgendaEventListener ael = mock( AgendaEventListener.class );
+ ksession.addEventListener( ael );
+
+ ksession.insert( "x" );
ksession.fireAllRules();
-
- ArgumentCaptor<AfterMatchFiredEvent> ac = ArgumentCaptor.forClass(AfterMatchFiredEvent.class);
- verify( ael ).afterMatchFired(ac.capture());
-
- assertThat( (Integer) ac.getValue().getMatch().getDeclarationValue("$v"), is(Integer.valueOf(1)) );
+
+ ArgumentCaptor<AfterMatchFiredEvent> ac = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
+ verify( ael ).afterMatchFired( ac.capture() );
+
+ assertThat( (Integer) ac.getValue().getMatch().getDeclarationValue( "$v" ), is( Integer.valueOf( 1 ) ) );
}
@Test
public void testImportAccumulateFunctionWithDeclaration() throws Exception {
// DROOLS-750
String drl = "package org.foo.bar\n"
- + "import accumulate "+TestFunction.class.getCanonicalName()+" f;\n"
- + "import "+Person.class.getCanonicalName()+";\n"
- + "declare Person \n"
- + " @propertyReactive\n"
- + "end\n"
- + "rule X when\n"
- + " accumulate( $s : String(),\n"
- + " $v : f( $s ) )\n"
- + "then\n"
- + "end\n";
- ReleaseId releaseId = new ReleaseIdImpl("foo", "bar", "1.0");
+ + "import accumulate " + TestFunction.class.getCanonicalName() + " f;\n"
+ + "import " + Person.class.getCanonicalName() + ";\n"
+ + "declare Person \n"
+ + " @propertyReactive\n"
+ + "end\n"
+ + "rule X when\n"
+ + " accumulate( $s : String(),\n"
+ + " $v : f( $s ) )\n"
+ + "then\n"
+ + "end\n";
+ ReleaseId releaseId = new ReleaseIdImpl( "foo", "bar", "1.0" );
KieServices ks = KieServices.Factory.get();
createAndDeployJar( ks, releaseId, drl );
KieContainer kc = ks.newKieContainer( releaseId );
KieSession ksession = kc.newKieSession();
- AgendaEventListener ael = mock(AgendaEventListener.class);
- ksession.addEventListener(ael);
+ AgendaEventListener ael = mock( AgendaEventListener.class );
+ ksession.addEventListener( ael );
- ksession.insert("x");
+ ksession.insert( "x" );
ksession.fireAllRules();
- ArgumentCaptor<AfterMatchFiredEvent> ac = ArgumentCaptor.forClass(AfterMatchFiredEvent.class);
- verify( ael ).afterMatchFired(ac.capture());
+ ArgumentCaptor<AfterMatchFiredEvent> ac = ArgumentCaptor.forClass( AfterMatchFiredEvent.class );
+ verify( ael ).afterMatchFired( ac.capture() );
- assertThat( (Integer) ac.getValue().getMatch().getDeclarationValue("$v"), is(Integer.valueOf(1)) );
+ assertThat( (Integer) ac.getValue().getMatch().getDeclarationValue( "$v" ), is( Integer.valueOf( 1 ) ) );
}
public static class TestFunction implements AccumulateFunction {
@Override
- public void writeExternal(ObjectOutput out) throws IOException {
+ public void writeExternal( ObjectOutput out ) throws IOException {
}
+
@Override
- public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+ public void readExternal( ObjectInput in ) throws IOException, ClassNotFoundException {
}
+
@Override
public Serializable createContext() {
return null;
}
+
@Override
- public void init(Serializable context) throws Exception {
+ public void init( Serializable context ) throws Exception {
}
+
@Override
- public void accumulate(Serializable context, Object value) {
+ public void accumulate( Serializable context, Object value ) {
}
+
@Override
- public void reverse(Serializable context, Object value) throws Exception {
+ public void reverse( Serializable context, Object value ) throws Exception {
}
+
@Override
- public Object getResult(Serializable context) throws Exception {
- return Integer.valueOf(1);
+ public Object getResult( Serializable context ) throws Exception {
+ return Integer.valueOf( 1 );
}
+
@Override
public boolean supportsReverse() {
return true;
}
+
@Override
public Class<?> getResultType() {
return Number.class;
@@ -2662,15 +2673,15 @@ public void testAccumulateWithSharedNode() throws Exception {
KieSession ksession = helper.build().newKieSession();
List<String> list = new java.util.ArrayList();
- ksession.insert(list);
+ ksession.insert( list );
- ksession.insert(42.0);
- ksession.insert(9000);
- ksession.insert("a");
- ksession.insert("b");
+ ksession.insert( 42.0 );
+ ksession.insert( 9000 );
+ ksession.insert( "a" );
+ ksession.insert( "b" );
ksession.fireAllRules();
- assertEquals(1, list.size());
+ assertEquals( 1, list.size() );
}
@Test
@@ -2689,17 +2700,17 @@ public void testEmptyAccumulateInSubnetwork() {
"end";
KieHelper helper = new KieHelper();
- helper.addContent(drl, ResourceType.DRL);
+ helper.addContent( drl, ResourceType.DRL );
KieSession ksession = helper.build().newKieSession();
List<Long> list = new ArrayList<Long>();
- ksession.setGlobal("list", list);
+ ksession.setGlobal( "list", list );
- ksession.insert(1);
+ ksession.insert( 1 );
ksession.fireAllRules();
- assertEquals(1, list.size());
- assertEquals(0, (long)list.get(0));
+ assertEquals( 1, list.size() );
+ assertEquals( 0, (long) list.get( 0 ) );
}
@Test
@@ -2719,18 +2730,18 @@ public void testEmptyAccumulateInSubnetworkFollwedByPattern() {
"end";
KieHelper helper = new KieHelper();
- helper.addContent(drl, ResourceType.DRL);
+ helper.addContent( drl, ResourceType.DRL );
KieSession ksession = helper.build().newKieSession();
List<Long> list = new ArrayList<Long>();
- ksession.setGlobal("list", list);
+ ksession.setGlobal( "list", list );
- ksession.insert(1);
- ksession.insert(1L);
+ ksession.insert( 1 );
+ ksession.insert( 1L );
ksession.fireAllRules();
- assertEquals(1, list.size());
- assertEquals(0, (long)list.get(0));
+ assertEquals( 1, list.size() );
+ assertEquals( 0, (long) list.get( 0 ) );
}
@Test
@@ -2754,7 +2765,7 @@ public void testAccumulateWithoutSeparator() throws Exception {
KieServices ks = KieServices.Factory.get();
KieFileSystem kfs = ks.newKieFileSystem().write( "src/main/resources/r1.drl", str );
Results results = ks.newKieBuilder( kfs ).buildAll().getResults();
- assertFalse(results.getMessages().isEmpty());
+ assertFalse( results.getMessages().isEmpty() );
}
@Test
@@ -2772,7 +2783,7 @@ public void testFromAccumulateWithoutSeparator() throws Exception {
KieServices ks = KieServices.Factory.get();
KieFileSystem kfs = ks.newKieFileSystem().write( "src/main/resources/r1.drl", str );
Results results = ks.newKieBuilder( kfs ).buildAll().getResults();
- assertFalse(results.getMessages().isEmpty());
+ assertFalse( results.getMessages().isEmpty() );
}
@Test
@@ -2835,9 +2846,9 @@ public void testAccFunctionOpaqueJoins() throws Exception {
KieHelper helper = new KieHelper();
KieSession ks = helper.addContent( str, ResourceType.DRL ).build().newKieSession();
- List list = new ArrayList( );
+ List list = new ArrayList();
ks.setGlobal( "list", list );
- List list2 = new ArrayList( );
+ List list2 = new ArrayList();
ks.setGlobal( "list2", list2 );
// init data
@@ -2858,9 +2869,11 @@ public void testAccFunctionOpaqueJoins() throws Exception {
public static class ExpectedMessage {
String type;
- public ExpectedMessage(String type) {
+
+ public ExpectedMessage( String type ) {
this.type = type;
}
+
public String getType() {
return type;
}
@@ -2871,19 +2884,24 @@ public static class ExpectedMessageToRegister {
String type;
boolean registered = false;
List<ExpectedMessage> msgs = new ArrayList<ExpectedMessage>();
- public ExpectedMessageToRegister(String type) {
+
+ public ExpectedMessageToRegister( String type ) {
this.type = type;
}
+
public String getType() {
return type;
}
+
public List<ExpectedMessage> getExpectedMessages() {
return msgs;
}
+
public boolean isRegistered() {
return registered;
}
- public void setRegistered(boolean registered) {
+
+ public void setRegistered( boolean registered ) {
this.registered = registered;
}
}
@@ -2913,16 +2931,16 @@ public void testReaccumulateForLeftTuple() {
+ " java.lang.System.out.println( $l.size() );"
+ " end\n";
- KieSession ksession = new KieHelper().addContent(drl1, ResourceType.DRL)
+ KieSession ksession = new KieHelper().addContent( drl1, ResourceType.DRL )
.build()
.newKieSession();
- ExpectedMessage psExpMsg1 = new ExpectedMessage("Index");
+ ExpectedMessage psExpMsg1 = new ExpectedMessage( "Index" );
- ExpectedMessageToRegister etr1 = new ExpectedMessageToRegister("Index");
- etr1.msgs.add(psExpMsg1);
+ ExpectedMessageToRegister etr1 = new ExpectedMessageToRegister( "Index" );
+ etr1.msgs.add( psExpMsg1 );
- ksession.insert(etr1);
+ ksession.insert( etr1 );
ksession.fireAllRules();
}
@@ -2941,41 +2959,113 @@ public void testNoLoopAccumulate() {
" modify($a) { set($val.intValue()) }\n" +
"end";
- KieSession ksession = new KieHelper().addContent(drl1, ResourceType.DRL)
+ KieSession ksession = new KieHelper().addContent( drl1, ResourceType.DRL )
.build()
.newKieSession();
- AtomicInteger counter = new AtomicInteger(0);
- ksession.insert(counter);
+ AtomicInteger counter = new AtomicInteger( 0 );
+ ksession.insert( counter );
- ksession.insert("1");
+ ksession.insert( "1" );
ksession.fireAllRules();
- assertEquals(1, counter.get());
+ assertEquals( 1, counter.get() );
- ksession.insert("2");
+ ksession.insert( "2" );
ksession.fireAllRules();
- assertEquals(2, counter.get());
+ assertEquals( 2, counter.get() );
}
- private KieSession createKieSession(KieBase kbase) {
+ private KieSession createKieSession( KieBase kbase ) {
return kbase.newKieSession();
}
- private KieSession getKieSessionFromResources(String... classPathResources){
- KieBase kbase = loadKnowledgeBase(null, null, classPathResources);
+ private KieSession getKieSessionFromResources( String... classPathResources ) {
+ KieBase kbase = loadKnowledgeBase( null, null, classPathResources );
return kbase.newKieSession();
}
- private KieBase loadKieBaseFromString(String... drlContentStrings) {
- return loadKnowledgeBaseFromString(null, null, phreak,
- drlContentStrings);
+ private KieBase loadKieBaseFromString( String... drlContentStrings ) {
+ return loadKnowledgeBaseFromString( null, null, phreak,
+ drlContentStrings );
}
- private KieSession getKieSessionFromContentStrings(String... drlContentStrings) {
- KieBase kbase = loadKnowledgeBaseFromString(null, null, phreak,
- drlContentStrings);
+ private KieSession getKieSessionFromContentStrings( String... drlContentStrings ) {
+ KieBase kbase = loadKnowledgeBaseFromString( null, null, phreak,
+ drlContentStrings );
return kbase.newKieSession();
}
+
+ @Test
+ public void testAccumulateWithOr() {
+ // DROOLS-839
+ String drl1 =
+ "import " + Converter.class.getCanonicalName() + ";\n" +
+ "global java.util.List list;\n" +
+ "rule R when\n" +
+ " (or\n" +
+ " Integer (this == 1)\n" +
+ " Integer (this == 2)\n" +
+ " )\n" +
+ "String( $length : length )\n" +
+ "accumulate ( $c : Converter(), $result : sum( $c.convert($length) ) )\n" +
+ "then\n" +
+ " list.add($result);\n" +
+ "end";
+
+ KieSession ksession = new KieHelper().addContent( drl1, ResourceType.DRL )
+ .build()
+ .newKieSession();
+
+ List<Double> list = new ArrayList<Double>();
+ ksession.setGlobal( "list", list );
+
+ ksession.insert( 1 );
+ ksession.insert( "hello" );
+ ksession.insert( new Converter() );
+ ksession.fireAllRules();
+
+ assertEquals( 1, list.size() );
+ assertEquals( "hello".length(), (double)list.get(0), 0.01 );
+ }
+
+ @Test
+ public void testMvelAccumulateWithOr() {
+ // DROOLS-839
+ String drl1 =
+ "import " + Converter.class.getCanonicalName() + ";\n" +
+ "global java.util.List list;\n" +
+ "rule R dialect \"mvel\" when\n" +
+ " (or\n" +
+ " Integer (this == 1)\n" +
+ " Integer (this == 2)\n" +
+ " )\n" +
+ "String( $length : length )\n" +
+ "accumulate ( $c : Converter(), $result : sum( $c.convert($length) ) )\n" +
+ "then\n" +
+ " list.add($result);\n" +
+ "end";
+
+ KieSession ksession = new KieHelper().addContent( drl1, ResourceType.DRL )
+ .build()
+ .newKieSession();
+
+ List<Double> list = new ArrayList<Double>();
+ ksession.setGlobal( "list", list );
+
+ ksession.insert( 1 );
+ ksession.insert( "hello" );
+ ksession.insert( new Converter() );
+ ksession.fireAllRules();
+
+ assertEquals( 1, list.size() );
+ assertEquals( "hello".length(), (double)list.get(0), 0.01 );
+ }
+
+ public static class Converter {
+ public static int convert(int i) {
+ return i;
+ }
+ }
}
diff --git a/drools-core/src/main/java/org/drools/core/base/accumulators/MVELAccumulatorFunctionExecutor.java b/drools-core/src/main/java/org/drools/core/base/accumulators/MVELAccumulatorFunctionExecutor.java
index 2814dfb994c..9ab3a89c275 100644
--- a/drools-core/src/main/java/org/drools/core/base/accumulators/MVELAccumulatorFunctionExecutor.java
+++ b/drools-core/src/main/java/org/drools/core/base/accumulators/MVELAccumulatorFunctionExecutor.java
@@ -124,8 +124,7 @@ public void accumulate(Object workingMemoryContext,
handle.getObject(),
factory );
if ( this.function.supportsReverse() ) {
- ((MVELAccumulatorFunctionContext) context).reverseSupport.put( Integer.valueOf( handle.getId() ),
- value );
+ ((MVELAccumulatorFunctionContext) context).reverseSupport.put( handle.getId(), value );
}
this.function.accumulate( ((MVELAccumulatorFunctionContext) context).context,
value );
@@ -138,7 +137,7 @@ public void reverse(Object workingMemoryContext,
Declaration[] declarations,
Declaration[] innerDeclarations,
WorkingMemory workingMemory) throws Exception {
- final Object value = ((MVELAccumulatorFunctionContext) context).reverseSupport.remove( Integer.valueOf( handle.getId() ) );
+ final Object value = ((MVELAccumulatorFunctionContext) context).reverseSupport.remove( handle.getId() );
this.function.reverse( ((MVELAccumulatorFunctionContext) context).context,
value );
}
@@ -167,6 +166,10 @@ public Declaration[] getRequiredDeclarations() {
return unit.getPreviousDeclarations();
}
+ public void replaceDeclaration( Declaration declaration, Declaration resolved ) {
+ unit.replaceDeclaration( declaration, resolved );
+ }
+
private static class MVELAccumulatorFunctionContext
implements
Externalizable {
diff --git a/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java b/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java
index 0c1f70f4601..aecb9203c9c 100644
--- a/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java
+++ b/drools-core/src/main/java/org/drools/core/base/mvel/MVELCompilationUnit.java
@@ -118,8 +118,6 @@ public class MVELCompilationUnit
char.class );
}
- public static final Object COMPILER_LOCK = new Object();
-
public MVELCompilationUnit() {
}
@@ -240,10 +238,7 @@ public Serializable getCompiledExpression(MVELDialectRuntimeData runtimeData, Ob
String[] varNames = parserContext.getIndexedVarNames();
- ExecutableStatement stmt = (ExecutableStatement) compile( expression,
- runtimeData.getPackageClassLoader(),
- parserContext,
- languageLevel );
+ ExecutableStatement stmt = (ExecutableStatement) compile( expression, parserContext );
Set<String> localNames = parserContext.getVariables().keySet();
@@ -415,10 +410,8 @@ public static InternalFactHandle getFactHandle( Declaration declaration,
return handles.length > declaration.getPattern().getOffset() ? handles[declaration.getPattern().getOffset()] : null;
}
- public static Serializable compile( final String text,
- final ClassLoader classLoader,
- final ParserContext parserContext,
- final int languageLevel ) {
+ private static Serializable compile( final String text,
+ final ParserContext parserContext ) {
MVEL.COMPILER_OPT_ALLOW_NAKED_METH_CALL = true;
MVEL.COMPILER_OPT_ALLOW_OVERRIDE_ALL_PROPHANDLING = true;
MVEL.COMPILER_OPT_ALLOW_RESOLVE_INNERCLASSES_WITH_DOTNOTATION = true;
@@ -541,10 +534,6 @@ public static Map getInterceptors() {
return primitivesMap;
}
- public static Object getCompilerLock() {
- return COMPILER_LOCK;
- }
-
public static class DroolsVarFactory implements VariableResolverFactory {
private KnowledgeHelper knowledgeHelper;
@@ -668,15 +657,6 @@ protected VariableResolver addResolver( String name,
// return vr;
}
- private VariableResolver getResolver( String name ) {
-// for ( int i = 0; i < indexedVariableNames.length; i++ ) {
-// if ( indexedVariableNames[i].equals( name ) ) {
-// return indexedVariableResolvers[i];
-// }
-// }
- return null;
- }
-
public boolean isTarget( String name ) {
// for ( String indexedVariableName : indexedVariableNames ) {
// if ( indexedVariableName.equals( name ) ) {
diff --git a/drools-core/src/main/java/org/drools/core/rule/Accumulate.java b/drools-core/src/main/java/org/drools/core/rule/Accumulate.java
index 812e818db23..4f1cfce08ca 100755
--- a/drools-core/src/main/java/org/drools/core/rule/Accumulate.java
+++ b/drools-core/src/main/java/org/drools/core/rule/Accumulate.java
@@ -109,7 +109,6 @@ public abstract Object getResult(final Object workingMemoryContext,
/**
* Returns true if this accumulate supports reverse
- * @return
*/
public abstract boolean supportsReverse();
@@ -138,7 +137,7 @@ public Map<String, Declaration> getOuterDeclarations() {
* @inheritDoc
*/
public Declaration resolveDeclaration(final String identifier) {
- return (Declaration) this.source.getInnerDeclarations().get( identifier );
+ return this.source.getInnerDeclarations().get( identifier );
}
public abstract Object createWorkingMemoryContext();
@@ -160,7 +159,11 @@ public void replaceDeclaration(Declaration declaration,
this.requiredDeclarations[i] = resolved;
}
}
+ replaceAccumulatorDeclaration(declaration, resolved);
}
+
+ protected abstract void replaceAccumulatorDeclaration(Declaration declaration,
+ Declaration resolved);
public void resetInnerDeclarationCache() {
this.innerDeclarationCache = null;
@@ -175,6 +178,10 @@ protected Declaration[] getInnerDeclarationCache() {
return this.innerDeclarationCache;
}
+ public Declaration[] getRequiredDeclarations() {
+ return requiredDeclarations;
+ }
+
public boolean hasRequiredDeclarations() {
return requiredDeclarations != null && requiredDeclarations.length > 0;
}
diff --git a/drools-core/src/main/java/org/drools/core/rule/LogicTransformer.java b/drools-core/src/main/java/org/drools/core/rule/LogicTransformer.java
index e1715654041..91b7332fe48 100644
--- a/drools-core/src/main/java/org/drools/core/rule/LogicTransformer.java
+++ b/drools-core/src/main/java/org/drools/core/rule/LogicTransformer.java
@@ -26,7 +26,6 @@
import java.util.ArrayList;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@@ -40,7 +39,7 @@
* delegated to the Builder.
*/
public class LogicTransformer {
- private final Map orTransformations = new HashMap();
+ private final Map<GroupElement.Type, Transformation> orTransformations = new HashMap<GroupElement.Type, Transformation>();
private static LogicTransformer INSTANCE = new LogicTransformer();
@@ -93,10 +92,10 @@ public GroupElement[] transform( final GroupElement cloned, Map<String, Class<?>
ands = new GroupElement[]{wrapper};
}
- for ( int i = 0; i < ands.length; i++ ) {
+ for ( GroupElement and : ands ) {
// fix the cloned declarations
- this.fixClonedDeclarations( ands[i], globals );
- ands[i].setRoot( true );
+ this.fixClonedDeclarations( and, globals );
+ and.setRoot( true );
}
return hasNamedConsequenceAndIsStream ? processNamedConsequences(ands) : ands;
@@ -129,9 +128,8 @@ private GroupElement[] processNamedConsequences(GroupElement[] ands) {
protected GroupElement[] splitOr( final GroupElement cloned ) {
GroupElement[] ands = new GroupElement[cloned.getChildren().size()];
int i = 0;
- for ( final Iterator it = cloned.getChildren().iterator(); it.hasNext(); ) {
- final RuleConditionElement branch = (RuleConditionElement) it.next();
- if ( (branch instanceof GroupElement) && (((GroupElement) branch).isAnd()) ) {
+ for ( final RuleConditionElement branch : cloned.getChildren() ) {
+ if ( ( branch instanceof GroupElement ) && ( ( (GroupElement) branch ).isAnd() ) ) {
ands[i++] = (GroupElement) branch;
} else {
ands[i] = GroupElementFactory.newAndInstance();
@@ -146,11 +144,9 @@ protected GroupElement[] splitOr( final GroupElement cloned ) {
* During the logic transformation, we eventually clone CEs,
* specially patterns and corresponding declarations. So now
* we need to fix any references to cloned declarations.
- * @param and
- * @param globals
*/
protected void fixClonedDeclarations( GroupElement and, Map<String, Class<?>> globals ) {
- Stack contextStack = new Stack();
+ Stack<RuleConditionElement> contextStack = new Stack<RuleConditionElement>();
DeclarationScopeResolver resolver = new DeclarationScopeResolver( globals,
contextStack );
@@ -163,85 +159,53 @@ protected void fixClonedDeclarations( GroupElement and, Map<String, Class<?>> gl
/**
* recurse through the rule condition elements updating the declaration objecs
- * @param resolver
- * @param contextStack
- * @param element
*/
private void processElement(final DeclarationScopeResolver resolver,
- final Stack contextStack,
+ final Stack<RuleConditionElement> contextStack,
final RuleConditionElement element) {
if ( element instanceof Pattern ) {
Pattern pattern = (Pattern) element;
- for ( Iterator it = pattern.getNestedElements().iterator(); it.hasNext(); ) {
+ for ( RuleConditionElement ruleConditionElement : pattern.getNestedElements() ) {
processElement( resolver,
contextStack,
- (RuleConditionElement) it.next() );
+ ruleConditionElement );
}
- for (Constraint next : pattern.getConstraints()) {
- if (next instanceof Declaration) {
+ for (Constraint constraint : pattern.getConstraints()) {
+ if (constraint instanceof Declaration) {
continue;
}
- Constraint constraint = (Constraint) next;
- Declaration[] decl = constraint.getRequiredDeclarations();
- for (int i = 0; i < decl.length; i++) {
- Declaration resolved = resolver.getDeclaration(null,
- decl[i].getIdentifier());
-
- if (constraint instanceof MvelConstraint && ((MvelConstraint) constraint).isUnification()) {
- if (ClassObjectType.DroolsQuery_ObjectType.isAssignableFrom(resolved.getPattern().getObjectType())) {
- Declaration redeclaredDeclr = new Declaration(resolved.getIdentifier(), ((MvelConstraint) constraint).getFieldExtractor(), pattern, false);
- pattern.addDeclaration(redeclaredDeclr);
- } else if ( resolved.getPattern() != pattern ) {
- ((MvelConstraint) constraint).unsetUnification();
- }
- }
-
- if (resolved != null && resolved != decl[i] && resolved.getPattern() != pattern) {
- constraint.replaceDeclaration(decl[i],
- resolved);
- } else if (resolved == null) {
- // it is probably an implicit declaration, so find the corresponding pattern
- Pattern old = decl[i].getPattern();
- Pattern current = resolver.findPatternByIndex(old.getIndex());
- if (current != null && old != current) {
- resolved = new Declaration(decl[i].getIdentifier(), decl[i].getExtractor(),
- current);
- constraint.replaceDeclaration(decl[i], resolved);
- }
- }
- }
+ replaceDeclarations( resolver, pattern, constraint );
}
+
} else if ( element instanceof EvalCondition ) {
processEvalCondition(resolver, (EvalCondition) element);
+
} else if ( element instanceof Accumulate ) {
for ( RuleConditionElement rce : element.getNestedElements() ) {
- processElement( resolver,
- contextStack,
- rce );
+ processElement( resolver, contextStack, rce );
}
- ((Accumulate)element).resetInnerDeclarationCache();
+ Accumulate accumulate = (Accumulate)element;
+ replaceDeclarations( resolver, accumulate );
+ accumulate.resetInnerDeclarationCache();
+
} else if ( element instanceof From ) {
DataProvider provider = ((From) element).getDataProvider();
Declaration[] decl = provider.getRequiredDeclarations();
for (Declaration aDecl : decl) {
- Declaration resolved = resolver.getDeclaration(null,
- aDecl.getIdentifier());
+ Declaration resolved = resolver.getDeclaration(null, aDecl.getIdentifier());
if (resolved != null && resolved != aDecl) {
- provider.replaceDeclaration(aDecl,
- resolved);
+ provider.replaceDeclaration(aDecl, resolved);
} else if (resolved == null) {
// it is probably an implicit declaration, so find the corresponding pattern
Pattern old = aDecl.getPattern();
Pattern current = resolver.findPatternByIndex(old.getIndex());
if (current != null && old != current) {
- resolved = new Declaration(aDecl.getIdentifier(),
- aDecl.getExtractor(),
- current);
- provider.replaceDeclaration(aDecl,
- resolved);
+ resolved = new Declaration(aDecl.getIdentifier(), aDecl.getExtractor(), current);
+ provider.replaceDeclaration(aDecl, resolved);
}
}
}
+
} else if ( element instanceof QueryElement ) {
QueryElement qe = ( QueryElement ) element;
Pattern pattern = qe.getResultPattern();
@@ -254,7 +218,6 @@ private void processElement(final DeclarationScopeResolver resolver,
}
}
-
List<Integer> varIndexes = asList( qe.getVariableIndexes() );
for ( int i = 0; i < qe.getDeclIndexes().length; i++ ) {
Declaration declr = (Declaration) qe.getArgTemplate()[qe.getDeclIndexes()[i]];
@@ -272,15 +235,16 @@ private void processElement(final DeclarationScopeResolver resolver,
ArrayElementReader reader = new ArrayElementReader( new SelfReferenceClassFieldReader(Object[].class, "this"),
qe.getDeclIndexes()[i],
resolved.getExtractor().getExtractToClass() );
-
- declr.setReadAccessor( reader );
+ declr.setReadAccessor( reader );
varIndexes.add( qe.getDeclIndexes()[i] );
}
}
qe.setVariableIndexes( toIntArray( varIndexes ) );
+
} else if ( element instanceof ConditionalBranch ) {
processBranch( resolver, (ConditionalBranch) element );
+
} else {
contextStack.push( element );
for (RuleConditionElement ruleConditionElement : element.getNestedElements()) {
@@ -292,6 +256,59 @@ private void processElement(final DeclarationScopeResolver resolver,
}
}
+ private void replaceDeclarations( DeclarationScopeResolver resolver, Pattern pattern, Constraint constraint ) {
+ Declaration[] decl = constraint.getRequiredDeclarations();
+ for ( Declaration aDecl : decl ) {
+ Declaration resolved = resolver.getDeclaration( null,
+ aDecl.getIdentifier() );
+
+ if ( constraint instanceof MvelConstraint && ( (MvelConstraint) constraint ).isUnification() ) {
+ if ( ClassObjectType.DroolsQuery_ObjectType.isAssignableFrom( resolved.getPattern().getObjectType() ) ) {
+ Declaration redeclaredDeclr = new Declaration( resolved.getIdentifier(), ( (MvelConstraint) constraint ).getFieldExtractor(), pattern, false );
+ pattern.addDeclaration( redeclaredDeclr );
+ } else if ( resolved.getPattern() != pattern ) {
+ ( (MvelConstraint) constraint ).unsetUnification();
+ }
+ }
+
+ if ( resolved != null && resolved != aDecl && resolved.getPattern() != pattern ) {
+ constraint.replaceDeclaration( aDecl,
+ resolved );
+ } else if ( resolved == null ) {
+ // it is probably an implicit declaration, so find the corresponding pattern
+ Pattern old = aDecl.getPattern();
+ Pattern current = resolver.findPatternByIndex( old.getIndex() );
+ if ( current != null && old != current ) {
+ resolved = new Declaration( aDecl.getIdentifier(), aDecl.getExtractor(),
+ current );
+ constraint.replaceDeclaration( aDecl, resolved );
+ }
+ }
+ }
+ }
+
+ private void replaceDeclarations( DeclarationScopeResolver resolver, Accumulate accumulate ) {
+ Declaration[] decl = accumulate.getRequiredDeclarations();
+ for ( Declaration aDecl : decl ) {
+ Declaration resolved = resolver.getDeclaration( null,
+ aDecl.getIdentifier() );
+
+ if ( resolved != null && resolved != aDecl ) {
+ accumulate.replaceDeclaration( aDecl,
+ resolved );
+ } else if ( resolved == null ) {
+ // it is probably an implicit declaration, so find the corresponding pattern
+ Pattern old = aDecl.getPattern();
+ Pattern current = resolver.findPatternByIndex( old.getIndex() );
+ if ( current != null && old != current ) {
+ resolved = new Declaration( aDecl.getIdentifier(), aDecl.getExtractor(),
+ current );
+ accumulate.replaceDeclaration( aDecl, resolved );
+ }
+ }
+ }
+ }
+
private static List<Integer> asList(int[] ints) {
List<Integer> list = new ArrayList<Integer>(ints.length);
for ( int i : ints ) {
@@ -309,13 +326,12 @@ private static int[] toIntArray(List<Integer> list) {
}
private void processEvalCondition(DeclarationScopeResolver resolver, EvalCondition element) {
- Declaration[] decl = ((EvalCondition) element).getRequiredDeclarations();
+ Declaration[] decl = element.getRequiredDeclarations();
for (Declaration aDecl : decl) {
Declaration resolved = resolver.getDeclaration(null,
aDecl.getIdentifier());
if (resolved != null && resolved != aDecl) {
- ((EvalCondition) element).replaceDeclaration(aDecl,
- resolved);
+ element.replaceDeclaration( aDecl, resolved );
}
}
}
@@ -351,8 +367,7 @@ private void processTree(final GroupElement ce, boolean[] result) throws Invalid
// first we elimininate any redundancy
ce.pack();
- Object[] children = (Object[]) ce.getChildren().toArray();
- for (Object child : children) {
+ for (Object child : ce.getChildren().toArray()) {
if (child instanceof GroupElement) {
final GroupElement group = (GroupElement) child;
@@ -375,7 +390,7 @@ private void processTree(final GroupElement ce, boolean[] result) throws Invalid
}
void applyOrTransformation(final GroupElement parent) throws InvalidPatternException {
- final Transformation transformation = (Transformation) this.orTransformations.get( parent.getType() );
+ final Transformation transformation = this.orTransformations.get( parent.getType() );
if ( transformation == null ) {
throw new RuntimeException( "applyOrTransformation could not find transformation for parent '" + parent.getType() + "' and child 'OR'" );
@@ -419,9 +434,9 @@ class AndOrTransformation
Transformation {
public void transform(final GroupElement parent) throws InvalidPatternException {
- final List orsList = new ArrayList();
+ final List<GroupElement> orsList = new ArrayList<GroupElement>();
// must keep order, so, using array
- final Object[] others = new Object[parent.getChildren().size()];
+ final RuleConditionElement[] others = new RuleConditionElement[parent.getChildren().size()];
// first we split children as OR or not OR
int permutations = 1;
@@ -429,7 +444,7 @@ public void transform(final GroupElement parent) throws InvalidPatternException
for (final RuleConditionElement child : parent.getChildren()) {
if ((child instanceof GroupElement) && ((GroupElement) child).isOr()) {
permutations *= ((GroupElement) child).getChildren().size();
- orsList.add(child);
+ orsList.add((GroupElement)child);
} else {
others[index] = child;
}
@@ -441,8 +456,7 @@ public void transform(final GroupElement parent) throws InvalidPatternException
parent.getChildren().clear();
// prepare arrays and indexes to calculate permutation
- final GroupElement[] ors = (GroupElement[]) orsList.toArray( new GroupElement[orsList.size()] );
- final int[] indexes = new int[ors.length];
+ final int[] indexes = new int[orsList.size()];
// now we know how many permutations we will have, so create it
for ( int i = 1; i <= permutations; i++ ) {
@@ -450,14 +464,15 @@ public void transform(final GroupElement parent) throws InvalidPatternException
// create the actual permutations
int mod = 1;
- for ( int j = ors.length - 1; j >= 0; j-- ) {
+ for ( int j = orsList.size() - 1; j >= 0; j-- ) {
+ GroupElement or = orsList.get(j);
// we must insert at the beginning to keep the order
and.getChildren().add(0,
- ors[j].getChildren().get(indexes[j]).clone());
+ or.getChildren().get(indexes[j]).clone());
if ( (i % mod) == 0 ) {
- indexes[j] = (indexes[j] + 1) % ors[j].getChildren().size();
+ indexes[j] = (indexes[j] + 1) % or.getChildren().size();
}
- mod *= ors[j].getChildren().size();
+ mod *= or.getChildren().size();
}
// elements originally outside OR will be in every permutation, so add them
@@ -467,8 +482,7 @@ public void transform(final GroupElement parent) throws InvalidPatternException
// always add clone of them to avoid offset conflicts in declarations
// HERE IS THE MESSY PROBLEM: need to change further references to the appropriate cloned ref
- and.getChildren().add( j,
- (RuleConditionElement) ((RuleConditionElement) others[j]).clone() );
+ and.getChildren().add( j, others[j].clone() );
}
}
parent.addChild( and );
diff --git a/drools-core/src/main/java/org/drools/core/rule/MultiAccumulate.java b/drools-core/src/main/java/org/drools/core/rule/MultiAccumulate.java
index 857dc286b8c..5fe9e858f51 100644
--- a/drools-core/src/main/java/org/drools/core/rule/MultiAccumulate.java
+++ b/drools-core/src/main/java/org/drools/core/rule/MultiAccumulate.java
@@ -16,6 +16,7 @@
package org.drools.core.rule;
import org.drools.core.WorkingMemory;
+import org.drools.core.base.accumulators.MVELAccumulatorFunctionExecutor;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.spi.Accumulator;
import org.drools.core.spi.CompiledInvoker;
@@ -165,6 +166,14 @@ public Object[] getResult(final Object workingMemoryContext,
}
}
+ protected void replaceAccumulatorDeclaration(Declaration declaration, Declaration resolved) {
+ for (Accumulator accumulator : accumulators) {
+ if ( accumulator instanceof MVELAccumulatorFunctionExecutor ) {
+ ( (MVELAccumulatorFunctionExecutor) accumulator ).replaceDeclaration( declaration, resolved );
+ }
+ }
+ }
+
public MultiAccumulate clone() {
RuleConditionElement clonedSource = source instanceof GroupElement ? ((GroupElement) source).cloneOnlyGroup() : source.clone();
MultiAccumulate clone = new MultiAccumulate( clonedSource,
diff --git a/drools-core/src/main/java/org/drools/core/rule/Pattern.java b/drools-core/src/main/java/org/drools/core/rule/Pattern.java
index 68b83f0df31..2ee21dc537d 100644
--- a/drools-core/src/main/java/org/drools/core/rule/Pattern.java
+++ b/drools-core/src/main/java/org/drools/core/rule/Pattern.java
@@ -191,9 +191,7 @@ public void setClassObjectType(ClassObjectType objectType) {
public Declaration[] getRequiredDeclarations() {
Set<Declaration> decl = new HashSet<Declaration>();
for( Constraint constr : this.constraints ) {
- for( Declaration d : constr.getRequiredDeclarations() ) {
- decl.add( d );
- }
+ Collections.addAll( decl, constr.getRequiredDeclarations() );
}
return decl.toArray( new Declaration[decl.size()] );
}
@@ -450,7 +448,7 @@ public boolean equals(final Object object) {
return (this.source == null) ? other.source == null : this.source.equals( other.source );
}
- public List getNestedElements() {
+ public List<RuleConditionElement> getNestedElements() {
return this.source != null ? Collections.singletonList( this.source ) : Collections.EMPTY_LIST;
}
@@ -458,9 +456,6 @@ public boolean isPatternScopeDelimiter() {
return true;
}
- /**
- * @param constraint
- */
private void setConstraintType(final MutableTypeConstraint constraint) {
final Declaration[] declarations = constraint.getRequiredDeclarations();
diff --git a/drools-core/src/main/java/org/drools/core/rule/SingleAccumulate.java b/drools-core/src/main/java/org/drools/core/rule/SingleAccumulate.java
index 65b0d935978..8ee99d5f915 100644
--- a/drools-core/src/main/java/org/drools/core/rule/SingleAccumulate.java
+++ b/drools-core/src/main/java/org/drools/core/rule/SingleAccumulate.java
@@ -16,6 +16,7 @@
package org.drools.core.rule;
import org.drools.core.WorkingMemory;
+import org.drools.core.base.accumulators.MVELAccumulatorFunctionExecutor;
import org.drools.core.common.InternalFactHandle;
import org.drools.core.spi.Accumulator;
import org.drools.core.spi.CompiledInvoker;
@@ -153,6 +154,12 @@ public SingleAccumulate clone() {
return clone;
}
+ protected void replaceAccumulatorDeclaration(Declaration declaration, Declaration resolved) {
+ if (accumulator instanceof MVELAccumulatorFunctionExecutor) {
+ ( (MVELAccumulatorFunctionExecutor) accumulator ).replaceDeclaration( declaration, resolved );
+ }
+ }
+
public Object createWorkingMemoryContext() {
return this.accumulator.createWorkingMemoryContext();
}
|
183a92087fbe62f57cda2450a1c603eeaa398776
|
Delta Spike
|
DELTASPIKE-273 fix JavaDoc
|
p
|
https://github.com/apache/deltaspike
|
diff --git a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java
index 1fcecc134..14579f5b8 100644
--- a/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java
+++ b/deltaspike/core/impl/src/main/java/org/apache/deltaspike/core/impl/util/JndiUtils.java
@@ -168,7 +168,7 @@ else if (result instanceof String) //but the target type != String
* Resolves an instances for the given naming context.
*
* @param name context name
- * @param targetType target type
+ * @param type target type
* @param <T> type
* @return the found instances, null otherwise
*/
|
8d695a2f71b4c10c0b7cfff503c6bd64bd4ab8f8
|
orientdb
|
Issue -1404 Write cache speed improvements.--
|
a
|
https://github.com/orientechnologies/orientdb
|
diff --git a/commons/src/main/java/com/orientechnologies/common/concur/lock/OLockManager.java b/commons/src/main/java/com/orientechnologies/common/concur/lock/OLockManager.java
old mode 100644
new mode 100755
index f982a5b26f4..0251c5f5489
--- a/commons/src/main/java/com/orientechnologies/common/concur/lock/OLockManager.java
+++ b/commons/src/main/java/com/orientechnologies/common/concur/lock/OLockManager.java
@@ -71,6 +71,49 @@ public void acquireLock(final REQUESTER_TYPE iRequester, final RESOURCE_TYPE iRe
acquireLock(iRequester, iResourceId, iLockType, acquireTimeout);
}
+ public boolean tryLock(final REQUESTER_TYPE iRequester, final RESOURCE_TYPE iResourceId, final LOCK iLockType) {
+ if (!enabled)
+ return false;
+
+ CountableLock lock;
+ final Object internalLock = internalLock(iResourceId);
+ synchronized (internalLock) {
+ lock = map.get(iResourceId);
+ if (lock == null) {
+ final CountableLock newLock = new CountableLock(false);
+ lock = map.putIfAbsent(getImmutableResourceId(iResourceId), newLock);
+ if (lock == null)
+ lock = newLock;
+ }
+ lock.countLocks++;
+ }
+
+ boolean result;
+ try {
+ if (iLockType == LOCK.SHARED)
+ result = lock.readLock().tryLock();
+ else
+ result = lock.writeLock().tryLock();
+ } catch (RuntimeException e) {
+ synchronized (internalLock) {
+ lock.countLocks--;
+ if (lock.countLocks == 0)
+ map.remove(iResourceId);
+ }
+ throw e;
+ }
+
+ if (!result) {
+ synchronized (internalLock) {
+ lock.countLocks--;
+ if (lock.countLocks == 0)
+ map.remove(iResourceId);
+ }
+ }
+
+ return result;
+ }
+
public void acquireLock(final REQUESTER_TYPE iRequester, final RESOURCE_TYPE iResourceId, final LOCK iLockType, long iTimeout) {
if (!enabled)
return;
@@ -119,6 +162,10 @@ public void acquireLock(final REQUESTER_TYPE iRequester, final RESOURCE_TYPE iRe
}
+ public void tryacquireLock(final REQUESTER_TYPE iRequester, final RESOURCE_TYPE iResourceId, final LOCK iLockType, long iTimeout) {
+
+ }
+
public void releaseLock(final REQUESTER_TYPE iRequester, final RESOURCE_TYPE iResourceId, final LOCK iLockType)
throws OLockException {
if (!enabled)
diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/cache/OWOWCache.java b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/cache/OWOWCache.java
index dbeef3ab6d5..7db1d9a2d07 100755
--- a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/cache/OWOWCache.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/cache/OWOWCache.java
@@ -617,11 +617,18 @@ private int iterateBySubRing(NavigableMap<GroupKey, WriteGroup> subMap, int writ
final WriteGroup group = entry.getValue();
final GroupKey groupKey = entry.getKey();
+ if (group.recencyBit && group.creationTime - currentTime < groupTTL && !forceFlush) {
+ group.recencyBit = false;
+ continue;
+ }
+
lockManager.acquireLock(Thread.currentThread(), entry.getKey(), OLockManager.LOCK.EXCLUSIVE);
try {
if (group.recencyBit && group.creationTime - currentTime < groupTTL && !forceFlush)
group.recencyBit = false;
else {
+ group.recencyBit = false;
+
List<PageKey> lockedPages = new ArrayList<PageKey>();
for (int i = 0; i < 16; i++) {
final PageKey pageKey = new PageKey(groupKey.fileId, groupKey.groupIndex << 4 + i);
diff --git a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/cache/WriteGroup.java b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/cache/WriteGroup.java
index 6c9ff4c1ec1..5162197e449 100755
--- a/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/cache/WriteGroup.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/index/hashindex/local/cache/WriteGroup.java
@@ -5,14 +5,13 @@
* @since 7/24/13
*/
class WriteGroup {
- public OCachePointer[] pages = new OCachePointer[16];
+ public OCachePointer[] pages = new OCachePointer[16];
- public boolean recencyBit;
- public long creationTime;
+ public volatile boolean recencyBit;
+ public final long creationTime;
WriteGroup(long creationTime) {
- this.creationTime = creationTime;
-
this.recencyBit = true;
+ this.creationTime = creationTime;
}
}
diff --git a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/LocalCreateDocumentSpeedTest.java b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/LocalCreateDocumentSpeedTest.java
index cc08c82e095..24670918ed5 100755
--- a/tests/src/test/java/com/orientechnologies/orient/test/database/speed/LocalCreateDocumentSpeedTest.java
+++ b/tests/src/test/java/com/orientechnologies/orient/test/database/speed/LocalCreateDocumentSpeedTest.java
@@ -20,6 +20,7 @@
import org.testng.annotations.Test;
import com.orientechnologies.orient.core.Orient;
+import com.orientechnologies.orient.core.config.OGlobalConfiguration;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.db.document.ODatabaseDocumentTx;
import com.orientechnologies.orient.core.intent.OIntentMassiveInsert;
@@ -47,6 +48,9 @@ public LocalCreateDocumentSpeedTest() throws InstantiationException, IllegalAcce
@Override
@Test(enabled = false)
public void init() {
+ OGlobalConfiguration.USE_WAL.setValue(false);
+ OGlobalConfiguration.STORAGE_COMPRESSION_METHOD.setValue("nothing");
+
database = new ODatabaseDocumentTx(System.getProperty("url"));
if (database.exists()) {
database.open("admin", "admin");
|
7eb1ca53b3f1acad4d12cf866075ceace5aabf1f
|
hadoop
|
YARN-1608. LinuxContainerExecutor has a few DEBUG- messages at INFO level (kasha)--git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1558875 13f79535-47bb-0310-9956-ffa450edef68-
|
p
|
https://github.com/apache/hadoop
|
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 0b37d93a07cb9..0cadb4bbac2b8 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -325,6 +325,9 @@ Release 2.4.0 - UNRELEASED
YARN-1351. Invalid string format in Fair Scheduler log warn message
(Konstantin Weitz via Sandy Ryza)
+ YARN-1608. LinuxContainerExecutor has a few DEBUG messages at INFO level
+ (kasha)
+
Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java
index 3e097815d10cc..0b1af0dd472e0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/LinuxContainerExecutor.java
@@ -218,8 +218,6 @@ public void startLocalizer(Path nmPrivateContainerTokensPath,
}
String[] commandArray = command.toArray(new String[command.size()]);
ShellCommandExecutor shExec = new ShellCommandExecutor(commandArray);
- // TODO: DEBUG
- LOG.info("initApplication: " + Arrays.toString(commandArray));
if (LOG.isDebugEnabled()) {
LOG.debug("initApplication: " + Arrays.toString(commandArray));
}
@@ -275,8 +273,9 @@ public int launchContainer(Container container,
String[] commandArray = command.toArray(new String[command.size()]);
shExec = new ShellCommandExecutor(commandArray, null, // NM's cwd
container.getLaunchContext().getEnvironment()); // sanitized env
- // DEBUG
- LOG.info("launchContainer: " + Arrays.toString(commandArray));
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("launchContainer: " + Arrays.toString(commandArray));
+ }
shExec.execute();
if (LOG.isDebugEnabled()) {
logOutput(shExec.getOutput());
@@ -375,7 +374,6 @@ public void deleteAsUser(String user, Path dir, Path... baseDirs) {
}
String[] commandArray = command.toArray(new String[command.size()]);
ShellCommandExecutor shExec = new ShellCommandExecutor(commandArray);
- LOG.info(" -- DEBUG -- deleteAsUser: " + Arrays.toString(commandArray));
if (LOG.isDebugEnabled()) {
LOG.debug("deleteAsUser: " + Arrays.toString(commandArray));
}
|
7dab4986c80921d6d9ed7a93f7145c9592701678
|
Mylyn Reviews
|
Removed TBR from the build
|
p
|
https://github.com/eclipse-mylyn/org.eclipse.mylyn.reviews
|
diff --git a/pom.xml b/pom.xml
index b34da4b2..84940387 100644
--- a/pom.xml
+++ b/pom.xml
@@ -9,7 +9,9 @@
<modules>
<module>releng/reviews-target-definition</module>
+<!--
<module>tbr</module>
+-->
<module>versions</module>
<module>gerrit</module>
<module>r4e</module>
|
c00c4d3881ddd790a2dae2686bd64df40102332c
|
kotlin
|
KT-1808 Auto import offers private static Java- classes -KT-1808 fixed--
|
c
|
https://github.com/JetBrains/kotlin
|
diff --git a/idea/src/org/jetbrains/jet/plugin/caches/JetShortNamesCache.java b/idea/src/org/jetbrains/jet/plugin/caches/JetShortNamesCache.java
index 4492e250cfc9f..9f4256bebb559 100644
--- a/idea/src/org/jetbrains/jet/plugin/caches/JetShortNamesCache.java
+++ b/idea/src/org/jetbrains/jet/plugin/caches/JetShortNamesCache.java
@@ -17,7 +17,6 @@
package org.jetbrains.jet.plugin.caches;
import com.google.common.base.Function;
-import com.google.common.base.Predicate;
import com.google.common.collect.Collections2;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
@@ -36,7 +35,10 @@
import org.jetbrains.jet.asJava.JavaElementFinder;
import org.jetbrains.jet.lang.descriptors.*;
import org.jetbrains.jet.lang.psi.*;
-import org.jetbrains.jet.lang.resolve.*;
+import org.jetbrains.jet.lang.resolve.BindingContext;
+import org.jetbrains.jet.lang.resolve.BindingTraceContext;
+import org.jetbrains.jet.lang.resolve.ImportPath;
+import org.jetbrains.jet.lang.resolve.QualifiedExpressionResolver;
import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.scopes.JetScope;
import org.jetbrains.jet.lang.types.JetType;
@@ -48,7 +50,6 @@
import org.jetbrains.jet.plugin.stubindex.JetFullClassNameIndex;
import org.jetbrains.jet.plugin.stubindex.JetShortClassNameIndex;
import org.jetbrains.jet.plugin.stubindex.JetShortFunctionNameIndex;
-import org.jetbrains.jet.util.QualifiedNamesUtil;
import java.util.*;
@@ -93,7 +94,7 @@ public PsiClass[] getClassesByName(@NotNull @NonNls String name, @NotNull Global
List<PsiClass> result = new ArrayList<PsiClass>();
for (String fqName : JetFullClassNameIndex.getInstance().getAllKeys(project)) {
- if (QualifiedNamesUtil.fqnToShortName(new FqName(fqName)).getName().equals(name)) {
+ if ((new FqName(fqName)).shortName().getName().equals(name)) {
PsiClass psiClass = javaElementFinder.findClass(fqName, scope);
if (psiClass != null) {
result.add(psiClass);
@@ -129,17 +130,6 @@ public DeclarationDescriptor apply(@Nullable ClassDescriptor classDescriptor) {
return standardTypes;
}
- @NotNull
- public Collection<FqName> getFQNamesByName(@NotNull final String name, JetFile file, @NotNull GlobalSearchScope scope) {
- BindingContext context = WholeProjectAnalyzerFacade.analyzeProjectWithCacheOnAFile(file).getBindingContext();
- return Collections2.filter(context.getKeys(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR), new Predicate<FqName>() {
- @Override
- public boolean apply(@Nullable FqName fqName) {
- return fqName != null && QualifiedNamesUtil.isShortNameForFQN(name, fqName);
- }
- });
- }
-
/**
* Get jet non-extension top-level function names. Method is allowed to give invalid names - all result should be
* checked with getTopLevelFunctionDescriptorsByName().
diff --git a/idea/src/org/jetbrains/jet/plugin/quickfix/ImportClassAndFunFix.java b/idea/src/org/jetbrains/jet/plugin/quickfix/ImportClassAndFunFix.java
index 25a9e4c8b53e3..fb49e881f31ca 100644
--- a/idea/src/org/jetbrains/jet/plugin/quickfix/ImportClassAndFunFix.java
+++ b/idea/src/org/jetbrains/jet/plugin/quickfix/ImportClassAndFunFix.java
@@ -30,28 +30,32 @@
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiFile;
-import com.intellij.psi.search.DelegatingGlobalSearchScope;
+import com.intellij.psi.PsiMember;
+import com.intellij.psi.PsiModifier;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.PsiShortNamesCache;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jet.asJava.JetLightClass;
+import org.jetbrains.jet.lang.descriptors.ClassDescriptor;
import org.jetbrains.jet.lang.descriptors.DeclarationDescriptor;
import org.jetbrains.jet.lang.descriptors.FunctionDescriptor;
+import org.jetbrains.jet.lang.descriptors.Visibilities;
import org.jetbrains.jet.lang.diagnostics.Diagnostic;
import org.jetbrains.jet.lang.psi.JetFile;
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
+import org.jetbrains.jet.lang.resolve.BindingContext;
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
-import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.lang.resolve.ImportPath;
+import org.jetbrains.jet.lang.resolve.name.FqName;
import org.jetbrains.jet.plugin.JetBundle;
-import org.jetbrains.jet.plugin.JetFileType;
import org.jetbrains.jet.plugin.actions.JetAddImportAction;
import org.jetbrains.jet.plugin.caches.JetCacheManager;
import org.jetbrains.jet.plugin.caches.JetShortNamesCache;
+import org.jetbrains.jet.plugin.project.WholeProjectAnalyzerFacade;
import java.util.Collection;
import java.util.Collections;
@@ -100,8 +104,10 @@ public boolean apply(@Nullable FqName fqName) {
}
});
}
-
- private static Collection<FqName> getJetTopLevelFunctions(@NotNull String referenceName, JetSimpleNameExpression expression, @NotNull Project project) {
+
+ private static Collection<FqName> getJetTopLevelFunctions(@NotNull String referenceName,
+ JetSimpleNameExpression expression,
+ @NotNull Project project) {
JetShortNamesCache namesCache = JetCacheManager.getInstance(project).getNamesCache();
Collection<FunctionDescriptor> topLevelFunctions = namesCache.getTopLevelFunctionDescriptorsByName(
referenceName,
@@ -148,33 +154,58 @@ public FqName apply(@Nullable DeclarationDescriptor declarationDescriptor) {
public static Collection<FqName> getClassNames(@NotNull String referenceName, @NotNull JetFile file) {
final GlobalSearchScope scope = GlobalSearchScope.allScope(file.getProject());
Set<FqName> possibleResolveNames = Sets.newHashSet();
- possibleResolveNames.addAll(JetCacheManager.getInstance(file.getProject()).getNamesCache().getFQNamesByName(referenceName, file, scope));
+
possibleResolveNames.addAll(getJavaClasses(referenceName, file.getProject(), scope));
// TODO: Do appropriate sorting
return Lists.newArrayList(possibleResolveNames);
}
- private static Collection<FqName> getJavaClasses(@NotNull final String typeName, @NotNull Project project, final GlobalSearchScope scope) {
+ private static Collection<FqName> getJavaClasses(@NotNull final String typeName,
+ @NotNull Project project,
+ final GlobalSearchScope scope) {
PsiShortNamesCache cache = PsiShortNamesCache.getInstance(project);
- PsiClass[] classes = cache.getClassesByName(typeName, new DelegatingGlobalSearchScope(scope) {
+ PsiClass[] classes = cache.getClassesByName(typeName, scope);
+
+ Collection<PsiClass> accessibleClasses = Collections2.filter(Lists.newArrayList(classes), new Predicate<PsiClass>() {
@Override
- public boolean contains(@NotNull VirtualFile file) {
- return myBaseScope.contains(file) && file.getFileType() != JetFileType.INSTANCE;
+ public boolean apply(PsiClass psiClass) {
+ assert psiClass != null;
+ return isAccessible(psiClass);
}
});
- return Collections2.transform(Lists.newArrayList(classes), new Function<PsiClass, FqName>() {
+ return Collections2.transform(accessibleClasses, new Function<PsiClass, FqName>() {
@Nullable
@Override
public FqName apply(@Nullable PsiClass javaClass) {
assert javaClass != null;
- return new FqName(javaClass.getQualifiedName());
+ String qualifiedName = javaClass.getQualifiedName();
+ assert qualifiedName != null;
+ return new FqName(qualifiedName);
}
});
}
+ private static boolean isAccessible(PsiMember member) {
+ if (member instanceof JetLightClass) {
+ // TODO: Now light class can't losing accessibility information
+ JetLightClass lightClass = (JetLightClass) member;
+ BindingContext context = WholeProjectAnalyzerFacade.analyzeProjectWithCacheOnAFile((JetFile) lightClass.getContainingFile()).getBindingContext();
+ ClassDescriptor descriptor = context.get(BindingContext.FQNAME_TO_CLASS_DESCRIPTOR, lightClass.getFqName());
+
+ if (descriptor != null) {
+ return descriptor.getVisibility() == Visibilities.PUBLIC || descriptor.getVisibility() == Visibilities.INTERNAL;
+ }
+ else {
+ assert false : "Descriptor of the class isn't found in the binding context";
+ }
+ }
+
+ return member.hasModifierProperty(PsiModifier.PUBLIC) || member.hasModifierProperty(PsiModifier.PROTECTED);
+ }
+
@Override
public boolean showHint(@NotNull Editor editor) {
if (suggestions.isEmpty()) {
@@ -220,7 +251,8 @@ public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file
}
@Override
- public void invoke(@NotNull final Project project, @NotNull final Editor editor, final PsiFile file) throws IncorrectOperationException {
+ public void invoke(@NotNull final Project project, @NotNull final Editor editor, final PsiFile file)
+ throws IncorrectOperationException {
CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
@Override
public void run() {
diff --git a/idea/testData/quickfix/autoImports/noImportForPrivateClass.after.kt b/idea/testData/quickfix/autoImports/noImportForPrivateClass.after.kt
new file mode 100644
index 0000000000000..880e647c55971
--- /dev/null
+++ b/idea/testData/quickfix/autoImports/noImportForPrivateClass.after.kt
@@ -0,0 +1,5 @@
+// "Import Class" "false"
+
+fun test() {
+ PrivateClass
+}
\ No newline at end of file
diff --git a/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.Main.kt b/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.Main.kt
new file mode 100644
index 0000000000000..926bed4da6bc0
--- /dev/null
+++ b/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.Main.kt
@@ -0,0 +1,5 @@
+// "Import" "false"
+
+fun test() {
+ <caret>PrivateClass
+}
\ No newline at end of file
diff --git a/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.data.Sample.kt b/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.data.Sample.kt
new file mode 100644
index 0000000000000..cbd83c6a1c2b5
--- /dev/null
+++ b/idea/testData/quickfix/autoImports/noImportForPrivateClass.before.data.Sample.kt
@@ -0,0 +1,3 @@
+package sometest
+
+private class PrivateClass
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/jet/plugin/quickfix/AutoImportFixTest.java b/idea/tests/org/jetbrains/jet/plugin/quickfix/AutoImportFixTest.java
index a3c9ca3f74150..920f5a9e83d73 100644
--- a/idea/tests/org/jetbrains/jet/plugin/quickfix/AutoImportFixTest.java
+++ b/idea/tests/org/jetbrains/jet/plugin/quickfix/AutoImportFixTest.java
@@ -38,6 +38,10 @@ public void testFunctionImport() throws Exception {
doTest();
}
+ public void testNoImportForPrivateClass() throws Exception {
+ doTest();
+ }
+
@Override
protected String getCheckFileName() {
return getTestName(true) + ".after.kt";
|
d64e6060d9ddcdd681fa0e739e16549f344dbc11
|
iee$iee
|
some refactoring: move all translator functionality from formula to org.eclipse.iee.translator.antlr project
|
p
|
https://github.com/iee/iee
|
diff --git a/org.eclipse.iee.sample.formula/.classpath b/org.eclipse.iee.sample.formula/.classpath
index 1745d6c3..1b246d5c 100644
--- a/org.eclipse.iee.sample.formula/.classpath
+++ b/org.eclipse.iee.sample.formula/.classpath
@@ -3,10 +3,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="lib" path="lib/xstream-1.4.2.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/jlatexmath-embedded-fop-1.0.0.jar"/>
- <classpathentry kind="lib" path="lib/ST-4.0.7.jar"/>
<classpathentry kind="lib" path="lib/symja-2012-04-08.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.iee.sample.formula/META-INF/MANIFEST.MF b/org.eclipse.iee.sample.formula/META-INF/MANIFEST.MF
index bab88f95..6708d6f0 100644
--- a/org.eclipse.iee.sample.formula/META-INF/MANIFEST.MF
+++ b/org.eclipse.iee.sample.formula/META-INF/MANIFEST.MF
@@ -18,10 +18,8 @@ Import-Package: org.eclipse.core.expressions,
org.eclipse.iee.translator.antlr.translator,
org.eclipse.ui
Bundle-ClassPath: .,
- lib/xstream-1.4.2.jar,
lib/log4j-1.2.17.jar,
lib/jlatexmath-embedded-fop-1.0.0.jar,
- lib/ST-4.0.7.jar,
lib/symja-2012-04-08.jar
Export-Package: org.eclipse.iee.sample.formula,
org.eclipse.iee.sample.formula.pad
diff --git a/org.eclipse.iee.sample.formula/build.properties b/org.eclipse.iee.sample.formula/build.properties
index 295f8007..bb6fb845 100644
--- a/org.eclipse.iee.sample.formula/build.properties
+++ b/org.eclipse.iee.sample.formula/build.properties
@@ -10,8 +10,6 @@ bin.includes = META-INF/,\
lib/jlatexmath-embedded-fop-1.0.0.jar,\
lib/ST-4.0.7.jar,\
templates/
-jars.extra.classpath = lib/xstream-1.4.2.jar,\
- lib/log4j-1.2.17.jar,\
+jars.extra.classpath = lib/log4j-1.2.17.jar,\
lib/jlatexmath-embedded-fop-1.0.0.jar,\
- lib/ST-4.0.7.jar,\
lib/symja-2012-04-08.jar
diff --git a/org.eclipse.iee.sample.formula/lib/xstream-1.4.2.jar b/org.eclipse.iee.sample.formula/lib/xstream-1.4.2.jar
deleted file mode 100644
index fa8e2ed5..00000000
Binary files a/org.eclipse.iee.sample.formula/lib/xstream-1.4.2.jar and /dev/null differ
diff --git a/org.eclipse.iee.sample.formula/src/org/eclipse/iee/sample/formula/pad/FormulaPad.java b/org.eclipse.iee.sample.formula/src/org/eclipse/iee/sample/formula/pad/FormulaPad.java
index 7bcef9cd..7948e558 100644
--- a/org.eclipse.iee.sample.formula/src/org/eclipse/iee/sample/formula/pad/FormulaPad.java
+++ b/org.eclipse.iee.sample.formula/src/org/eclipse/iee/sample/formula/pad/FormulaPad.java
@@ -2,7 +2,6 @@
import java.util.Collection;
import java.util.Map;
-import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.log4j.Logger;
@@ -15,7 +14,6 @@
import org.eclipse.iee.sample.formula.pad.hover.HoverShell;
import org.eclipse.iee.sample.formula.utils.FormulaRenderer;
import org.eclipse.iee.sample.formula.utils.Function;
-import org.eclipse.iee.sample.formula.utils.Translator;
import org.eclipse.iee.translator.antlr.translator.JavaTranslator;
import org.eclipse.iee.translator.antlr.translator.JavaTranslator.VariableType;
import org.eclipse.jface.text.Document;
@@ -43,9 +41,6 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
-import org.stringtemplate.v4.ST;
-import org.stringtemplate.v4.STGroup;
-import org.stringtemplate.v4.STGroupDir;
public class FormulaPad extends Pad {
@@ -163,7 +158,7 @@ public void validateInput() {
String text = fDocument.get();
fOriginalExpression = text;
- if (Translator.isTextValid(text)) {
+ if (JavaTranslator.validate(text)) {
setInputIsValid();
fLastValidText = text;
} else {
@@ -193,100 +188,23 @@ public void processInput() {
/* Generate code */
- String generated = Translator.translateElement(fTranslatingExpression,
- getContainer().getContainerManager().getCompilationUnit(),
- getContainer().getPosition().getOffset());
-
- /* Add result output */
- if (!fTranslatingExpression.trim().isEmpty())
- if (fTranslatingExpression
- .charAt(fTranslatingExpression.length() - 1) == '=') {
- String[] parts = fTranslatingExpression.split("=");
-
- if (parts.length == 1)
- {
- String output = generateOutputCode(generated);
- generated = output;
- }
- else if (parts.length > 1)
- {
- String output = generateOutputCode(fTranslatingExpression);
- generated += output;
- }
- }
+ String generated = "";
+ try {
+ generated = JavaTranslator.translate(fTranslatingExpression,
+ getContainer().getContainerManager().getCompilationUnit(),
+ getContainer().getPosition().getOffset(), getContainerID(),
+ getContainer().getContainerManager().getStoragePath(),
+ FileMessager.getInstance().getRuntimeDirectoryName());
+ } catch (Exception e) {
+ generated = "";
+ logger.error(e.getMessage());
+ e.printStackTrace();
+ }
+
getContainer().setTextContent(generated);
getContainer().setValue(fOriginalExpression);
}
- public String generateOutputCode(String expression) {
- String expr = expression;
-
- String[] parts = expr.replaceAll(Pattern.quote("{"), "")
- .replaceAll(Pattern.quote("}"), "").split("=");
- if (parts.length >= 1) {
- String variable = expression;
- if (parts.length > 1)
- variable = expression.substring(0, expression.indexOf('='));
-
- variable = variable.trim();
- variable = variable.replaceAll(Pattern.quote("{"), "");
- variable = variable.replaceAll(Pattern.quote("}"), "");
- VariableType varType = JavaTranslator.getVariableType();
-
- if (varType == null) {
- if (JavaTranslator.getDoubleFields().contains(variable))
- varType = JavaTranslator.VariableType.DOUBLE;
- else if (JavaTranslator.getIntegerFields().contains(variable))
- varType = JavaTranslator.VariableType.INT;
- else if (JavaTranslator.getMatrixFields().contains(variable))
- varType = JavaTranslator.VariableType.MATRIX;
- else
- return "";
- }
-
- logger.debug("Type:" + varType.toString());
- STGroup group = new STGroupDir("/templates");
-
- if (varType != JavaTranslator.VariableType.MATRIX) {
-
- String type = "";
- if (varType == JavaTranslator.VariableType.DOUBLE)
- type = "double";
- else if (varType == JavaTranslator.VariableType.INT)
- type = "int";
-
- ST template = group.getInstanceOf("variable");
-
- template.add("type", type);
- template.add("id", getContainerID());
- template.add("variable", variable);
- template.add("path", getContainer().getContainerManager()
- .getStoragePath()
- + FileMessager.getInstance().getRuntimeDirectoryName());
-
- return template.render(1).trim().replaceAll("\r\n", "")
- .replaceAll("\t", " ");
-
- } else {
-
- String type = "Matrix";
-
- ST template = group.getInstanceOf("matrix");
- template.add("type", type);
- template.add("id", getContainerID());
- template.add("variable", variable);
- template.add("path", getContainer().getContainerManager()
- .getStoragePath()
- + FileMessager.getInstance().getRuntimeDirectoryName());
-
- return template.render(1).trim().replaceAll("\r\n", "")
- .replaceAll("\t", " ");
- }
- } else {
- return "";
- }
- }
-
public void updateLastResult(String result) {
final Image image;
diff --git a/org.eclipse.iee.sample.formula/src/org/eclipse/iee/sample/formula/utils/Translator.java b/org.eclipse.iee.sample.formula/src/org/eclipse/iee/sample/formula/utils/Translator.java
deleted file mode 100644
index 613ad60d..00000000
--- a/org.eclipse.iee.sample.formula/src/org/eclipse/iee/sample/formula/utils/Translator.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.eclipse.iee.sample.formula.utils;
-
-import java.util.Map;
-import java.util.TreeMap;
-
-import org.apache.log4j.Logger;
-import org.eclipse.iee.translator.antlr.translator.JavaTranslator;
-import org.eclipse.jdt.core.ICompilationUnit;
-
-public class Translator {
-
- private static final Logger logger = Logger.getLogger(Translator.class);
-
- protected static Map<String, String> fCachedItems = new TreeMap<String, String>();
-
- public static boolean isTextValid(String text) {
-// if (fCachedItems.containsKey(text)) {
-// return true;
-// }
-
- if (translateElement(text) == "") {
- return false;
- } else {
- return true;
- }
- }
-
- public static String translateElement(String text) {
- if (text.trim().isEmpty())
- return null;
-
-// String cached = fCachedItems.get(text);
-// if (cached != null) {
-// return cached;
-// }
-
- // XXX Rewrite this
-
- String resultJava;
- try {
-
- if (text.charAt(0) == '=') {
-
- resultJava = JavaTranslator.translate(text.substring(1));
- resultJava = "=" + resultJava;
- } else if (text.charAt(text.length() - 1) == '=') {
- resultJava = JavaTranslator.translate(text.substring(0,
- text.length() - 1));
- } else {
- resultJava = JavaTranslator.translate(text);
- }
-
- if (resultJava == null) {
- return null;
- }
- if (resultJava.matches(";")) {
- return null;
- }
- } catch (Exception e) {
- logger.error(e.getMessage());
- e.printStackTrace();
- return null;
- }
-
- // logger.debug("java: " + resultJava);
- // fCachedItems.put(text, resultJava);
- return resultJava;
- }
-
- public static String translateElement(String text,
- ICompilationUnit compilationUnit, int position) {
- if (text.trim().isEmpty())
- return null;
-
-// String cached = fCachedItems.get(text);
-// if (cached != null) {
-// return cached;
-// }
-
- // XXX Rewrite this
-
- String resultJava;
- try {
-
- if (text.charAt(0) == '=') {
-
- resultJava = JavaTranslator.translate(text.substring(1),
- compilationUnit, position);
- resultJava = "=" + resultJava;
- } else if (text.charAt(text.length() - 1) == '=') {
- resultJava = JavaTranslator.translate(
- text.substring(0, text.length() - 1), compilationUnit,
- position);
- } else {
- resultJava = JavaTranslator.translate(text, compilationUnit,
- position);
- }
-
- if (resultJava == null) {
- return null;
- }
- if (resultJava.matches(";")) {
- return null;
- }
- } catch (Exception e) {
- logger.error(e.getMessage());
- e.printStackTrace();
- return null;
- }
-
- logger.debug("java: " + resultJava);
- //fCachedItems.put(text, resultJava);
- return resultJava;
- }
-}
diff --git a/org.eclipse.iee.translator.antlr/.classpath b/org.eclipse.iee.translator.antlr/.classpath
index 9c7c0d81..2bbae50c 100644
--- a/org.eclipse.iee.translator.antlr/.classpath
+++ b/org.eclipse.iee.translator.antlr/.classpath
@@ -6,5 +6,6 @@
<classpathentry kind="src" path="tests"/>
<classpathentry kind="lib" path="lib/log4j-1.2.17.jar"/>
<classpathentry kind="lib" path="lib/antlr-4.0-complete.jar"/>
+ <classpathentry kind="lib" path="lib/ST-4.0.7.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.iee.translator.antlr/META-INF/MANIFEST.MF b/org.eclipse.iee.translator.antlr/META-INF/MANIFEST.MF
index eb223c02..bcd5de98 100644
--- a/org.eclipse.iee.translator.antlr/META-INF/MANIFEST.MF
+++ b/org.eclipse.iee.translator.antlr/META-INF/MANIFEST.MF
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: Antlr
+Bundle-Name: IEE Antlr translator
Bundle-SymbolicName: org.eclipse.iee.translator.antlr
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.iee.translator.antlr.Activator
@@ -15,4 +15,5 @@ Export-Package: org.eclipse.iee.translator.antlr.math,
org.eclipse.iee.translator.antlr.translator
Bundle-ClassPath: .,
lib/log4j-1.2.17.jar,
- lib/antlr-4.0-complete.jar
+ lib/antlr-4.0-complete.jar,
+ lib/ST-4.0.7.jar
diff --git a/org.eclipse.iee.translator.antlr/build.properties b/org.eclipse.iee.translator.antlr/build.properties
index 4f8120de..04650611 100644
--- a/org.eclipse.iee.translator.antlr/build.properties
+++ b/org.eclipse.iee.translator.antlr/build.properties
@@ -3,6 +3,9 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
lib/log4j-1.2.17.jar,\
- lib/antlr-4.0-complete.jar
+ lib/antlr-4.0-complete.jar,\
+ lib/ST-4.0.7.jar,\
+ templates/
jars.extra.classpath = lib/log4j-1.2.17.jar,\
- lib/antlr-4.0-complete.jar
+ lib/antlr-4.0-complete.jar,\
+ lib/ST-4.0.7.jar
diff --git a/org.eclipse.iee.sample.formula/lib/ST-4.0.7.jar b/org.eclipse.iee.translator.antlr/lib/ST-4.0.7.jar
similarity index 100%
rename from org.eclipse.iee.sample.formula/lib/ST-4.0.7.jar
rename to org.eclipse.iee.translator.antlr/lib/ST-4.0.7.jar
diff --git a/org.eclipse.iee.translator.antlr/src/org/eclipse/iee/translator/antlr/translator/JavaTranslator.java b/org.eclipse.iee.translator.antlr/src/org/eclipse/iee/translator/antlr/translator/JavaTranslator.java
index 1973eb2f..82dd3944 100644
--- a/org.eclipse.iee.translator.antlr/src/org/eclipse/iee/translator/antlr/translator/JavaTranslator.java
+++ b/org.eclipse.iee.translator.antlr/src/org/eclipse/iee/translator/antlr/translator/JavaTranslator.java
@@ -28,6 +28,9 @@
import org.eclipse.jdt.core.dom.Expression;
import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.stringtemplate.v4.ST;
+import org.stringtemplate.v4.STGroup;
+import org.stringtemplate.v4.STGroupDir;
public class JavaTranslator {
@@ -56,26 +59,6 @@ public enum VariableType {
private static boolean fNewVariable;
- public static VariableType getVariableType() {
- return fVariableType;
- }
-
- public static List<String> getDoubleFields() {
- return fDoubleFields;
- }
-
- public static List<String> getIntegerFields() {
- return fIntegerFields;
- }
-
- public static List<String> getMatrixFields() {
- return fMatrixFields;
- }
-
- public static List<String> getInnerClasses() {
- return fInnerClasses;
- }
-
private static class JavaMathVisitor extends MathBaseVisitor<String> {
// statement rule
@@ -366,6 +349,20 @@ public String visitProperty(MathParser.PropertyContext ctx) {
}
+ public static boolean validate(String text) {
+
+ try {
+
+ if (translate(text) == "") {
+ return false;
+ } else {
+ return true;
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
public static String translate(String expression) {
String result = "";
@@ -382,11 +379,155 @@ public static String translate(String expression) {
return result;
}
- public static String translate(String expression,
- ICompilationUnit compilationUnit, final int position) {
+ public static String translate(String inputExpression,
+ ICompilationUnit compilationUnit, int position, String containerId,
+ String storagePath, String runtimeDirectoryName) {
+
+ if (inputExpression.trim().isEmpty())
+ return "";
+
+ String result = "";
+ String expression = "";
+
+ if (inputExpression.charAt(inputExpression.length() - 1) == '=') {
+ expression = inputExpression.substring(0,
+ inputExpression.length() - 1);
+ } else {
+ expression = inputExpression;
+ }
clear();
+ parse(compilationUnit, position);
+
+ logger.debug("expr: " + expression);
+ result = translate(expression);
+
+ /*
+ * Try get recognize variable type from expression
+ */
+
+ if (fNewVariable) {
+ result = getType(compilationUnit, position, result) + " " + result;
+ }
+
+ String[] parts = result.split("=");
+ if (parts.length == 1)
+ getType(compilationUnit, position, "myTmp=" + parts[0] + ";");
+
+ /*
+ * Generate output code, if necessary
+ */
+ if (inputExpression.charAt(inputExpression.length() - 1) == '=') {
+ parts = inputExpression.split("=");
+
+ if (parts.length == 1) {
+ String output = generateOutputCode(result, containerId,
+ storagePath, runtimeDirectoryName);
+ result = output;
+ } else if (parts.length > 1) {
+ String output = generateOutputCode(inputExpression,
+ containerId, storagePath, runtimeDirectoryName);
+ result += output;
+ }
+ }
+
+ return result;
+ }
+
+ public static String generateOutputCode(String expression,
+ String containerId, String storagePath, String runtimeDirectoryName) {
+ String expr = expression;
+
+ String[] parts = expr.replaceAll(Pattern.quote("{"), "")
+ .replaceAll(Pattern.quote("}"), "").split("=");
+ if (parts.length >= 1) {
+ String variable = expression;
+ if (parts.length > 1)
+ variable = expression.substring(0, expression.indexOf('='));
+
+ variable = variable.trim();
+ variable = variable.replaceAll(Pattern.quote("{"), "");
+ variable = variable.replaceAll(Pattern.quote("}"), "");
+ VariableType varType = fVariableType;
+
+ if (varType == null) {
+ if (fDoubleFields.contains(variable))
+ varType = VariableType.DOUBLE;
+ else if (fIntegerFields.contains(variable))
+ varType = VariableType.INT;
+ else if (fMatrixFields.contains(variable))
+ varType = VariableType.MATRIX;
+ else
+ return "";
+ }
+
+ logger.debug("Type:" + varType.toString());
+ STGroup group = new STGroupDir("/templates");
+
+ if (varType != VariableType.MATRIX) {
+
+ String type = "";
+ if (varType == VariableType.DOUBLE)
+ type = "double";
+ else if (varType == VariableType.INT)
+ type = "int";
+
+ ST template = group.getInstanceOf("variable");
+
+ template.add("type", type);
+ template.add("id", containerId);
+ template.add("variable", variable);
+ template.add("path", storagePath + runtimeDirectoryName);
+
+ return template.render(1).trim().replaceAll("\r\n", "")
+ .replaceAll("\t", " ");
+
+ } else {
+
+ String type = "Matrix";
+
+ ST template = group.getInstanceOf("matrix");
+ template.add("type", type);
+ template.add("id", containerId);
+ template.add("variable", variable);
+ template.add("path", storagePath + runtimeDirectoryName);
+
+ return template.render(1).trim().replaceAll("\r\n", "")
+ .replaceAll("\t", " ");
+ }
+ } else {
+ return "";
+ }
+ }
+
+ private static void clear() {
+ fClass = null;
+ fMethod = null;
+ fVariableType = null;
+ fVariableTypeString = "";
+ fNewVariable = false;
+
+ fMatrixFields.clear();
+ fDoubleFields.clear();
+ fIntegerFields.clear();
+ fOtherFields.clear();
+
+ fMethodClasses.clear();
+ fInnerClasses.clear();
+ fOtherSourceClasses.clear();
+ }
+
+ private static CompilationUnit createAST(ICompilationUnit unit) {
+ ASTParser parser = ASTParser.newParser(AST.JLS4);
+ parser.setKind(ASTParser.K_COMPILATION_UNIT);
+ parser.setSource(unit);
+ parser.setResolveBindings(true);
+ return (CompilationUnit) parser.createAST(null); // parse
+ }
+
+ private static void parse(ICompilationUnit compilationUnit,
+ final int position) {
try {
IType[] types = compilationUnit.getTypes();
@@ -490,7 +631,7 @@ else if (!fOtherSourceClasses.contains(type
}
}
- CompilationUnit unit = (CompilationUnit) parse(compilationUnit);
+ CompilationUnit unit = (CompilationUnit) createAST(compilationUnit);
unit.accept(new ASTVisitor() {
@Override
public boolean visit(VariableDeclarationStatement node) {
@@ -544,18 +685,9 @@ public boolean visit(VariableDeclarationStatement node) {
e.printStackTrace();
}
- ANTLRInputStream input = new ANTLRInputStream(expression);
- MathLexer lexer = new MathLexer(input);
- CommonTokenStream tokens = new CommonTokenStream(lexer);
- MathParser parser = new MathParser(tokens);
- parser.setBuildParseTree(true);
- ParserRuleContext tree = parser.statement();
-
- logger.debug("expr: " + expression);
try {
logger.debug("Source: " + compilationUnit.getSource());
} catch (JavaModelException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
if (fClass != null) {
@@ -572,47 +704,6 @@ public boolean visit(VariableDeclarationStatement node) {
logger.debug("fIntegerFields: " + fIntegerFields.toString());
logger.debug("fOtherFields: " + fOtherFields.toString());
- JavaMathVisitor mathVisitor = new JavaMathVisitor();
- String result = mathVisitor.visit(tree);
-
- /*
- * Try get recognize variable type from expression
- */
-
- if (fNewVariable) {
- result = getType(compilationUnit, position, result) + " " + result;
- }
-
- String[] parts = result.split("=");
- if (parts.length == 1)
- getType(compilationUnit, position, "myTmp=" + parts[0] + ";");
-
- return result;
- }
-
- private static void clear() {
- fClass = null;
- fMethod = null;
- fVariableType = null;
- fVariableTypeString = "";
- fNewVariable = false;
-
- fMatrixFields.clear();
- fDoubleFields.clear();
- fIntegerFields.clear();
- fOtherFields.clear();
-
- fMethodClasses.clear();
- fInnerClasses.clear();
- fOtherSourceClasses.clear();
- }
-
- private static CompilationUnit parse(ICompilationUnit unit) {
- ASTParser parser = ASTParser.newParser(AST.JLS4);
- parser.setKind(ASTParser.K_COMPILATION_UNIT);
- parser.setSource(unit);
- parser.setResolveBindings(true);
- return (CompilationUnit) parser.createAST(null); // parse
}
private static String getType(ICompilationUnit compilationUnit,
@@ -627,7 +718,7 @@ private static String getType(ICompilationUnit compilationUnit,
logger.debug("CopySource" + copy.getSource());
- CompilationUnit unit = (CompilationUnit) parse(copy);
+ CompilationUnit unit = (CompilationUnit) createAST(copy);
unit.accept(new ASTVisitor() {
@Override
public boolean visit(Assignment node) {
diff --git a/org.eclipse.iee.translator.antlr/src/org/eclipse/iee/translator/antlr/translator/TexTranslator.java b/org.eclipse.iee.translator.antlr/src/org/eclipse/iee/translator/antlr/translator/TexTranslator.java
index e275e156..75964b4a 100644
--- a/org.eclipse.iee.translator.antlr/src/org/eclipse/iee/translator/antlr/translator/TexTranslator.java
+++ b/org.eclipse.iee.translator.antlr/src/org/eclipse/iee/translator/antlr/translator/TexTranslator.java
@@ -13,7 +13,7 @@
import org.eclipse.iee.translator.antlr.math.MathParser;
public class TexTranslator {
-
+
private static List<String> fGreekLetters = new ArrayList<String>() {
private static final long serialVersionUID = 1L;
{
diff --git a/org.eclipse.iee.sample.formula/templates/matrix.st b/org.eclipse.iee.translator.antlr/templates/matrix.st
similarity index 100%
rename from org.eclipse.iee.sample.formula/templates/matrix.st
rename to org.eclipse.iee.translator.antlr/templates/matrix.st
diff --git a/org.eclipse.iee.sample.formula/templates/variable.st b/org.eclipse.iee.translator.antlr/templates/variable.st
similarity index 100%
rename from org.eclipse.iee.sample.formula/templates/variable.st
rename to org.eclipse.iee.translator.antlr/templates/variable.st
|
25ac0cd0efda9c5e814ad55c3689a02848a749cb
|
restlet-framework-java
|
Fixed ZipClientHelper test case.--
|
c
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/modules/org.restlet/src/org/restlet/engine/local/ZipClientHelper.java b/modules/org.restlet/src/org/restlet/engine/local/ZipClientHelper.java
index dbab6b0335..8ec8262514 100644
--- a/modules/org.restlet/src/org/restlet/engine/local/ZipClientHelper.java
+++ b/modules/org.restlet/src/org/restlet/engine/local/ZipClientHelper.java
@@ -154,7 +154,7 @@ protected void handleGet(Request request, Response response, File file,
Entity entity = new ZipEntryEntity(zipFile, entryName,
metadataService);
- if (entity.exists()) {
+ if (!entity.exists()) {
response.setStatus(Status.CLIENT_ERROR_NOT_FOUND);
} else {
final Representation output;
|
c2f8ee105b99622ad6f3f0c9cee3448cc5b869c7
|
elasticsearch
|
add a marker CachedFilter this allows to easily- and globally check if we cache a filter or not
|
a
|
https://github.com/elastic/elasticsearch
|
diff --git a/src/main/java/org/elasticsearch/common/lucene/search/CachedFilter.java b/src/main/java/org/elasticsearch/common/lucene/search/CachedFilter.java
new file mode 100644
index 0000000000000..6699fe6d36d4d
--- /dev/null
+++ b/src/main/java/org/elasticsearch/common/lucene/search/CachedFilter.java
@@ -0,0 +1,32 @@
+/*
+ * Licensed to ElasticSearch and Shay Banon under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. ElasticSearch licenses this
+ * file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.elasticsearch.common.lucene.search;
+
+import org.apache.lucene.search.Filter;
+
+/**
+ * A marker indicating that this is a cached filter.
+ */
+public abstract class CachedFilter extends Filter {
+
+ public static boolean isCached(Filter filter) {
+ return filter instanceof CachedFilter;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/elasticsearch/index/cache/filter/FilterCache.java b/src/main/java/org/elasticsearch/index/cache/filter/FilterCache.java
index c5df2d84cea51..dfd05eb7d5f5d 100644
--- a/src/main/java/org/elasticsearch/index/cache/filter/FilterCache.java
+++ b/src/main/java/org/elasticsearch/index/cache/filter/FilterCache.java
@@ -43,8 +43,6 @@ public EntriesStats(long sizeInBytes, long count) {
Filter cache(Filter filterToCache);
- boolean isCached(Filter filter);
-
void clear(IndexReader reader);
void clear(String reason);
diff --git a/src/main/java/org/elasticsearch/index/cache/filter/none/NoneFilterCache.java b/src/main/java/org/elasticsearch/index/cache/filter/none/NoneFilterCache.java
index 5e365fb3d248e..81275ef948b47 100644
--- a/src/main/java/org/elasticsearch/index/cache/filter/none/NoneFilterCache.java
+++ b/src/main/java/org/elasticsearch/index/cache/filter/none/NoneFilterCache.java
@@ -54,11 +54,6 @@ public Filter cache(Filter filterToCache) {
return filterToCache;
}
- @Override
- public boolean isCached(Filter filter) {
- return false;
- }
-
@Override
public void clear(String reason) {
// nothing to do here
diff --git a/src/main/java/org/elasticsearch/index/cache/filter/weighted/WeightedFilterCache.java b/src/main/java/org/elasticsearch/index/cache/filter/weighted/WeightedFilterCache.java
index 4e872e1bab576..30ed8a0fe9edf 100644
--- a/src/main/java/org/elasticsearch/index/cache/filter/weighted/WeightedFilterCache.java
+++ b/src/main/java/org/elasticsearch/index/cache/filter/weighted/WeightedFilterCache.java
@@ -33,6 +33,7 @@
import org.elasticsearch.ElasticSearchException;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.lucene.docset.DocIdSets;
+import org.elasticsearch.common.lucene.search.CachedFilter;
import org.elasticsearch.common.lucene.search.NoCacheFilter;
import org.elasticsearch.common.metrics.CounterMetric;
import org.elasticsearch.common.metrics.MeanMetric;
@@ -122,18 +123,13 @@ public Filter cache(Filter filterToCache) {
if (filterToCache instanceof NoCacheFilter) {
return filterToCache;
}
- if (isCached(filterToCache)) {
+ if (CachedFilter.isCached(filterToCache)) {
return filterToCache;
}
return new FilterCacheFilterWrapper(filterToCache, this);
}
- @Override
- public boolean isCached(Filter filter) {
- return filter instanceof FilterCacheFilterWrapper;
- }
-
- static class FilterCacheFilterWrapper extends Filter {
+ static class FilterCacheFilterWrapper extends CachedFilter {
private final Filter filter;
|
166a93dbeca04622ab0bcaf7cd077926baa049f3
|
Valadoc
|
doclet/devhelp: Add name="" to <book>
|
c
|
https://github.com/GNOME/vala/
|
diff --git a/src/doclets/devhelp/doclet.vala b/src/doclets/devhelp/doclet.vala
index 2fa91f8cb8..ef4bb66aed 100755
--- a/src/doclets/devhelp/doclet.vala
+++ b/src/doclets/devhelp/doclet.vala
@@ -85,7 +85,7 @@ public class Valadoc.Devhelp.Doclet : Valadoc.Html.BasicDoclet {
var devfile = FileStream.open (devpath, "w");
_devhelpwriter = new Devhelp.MarkupWriter (devfile);
- _devhelpwriter.start_book (pkg_name+" Reference Manual", "vala", "index.htm", "", "", "");
+ _devhelpwriter.start_book (pkg_name+" Reference Manual", "vala", "index.htm", pkg_name, "", "");
GLib.FileStream file = GLib.FileStream.open (filepath, "w");
|
7972ae764b8aef1c2bc2cd07d4cd4f3b14a4aef2
|
hbase
|
HBASE-12137 Alter table add cf doesn't do- compression test (Virag Kothari)--
|
c
|
https://github.com/apache/hbase
|
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index eef0a09f3d0e..2a7120d5b255 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -1376,18 +1376,19 @@ public void truncateTable(TableName tableName, boolean preserveSplits) throws IO
}
@Override
- public void addColumn(final TableName tableName, final HColumnDescriptor column)
+ public void addColumn(final TableName tableName, final HColumnDescriptor columnDescriptor)
throws IOException {
checkInitialized();
+ checkCompression(columnDescriptor);
if (cpHost != null) {
- if (cpHost.preAddColumn(tableName, column)) {
+ if (cpHost.preAddColumn(tableName, columnDescriptor)) {
return;
}
}
//TODO: we should process this (and some others) in an executor
- new TableAddFamilyHandler(tableName, column, this, this).prepare().process();
+ new TableAddFamilyHandler(tableName, columnDescriptor, this, this).prepare().process();
if (cpHost != null) {
- cpHost.postAddColumn(tableName, column);
+ cpHost.postAddColumn(tableName, columnDescriptor);
}
}
|
92fe7f9d32f2c53767ecfea631aae79c9f3ac9d4
|
ReactiveX-RxJava
|
made the public window methods more generic via the- basic (lol) super/extends fluff; also simplified api by removing a few- useless super definitions (there's no super of Opening and Closing)--
|
p
|
https://github.com/ReactiveX/RxJava
|
diff --git a/rxjava-core/src/main/java/rx/Observable.java b/rxjava-core/src/main/java/rx/Observable.java
index 25073ca729..e4b64fc28a 100644
--- a/rxjava-core/src/main/java/rx/Observable.java
+++ b/rxjava-core/src/main/java/rx/Observable.java
@@ -1337,7 +1337,7 @@ public Observable<List<T>> buffer(Func0<? extends Observable<? extends Closing>>
* @return
* An {@link Observable} which produces buffers which are created and emitted when the specified {@link Observable}s publish certain objects.
*/
- public Observable<List<T>> buffer(Observable<? extends Opening> bufferOpenings, Func1<? super Opening, ? extends Observable<? extends Closing>> bufferClosingSelector) {
+ public Observable<List<T>> buffer(Observable<? extends Opening> bufferOpenings, Func1<Opening, ? extends Observable<? extends Closing>> bufferClosingSelector) {
return create(OperationBuffer.buffer(this, bufferOpenings, bufferClosingSelector));
}
@@ -1520,7 +1520,7 @@ public Observable<List<T>> buffer(long timespan, long timeshift, TimeUnit unit,
* An {@link Observable} which produces connected non-overlapping windows, which are emitted
* when the current {@link Observable} created with the {@link Func0} argument produces a {@link rx.util.Closing} object.
*/
- public Observable<Observable<T>> window(Observable<T> source, Func0<Observable<Closing>> closingSelector) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, Func0<? extends Observable<? extends Closing>> closingSelector) {
return create(OperationWindow.window(source, closingSelector));
}
@@ -1542,7 +1542,7 @@ public Observable<Observable<T>> window(Observable<T> source, Func0<Observable<C
* @return
* An {@link Observable} which produces windows which are created and emitted when the specified {@link Observable}s publish certain objects.
*/
- public Observable<Observable<T>> window(Observable<T> source, Observable<Opening> windowOpenings, Func1<Opening, Observable<Closing>> closingSelector) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, Observable<? extends Opening> windowOpenings, Func1<Opening, ? extends Observable<? extends Closing>> closingSelector) {
return create(OperationWindow.window(source, windowOpenings, closingSelector));
}
@@ -1559,7 +1559,7 @@ public Observable<Observable<T>> window(Observable<T> source, Observable<Opening
* An {@link Observable} which produces connected non-overlapping windows containing at most
* "count" produced values.
*/
- public Observable<Observable<T>> window(Observable<T> source, int count) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, int count) {
return create(OperationWindow.window(source, count));
}
@@ -1579,7 +1579,7 @@ public Observable<Observable<T>> window(Observable<T> source, int count) {
* An {@link Observable} which produces windows every "skipped" values containing at most
* "count" produced values.
*/
- public Observable<Observable<T>> window(Observable<T> source, int count, int skip) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, int count, int skip) {
return create(OperationWindow.window(source, count, skip));
}
@@ -1598,7 +1598,7 @@ public Observable<Observable<T>> window(Observable<T> source, int count, int ski
* @return
* An {@link Observable} which produces connected non-overlapping windows with a fixed duration.
*/
- public Observable<Observable<T>> window(Observable<T> source, long timespan, TimeUnit unit) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, long timespan, TimeUnit unit) {
return create(OperationWindow.window(source, timespan, unit));
}
@@ -1619,7 +1619,7 @@ public Observable<Observable<T>> window(Observable<T> source, long timespan, Tim
* @return
* An {@link Observable} which produces connected non-overlapping windows with a fixed duration.
*/
- public Observable<Observable<T>> window(Observable<T> source, long timespan, TimeUnit unit, Scheduler scheduler) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, long timespan, TimeUnit unit, Scheduler scheduler) {
return create(OperationWindow.window(source, timespan, unit, scheduler));
}
@@ -1642,7 +1642,7 @@ public Observable<Observable<T>> window(Observable<T> source, long timespan, Tim
* An {@link Observable} which produces connected non-overlapping windows which are emitted after
* a fixed duration or when the window has reached maximum capacity (which ever occurs first).
*/
- public Observable<Observable<T>> window(Observable<T> source, long timespan, TimeUnit unit, int count) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, long timespan, TimeUnit unit, int count) {
return create(OperationWindow.window(source, timespan, unit, count));
}
@@ -1667,7 +1667,7 @@ public Observable<Observable<T>> window(Observable<T> source, long timespan, Tim
* An {@link Observable} which produces connected non-overlapping windows which are emitted after
* a fixed duration or when the window has reached maximum capacity (which ever occurs first).
*/
- public Observable<Observable<T>> window(Observable<T> source, long timespan, TimeUnit unit, int count, Scheduler scheduler) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, long timespan, TimeUnit unit, int count, Scheduler scheduler) {
return create(OperationWindow.window(source, timespan, unit, count, scheduler));
}
@@ -1689,7 +1689,7 @@ public Observable<Observable<T>> window(Observable<T> source, long timespan, Tim
* An {@link Observable} which produces new windows periodically, and these are emitted after
* a fixed timespan has elapsed.
*/
- public Observable<Observable<T>> window(Observable<T> source, long timespan, long timeshift, TimeUnit unit) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, long timespan, long timeshift, TimeUnit unit) {
return create(OperationWindow.window(source, timespan, timeshift, unit));
}
@@ -1713,7 +1713,7 @@ public Observable<Observable<T>> window(Observable<T> source, long timespan, lon
* An {@link Observable} which produces new windows periodically, and these are emitted after
* a fixed timespan has elapsed.
*/
- public Observable<Observable<T>> window(Observable<T> source, long timespan, long timeshift, TimeUnit unit, Scheduler scheduler) {
+ public Observable<Observable<T>> window(Observable<? extends T> source, long timespan, long timeshift, TimeUnit unit, Scheduler scheduler) {
return create(OperationWindow.window(source, timespan, timeshift, unit, scheduler));
}
diff --git a/rxjava-core/src/main/java/rx/operators/ChunkedOperation.java b/rxjava-core/src/main/java/rx/operators/ChunkedOperation.java
index f0990425bb..1b5cf8d0d1 100644
--- a/rxjava-core/src/main/java/rx/operators/ChunkedOperation.java
+++ b/rxjava-core/src/main/java/rx/operators/ChunkedOperation.java
@@ -495,7 +495,7 @@ protected static class ObservableBasedMultiChunkCreator<T, C> implements ChunkCr
private final SafeObservableSubscription subscription = new SafeObservableSubscription();
- public ObservableBasedMultiChunkCreator(final OverlappingChunks<T, C> chunks, Observable<? extends Opening> openings, final Func1<? super Opening, ? extends Observable<? extends Closing>> chunkClosingSelector) {
+ public ObservableBasedMultiChunkCreator(final OverlappingChunks<T, C> chunks, Observable<? extends Opening> openings, final Func1<Opening, ? extends Observable<? extends Closing>> chunkClosingSelector) {
subscription.wrap(openings.subscribe(new Action1<Opening>() {
@Override
public void call(Opening opening) {
diff --git a/rxjava-core/src/main/java/rx/operators/OperationBuffer.java b/rxjava-core/src/main/java/rx/operators/OperationBuffer.java
index c692ed6cee..1cc559fb57 100644
--- a/rxjava-core/src/main/java/rx/operators/OperationBuffer.java
+++ b/rxjava-core/src/main/java/rx/operators/OperationBuffer.java
@@ -42,12 +42,14 @@
public final class OperationBuffer extends ChunkedOperation {
- private static final Func0 BUFFER_MAKER = new Func0() {
- @Override
- public Object call() {
- return new Buffer();
- }
- };
+ private static <T> Func0<Buffer<T>> bufferMaker() {
+ return new Func0<Buffer<T>>() {
+ @Override
+ public Buffer<T> call() {
+ return new Buffer<T>();
+ }
+ };
+ }
/**
* <p>This method creates a {@link Func1} object which represents the buffer operation. This operation takes
@@ -74,7 +76,7 @@ public static <T> OnSubscribeFunc<List<T>> buffer(final Observable<T> source, fi
@Override
public Subscription onSubscribe(Observer<? super List<T>> observer) {
- NonOverlappingChunks<T, List<T>> buffers = new NonOverlappingChunks<T, List<T>>(observer, BUFFER_MAKER);
+ NonOverlappingChunks<T, List<T>> buffers = new NonOverlappingChunks<T, List<T>>(observer, OperationBuffer.<T>bufferMaker());
ChunkCreator creator = new ObservableBasedSingleChunkCreator<T, List<T>>(buffers, bufferClosingSelector);
return source.subscribe(new ChunkObserver<T, List<T>>(buffers, observer, creator));
}
@@ -106,11 +108,11 @@ public Subscription onSubscribe(Observer<? super List<T>> observer) {
* @return
* the {@link Func1} object representing the specified buffer operation.
*/
- public static <T> OnSubscribeFunc<List<T>> buffer(final Observable<T> source, final Observable<? extends Opening> bufferOpenings, final Func1<? super Opening, ? extends Observable<? extends Closing>> bufferClosingSelector) {
+ public static <T> OnSubscribeFunc<List<T>> buffer(final Observable<T> source, final Observable<? extends Opening> bufferOpenings, final Func1<Opening, ? extends Observable<? extends Closing>> bufferClosingSelector) {
return new OnSubscribeFunc<List<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super List<T>> observer) {
- OverlappingChunks<T, List<T>> buffers = new OverlappingChunks<T, List<T>>(observer, BUFFER_MAKER);
+ OverlappingChunks<T, List<T>> buffers = new OverlappingChunks<T, List<T>>(observer, OperationBuffer.<T>bufferMaker());
ChunkCreator creator = new ObservableBasedMultiChunkCreator<T, List<T>>(buffers, bufferOpenings, bufferClosingSelector);
return source.subscribe(new ChunkObserver<T, List<T>>(buffers, observer, creator));
}
@@ -165,7 +167,7 @@ public static <T> OnSubscribeFunc<List<T>> buffer(final Observable<T> source, fi
return new OnSubscribeFunc<List<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super List<T>> observer) {
- Chunks<T, List<T>> chunks = new SizeBasedChunks<T, List<T>>(observer, BUFFER_MAKER, count);
+ Chunks<T, List<T>> chunks = new SizeBasedChunks<T, List<T>>(observer, OperationBuffer.<T>bufferMaker(), count);
ChunkCreator creator = new SkippingChunkCreator<T, List<T>>(chunks, skip);
return source.subscribe(new ChunkObserver<T, List<T>>(chunks, observer, creator));
}
@@ -220,7 +222,7 @@ public static <T> OnSubscribeFunc<List<T>> buffer(final Observable<T> source, fi
return new OnSubscribeFunc<List<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super List<T>> observer) {
- NonOverlappingChunks<T, List<T>> buffers = new NonOverlappingChunks<T, List<T>>(observer, BUFFER_MAKER);
+ NonOverlappingChunks<T, List<T>> buffers = new NonOverlappingChunks<T, List<T>>(observer, OperationBuffer.<T>bufferMaker());
ChunkCreator creator = new TimeBasedChunkCreator<T, List<T>>(buffers, timespan, unit, scheduler);
return source.subscribe(new ChunkObserver<T, List<T>>(buffers, observer, creator));
}
@@ -281,7 +283,7 @@ public static <T> OnSubscribeFunc<List<T>> buffer(final Observable<T> source, fi
return new OnSubscribeFunc<List<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super List<T>> observer) {
- Chunks<T, List<T>> chunks = new TimeAndSizeBasedChunks<T, List<T>>(observer, BUFFER_MAKER, count, timespan, unit, scheduler);
+ Chunks<T, List<T>> chunks = new TimeAndSizeBasedChunks<T, List<T>>(observer, OperationBuffer.<T>bufferMaker(), count, timespan, unit, scheduler);
ChunkCreator creator = new SingleChunkCreator<T, List<T>>(chunks);
return source.subscribe(new ChunkObserver<T, List<T>>(chunks, observer, creator));
}
@@ -342,7 +344,7 @@ public static <T> OnSubscribeFunc<List<T>> buffer(final Observable<T> source, fi
return new OnSubscribeFunc<List<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super List<T>> observer) {
- OverlappingChunks<T, List<T>> buffers = new TimeBasedChunks<T, List<T>>(observer, BUFFER_MAKER, timespan, unit, scheduler);
+ OverlappingChunks<T, List<T>> buffers = new TimeBasedChunks<T, List<T>>(observer, OperationBuffer.<T>bufferMaker(), timespan, unit, scheduler);
ChunkCreator creator = new TimeBasedChunkCreator<T, List<T>>(buffers, timeshift, unit, scheduler);
return source.subscribe(new ChunkObserver<T, List<T>>(buffers, observer, creator));
}
diff --git a/rxjava-core/src/main/java/rx/operators/OperationWindow.java b/rxjava-core/src/main/java/rx/operators/OperationWindow.java
index ab15ed2352..5cffda9661 100644
--- a/rxjava-core/src/main/java/rx/operators/OperationWindow.java
+++ b/rxjava-core/src/main/java/rx/operators/OperationWindow.java
@@ -72,7 +72,7 @@ public Window<T> call() {
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<T> source, final Func0<Observable<Closing>> windowClosingSelector) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<? extends T> source, final Func0<? extends Observable<? extends Closing>> windowClosingSelector) {
return new OnSubscribeFunc<Observable<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super Observable<T>> observer) {
@@ -109,7 +109,7 @@ public Subscription onSubscribe(final Observer<? super Observable<T>> observer)
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<T> source, final Observable<Opening> windowOpenings, final Func1<Opening, Observable<Closing>> windowClosingSelector) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<? extends T> source, final Observable<? extends Opening> windowOpenings, final Func1<Opening, ? extends Observable<? extends Closing>> windowClosingSelector) {
return new OnSubscribeFunc<Observable<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super Observable<T>> observer) {
@@ -137,7 +137,7 @@ public Subscription onSubscribe(final Observer<? super Observable<T>> observer)
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(Observable<T> source, int count) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(Observable<? extends T> source, int count) {
return window(source, count, count);
}
@@ -164,7 +164,7 @@ public static <T> OnSubscribeFunc<Observable<T>> window(Observable<T> source, in
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<T> source, final int count, final int skip) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<? extends T> source, final int count, final int skip) {
return new OnSubscribeFunc<Observable<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super Observable<T>> observer) {
@@ -194,7 +194,7 @@ public Subscription onSubscribe(final Observer<? super Observable<T>> observer)
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(Observable<T> source, long timespan, TimeUnit unit) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(Observable<? extends T> source, long timespan, TimeUnit unit) {
return window(source, timespan, unit, Schedulers.threadPoolForComputation());
}
@@ -219,7 +219,7 @@ public static <T> OnSubscribeFunc<Observable<T>> window(Observable<T> source, lo
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<T> source, final long timespan, final TimeUnit unit, final Scheduler scheduler) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<? extends T> source, final long timespan, final TimeUnit unit, final Scheduler scheduler) {
return new OnSubscribeFunc<Observable<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super Observable<T>> observer) {
@@ -252,7 +252,7 @@ public Subscription onSubscribe(final Observer<? super Observable<T>> observer)
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(Observable<T> source, long timespan, TimeUnit unit, int count) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(Observable<? extends T> source, long timespan, TimeUnit unit, int count) {
return window(source, timespan, unit, count, Schedulers.threadPoolForComputation());
}
@@ -280,7 +280,7 @@ public static <T> OnSubscribeFunc<Observable<T>> window(Observable<T> source, lo
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<T> source, final long timespan, final TimeUnit unit, final int count, final Scheduler scheduler) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<? extends T> source, final long timespan, final TimeUnit unit, final int count, final Scheduler scheduler) {
return new OnSubscribeFunc<Observable<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super Observable<T>> observer) {
@@ -313,7 +313,7 @@ public Subscription onSubscribe(final Observer<? super Observable<T>> observer)
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(Observable<T> source, long timespan, long timeshift, TimeUnit unit) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(Observable<? extends T> source, long timespan, long timeshift, TimeUnit unit) {
return window(source, timespan, timeshift, unit, Schedulers.threadPoolForComputation());
}
@@ -341,7 +341,7 @@ public static <T> OnSubscribeFunc<Observable<T>> window(Observable<T> source, lo
* @return
* the {@link rx.util.functions.Func1} object representing the specified window operation.
*/
- public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<T> source, final long timespan, final long timeshift, final TimeUnit unit, final Scheduler scheduler) {
+ public static <T> OnSubscribeFunc<Observable<T>> window(final Observable<? extends T> source, final long timespan, final long timeshift, final TimeUnit unit, final Scheduler scheduler) {
return new OnSubscribeFunc<Observable<T>>() {
@Override
public Subscription onSubscribe(final Observer<? super Observable<T>> observer) {
|
c93b0290e8efe32d4844d10adc78c70b802fde18
|
orientdb
|
fixed minor issue with thread local management--
|
c
|
https://github.com/orientechnologies/orientdb
|
diff --git a/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java b/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java
index efd9b38a74a..a8ab992f831 100755
--- a/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java
+++ b/core/src/main/java/com/orientechnologies/orient/core/config/OGlobalConfiguration.java
@@ -432,7 +432,7 @@ public void change(final Object iCurrentValue, final Object iNewValue) {
Level.class, Level.SEVERE),
SERVER_LOG_DUMP_CLIENT_EXCEPTION_FULLSTACKTRACE("server.log.dumpClientExceptionFullStackTrace",
- "Dumps the full stack trace of the exception to sent to the client", Level.class, Boolean.FALSE),
+ "Dumps the full stack trace of the exception to sent to the client", Boolean.class, Boolean.FALSE),
// DISTRIBUTED
DISTRIBUTED_CRUD_TASK_SYNCH_TIMEOUT("distributed.crudTaskTimeout",
diff --git a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java
index b4cecdad580..e70b253a20b 100755
--- a/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java
+++ b/graphdb/src/main/java/com/tinkerpop/blueprints/impls/orient/OrientBaseGraph.java
@@ -284,11 +284,8 @@ public static void clearInitStack() {
final ThreadLocal<OrientBaseGraph> ag = activeGraph;
if (ag != null)
- ag.set(null);
+ ag.remove();
- final ODatabaseRecordThreadLocal dbtl = ODatabaseRecordThreadLocal.INSTANCE;
- if (dbtl != null)
- dbtl.set(null);
}
/**
@@ -354,7 +351,7 @@ public static String decodeClassName(String iClassName) {
protected static void checkForGraphSchema(final ODatabaseDocumentTx iDatabase) {
final OSchema schema = iDatabase.getMetadata().getSchema();
-// schema.getOrCreateClass(OMVRBTreeRIDProvider.PERSISTENT_CLASS_NAME);
+ // schema.getOrCreateClass(OMVRBTreeRIDProvider.PERSISTENT_CLASS_NAME);
final OClass vertexBaseClass = schema.getClass(OrientVertexType.CLASS_NAME);
final OClass edgeBaseClass = schema.getClass(OrientEdgeType.CLASS_NAME);
diff --git a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/binary/ONetworkProtocolBinary.java b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/binary/ONetworkProtocolBinary.java
index 2d1a13447f3..61e6af8d638 100755
--- a/server/src/main/java/com/orientechnologies/orient/server/network/protocol/binary/ONetworkProtocolBinary.java
+++ b/server/src/main/java/com/orientechnologies/orient/server/network/protocol/binary/ONetworkProtocolBinary.java
@@ -213,8 +213,8 @@ protected void onBeforeRequest() throws IOException {
}
if (connection != null) {
- ODatabaseRecordThreadLocal.INSTANCE.set(connection.database);
if (connection.database != null) {
+ connection.database.activateOnCurrentThread();
connection.data.lastDatabase = connection.database.getName();
connection.data.lastUser = connection.database.getUser() != null ? connection.database.getUser().getName() : null;
} else {
|
953a99c75cde29a18db58abde3fdee720fcddc4f
|
elasticsearch
|
fix a bug in new checksum mechanism that caused- for replicas not to retain the _checksums file. Also
|
c
|
https://github.com/elastic/elasticsearch
|
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Directories.java b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Directories.java
index ffb8e217f1e02..71f405e1ced1a 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Directories.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/common/lucene/Directories.java
@@ -41,29 +41,6 @@
*/
public class Directories {
- /**
- * Deletes all the files from a directory.
- *
- * @param directory The directory to delete all the files from
- * @throws IOException if an exception occurs during the delete process
- */
- public static void deleteFiles(Directory directory) throws IOException {
- String[] files = directory.listAll();
- IOException lastException = null;
- for (String file : files) {
- try {
- directory.deleteFile(file);
- } catch (FileNotFoundException e) {
- // ignore
- } catch (IOException e) {
- lastException = e;
- }
- }
- if (lastException != null) {
- throw lastException;
- }
- }
-
/**
* Returns the estimated size of a {@link Directory}.
*/
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/CommitPoint.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/CommitPoint.java
index f25b655e9f7cc..1791a50410ce8 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/CommitPoint.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/gateway/CommitPoint.java
@@ -62,10 +62,10 @@ public long length() {
}
public boolean isSame(StoreFileMetaData md) {
- if (checksum != null && md.checksum() != null) {
- return checksum.equals(md.checksum());
+ if (checksum == null || md.checksum() == null) {
+ return false;
}
- return length == md.length();
+ return length == md.length() && checksum.equals(md.checksum());
}
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoverySource.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoverySource.java
index 869d527fec9d7..986222f56a39d 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoverySource.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/shard/recovery/RecoverySource.java
@@ -93,7 +93,8 @@ public static class Actions {
this.translogSize = componentSettings.getAsBytesSize("translog_size", new ByteSizeValue(100, ByteSizeUnit.KB));
this.compress = componentSettings.getAsBoolean("compress", true);
- logger.debug("using concurrent_streams [{}], file_chunk_size [{}], translog_size [{}], translog_ops [{}], and compress [{}]", concurrentStreams, fileChunkSize, translogOps, translogSize, compress);
+ logger.debug("using concurrent_streams [{}], file_chunk_size [{}], translog_size [{}], translog_ops [{}], and compress [{}]",
+ concurrentStreams, fileChunkSize, translogSize, translogOps, compress);
transportService.registerHandler(Actions.START_RECOVERY, new StartRecoveryTransportRequestHandler());
}
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/StoreFileMetaData.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/StoreFileMetaData.java
index cafd3aa200c6a..c1b7815b5e9ae 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/StoreFileMetaData.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/StoreFileMetaData.java
@@ -66,10 +66,10 @@ public long length() {
}
public boolean isSame(StoreFileMetaData other) {
- if (checksum != null && other.checksum != null) {
- return checksum.equals(other.checksum);
+ if (checksum == null || other.checksum == null) {
+ return false;
}
- return length == other.length;
+ return length == other.length && checksum.equals(other.checksum);
}
public static StoreFileMetaData readStoreFileMetaData(StreamInput in) throws IOException {
diff --git a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/support/AbstractStore.java b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/support/AbstractStore.java
index 981c057aaff28..a516379bcc36b 100644
--- a/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/support/AbstractStore.java
+++ b/modules/elasticsearch/src/main/java/org/elasticsearch/index/store/support/AbstractStore.java
@@ -46,6 +46,8 @@
*/
public abstract class AbstractStore extends AbstractIndexShardComponent implements Store {
+ static final String CHECKSUMS_PREFIX = "_checksums-";
+
protected final IndexStore indexStore;
private volatile ImmutableMap<String, StoreFileMetaData> filesMetadata = ImmutableMap.of();
@@ -90,7 +92,24 @@ public StoreFileMetaData metaData(String name) throws IOException {
}
@Override public void deleteContent() throws IOException {
- Directories.deleteFiles(directory());
+ String[] files = directory().listAll();
+ IOException lastException = null;
+ for (String file : files) {
+ if (file.startsWith(CHECKSUMS_PREFIX)) {
+ ((StoreDirectory) directory()).deleteFileChecksum(file);
+ } else {
+ try {
+ directory().deleteFile(file);
+ } catch (FileNotFoundException e) {
+ // ignore
+ } catch (IOException e) {
+ lastException = e;
+ }
+ }
+ }
+ if (lastException != null) {
+ throw lastException;
+ }
}
@Override public void fullDelete() throws IOException {
@@ -104,10 +123,10 @@ public StoreFileMetaData metaData(String name) throws IOException {
public static Map<String, String> readChecksums(Directory dir) throws IOException {
long lastFound = -1;
for (String name : dir.listAll()) {
- if (!name.startsWith("_checksums-")) {
+ if (!name.startsWith(CHECKSUMS_PREFIX)) {
continue;
}
- long current = Long.parseLong(name.substring("_checksums-".length()));
+ long current = Long.parseLong(name.substring(CHECKSUMS_PREFIX.length()));
if (current > lastFound) {
lastFound = current;
}
@@ -115,7 +134,7 @@ public static Map<String, String> readChecksums(Directory dir) throws IOExceptio
if (lastFound == -1) {
return ImmutableMap.of();
}
- IndexInput indexInput = dir.openInput("_checksums-" + lastFound);
+ IndexInput indexInput = dir.openInput(CHECKSUMS_PREFIX + lastFound);
try {
indexInput.readInt(); // version
return indexInput.readStringStringMap();
@@ -129,7 +148,7 @@ public void writeChecksums() throws IOException {
}
private void writeChecksums(StoreDirectory dir) throws IOException {
- String checksumName = "_checksums-" + System.currentTimeMillis();
+ String checksumName = CHECKSUMS_PREFIX + System.currentTimeMillis();
ImmutableMap<String, StoreFileMetaData> files = list();
synchronized (mutex) {
Map<String, String> checksums = new HashMap<String, String>();
@@ -144,9 +163,9 @@ private void writeChecksums(StoreDirectory dir) throws IOException {
output.close();
}
for (StoreFileMetaData metaData : files.values()) {
- if (metaData.name().startsWith("_checksums") && !checksumName.equals(metaData.name())) {
+ if (metaData.name().startsWith(CHECKSUMS_PREFIX) && !checksumName.equals(metaData.name())) {
try {
- directory().deleteFile(metaData.name());
+ dir.deleteFileChecksum(metaData.name());
} catch (Exception e) {
// ignore
}
@@ -255,7 +274,19 @@ public Directory delegate() {
}
}
+ public void deleteFileChecksum(String name) throws IOException {
+ delegate.deleteFile(name);
+ synchronized (mutex) {
+ filesMetadata = MapBuilder.newMapBuilder(filesMetadata).remove(name).immutableMap();
+ files = filesMetadata.keySet().toArray(new String[filesMetadata.size()]);
+ }
+ }
+
@Override public void deleteFile(String name) throws IOException {
+ // we don't allow to delete the checksums files, only using the deleteChecksum method
+ if (name.startsWith(CHECKSUMS_PREFIX)) {
+ return;
+ }
delegate.deleteFile(name);
synchronized (mutex) {
filesMetadata = MapBuilder.newMapBuilder(filesMetadata).remove(name).immutableMap();
|
b25462ddf9dcbf0bdc940e7ab1c796520d694093
|
spring-framework
|
SPR-7107 - RestTemplate/UriTemplate/UriUtils- improperly encoding UTF-8--
|
c
|
https://github.com/spring-projects/spring-framework
|
diff --git a/org.springframework.web/src/main/java/org/springframework/web/util/UriUtils.java b/org.springframework.web/src/main/java/org/springframework/web/util/UriUtils.java
index 4b023395e3da..67da06b8064b 100644
--- a/org.springframework.web/src/main/java/org/springframework/web/util/UriUtils.java
+++ b/org.springframework.web/src/main/java/org/springframework/web/util/UriUtils.java
@@ -424,22 +424,33 @@ private static String encode(String source, String encoding, BitSet notEncoded)
throws UnsupportedEncodingException {
Assert.notNull(source, "'source' must not be null");
Assert.hasLength(encoding, "'encoding' must not be empty");
- ByteArrayOutputStream bos = new ByteArrayOutputStream(source.length() * 2);
- for (int i = 0; i < source.length(); i++) {
- int ch = source.charAt(i);
- if (notEncoded.get(ch)) {
- bos.write(ch);
+ byte[] bytes = encode(source.getBytes(encoding), notEncoded);
+ return new String(bytes, "US-ASCII");
+ }
+
+ private static byte[] encode(byte[] source, BitSet notEncoded) {
+ Assert.notNull(source, "'source' must not be null");
+
+ ByteArrayOutputStream bos = new ByteArrayOutputStream(source.length * 2);
+
+ for (int i = 0; i < source.length; i++) {
+ int b = source[i];
+ if (b < 0) {
+ b += 256;
+ }
+ if (notEncoded.get(b)) {
+ bos.write(b);
}
else {
bos.write('%');
- char hex1 = Character.toUpperCase(Character.forDigit((ch >> 4) & 0xF, 16));
- char hex2 = Character.toUpperCase(Character.forDigit(ch & 0xF, 16));
+ char hex1 = Character.toUpperCase(Character.forDigit((b >> 4) & 0xF, 16));
+ char hex2 = Character.toUpperCase(Character.forDigit(b & 0xF, 16));
bos.write(hex1);
bos.write(hex2);
}
}
- return new String(bos.toByteArray(), encoding);
+ return bos.toByteArray();
}
/**
diff --git a/org.springframework.web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java b/org.springframework.web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
index 78fa26c6f042..5f795306a304 100644
--- a/org.springframework.web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
+++ b/org.springframework.web/src/test/java/org/springframework/web/client/RestTemplateIntegrationTests.java
@@ -165,7 +165,7 @@ public void optionsForAllow() throws URISyntaxException {
@Test
public void uri() throws InterruptedException, URISyntaxException {
String result = template.getForObject(URI + "/uri/{query}", String.class, "Z\u00fcrich");
- assertEquals("Invalid request URI", "/uri/Z%FCrich", result);
+ assertEquals("Invalid request URI", "/uri/Z%C3%BCrich", result);
result = template.getForObject(URI + "/uri/query={query}", String.class, "foo@bar");
assertEquals("Invalid request URI", "/uri/query=foo@bar", result);
diff --git a/org.springframework.web/src/test/java/org/springframework/web/util/UriTemplateTests.java b/org.springframework.web/src/test/java/org/springframework/web/util/UriTemplateTests.java
index 58bafcd6fbf8..7c7c07833a2f 100644
--- a/org.springframework.web/src/test/java/org/springframework/web/util/UriTemplateTests.java
+++ b/org.springframework.web/src/test/java/org/springframework/web/util/UriTemplateTests.java
@@ -87,9 +87,9 @@ public void expandMapUnboundVariables() throws Exception {
@Test
public void expandEncoded() throws Exception {
- UriTemplate template = new UriTemplate("http://example.com//hotel list/{hotel}");
+ UriTemplate template = new UriTemplate("http://example.com/hotel list/{hotel}");
URI result = template.expand("Z\u00fcrich");
- assertEquals("Invalid expanded template", new URI("http://example.com//hotel%20list/Z%FCrich"), result);
+ assertEquals("Invalid expanded template", new URI("http://example.com/hotel%20list/Z%C3%BCrich"), result);
}
@Test
diff --git a/org.springframework.web/src/test/java/org/springframework/web/util/UriUtilsTest.java b/org.springframework.web/src/test/java/org/springframework/web/util/UriUtilsTest.java
index a3713d1efa24..36fdae0a3961 100644
--- a/org.springframework.web/src/test/java/org/springframework/web/util/UriUtilsTest.java
+++ b/org.springframework.web/src/test/java/org/springframework/web/util/UriUtilsTest.java
@@ -53,7 +53,7 @@ public void encodePort() throws UnsupportedEncodingException {
public void encodePath() throws UnsupportedEncodingException {
assertEquals("Invalid encoded result", "/foo/bar", UriUtils.encodePath("/foo/bar", ENC));
assertEquals("Invalid encoded result", "/foo%20bar", UriUtils.encodePath("/foo bar", ENC));
- assertEquals("Invalid encoded result", "/Z%FCrich", UriUtils.encodePath("/Z\u00fcrich", ENC));
+ assertEquals("Invalid encoded result", "/Z%C3%BCrich", UriUtils.encodePath("/Z\u00fcrich", ENC));
}
@Test
@@ -67,6 +67,7 @@ public void encodeQuery() throws UnsupportedEncodingException {
assertEquals("Invalid encoded result", "foobar", UriUtils.encodeQuery("foobar", ENC));
assertEquals("Invalid encoded result", "foo%20bar", UriUtils.encodeQuery("foo bar", ENC));
assertEquals("Invalid encoded result", "foobar/+", UriUtils.encodeQuery("foobar/+", ENC));
+ assertEquals("Invalid encoded result", "T%C5%8Dky%C5%8D", UriUtils.encodeQuery("T\u014dky\u014d", ENC));
}
@Test
@@ -101,8 +102,8 @@ public void encodeUri() throws UnsupportedEncodingException {
UriUtils.encodeUri("http://www.ietf.org/rfc/rfc3986.txt", ENC));
assertEquals("Invalid encoded URI", "https://www.ietf.org/rfc/rfc3986.txt",
UriUtils.encodeUri("https://www.ietf.org/rfc/rfc3986.txt", ENC));
- assertEquals("Invalid encoded URI", "http://www.google.com/?q=z%FCrich",
- UriUtils.encodeUri("http://www.google.com/?q=z\u00fcrich", ENC));
+ assertEquals("Invalid encoded URI", "http://www.google.com/?q=Z%C3%BCrich",
+ UriUtils.encodeUri("http://www.google.com/?q=Z\u00fcrich", ENC));
assertEquals("Invalid encoded URI",
"http://arjen:[email protected]:80/javase/6/docs/api/java/util/BitSet.html?foo=bar#and(java.util.BitSet)",
UriUtils.encodeUri(
@@ -130,8 +131,8 @@ public void encodeHttpUrl() throws UnsupportedEncodingException {
UriUtils.encodeHttpUrl("http://www.ietf.org/rfc/rfc3986.txt", ENC));
assertEquals("Invalid encoded URI", "https://www.ietf.org/rfc/rfc3986.txt",
UriUtils.encodeHttpUrl("https://www.ietf.org/rfc/rfc3986.txt", ENC));
- assertEquals("Invalid encoded HTTP URL", "http://www.google.com/?q=z%FCrich",
- UriUtils.encodeHttpUrl("http://www.google.com/?q=z\u00fcrich", ENC));
+ assertEquals("Invalid encoded HTTP URL", "http://www.google.com/?q=Z%C3%BCrich",
+ UriUtils.encodeHttpUrl("http://www.google.com/?q=Z\u00fcrich", ENC));
assertEquals("Invalid encoded HTTP URL",
"http://arjen:[email protected]:80/javase/6/docs/api/java/util/BitSet.html?foo=bar",
UriUtils.encodeHttpUrl(
|
5c575c099f69e87b7bbd605f492022912096f3cf
|
restlet-framework-java
|
- Minor refactoring in RDF extension.--
|
p
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/build/tmpl/eclipse/dictionary.xml b/build/tmpl/eclipse/dictionary.xml
index 615e887786..f730420228 100644
--- a/build/tmpl/eclipse/dictionary.xml
+++ b/build/tmpl/eclipse/dictionary.xml
@@ -56,3 +56,5 @@ laufer
evolvability
introspecting
deprecated
+datatype
+namespaces
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/Literal.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/Literal.java
index 35eb60a570..d52906b36b 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/Literal.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/Literal.java
@@ -27,7 +27,7 @@
*
* Restlet is a registered trademark of Noelios Technologies.
*/
-
+
package org.restlet.ext.rdf;
import org.restlet.data.Language;
@@ -38,7 +38,8 @@
* reference and language properties.
*
* @author Jerome Louvel
- * @see <a href="http://www.w3.org/TR/rdf-concepts/#section-Graph-Literal">RDF literals</a>
+ * @see <a href="http://www.w3.org/TR/rdf-concepts/#section-Graph-Literal">RDF
+ * literals</a>
*/
public class Literal {
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfN3Representation.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfN3Representation.java
index 1b42db5121..e7d6b6beb1 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfN3Representation.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfN3Representation.java
@@ -45,35 +45,35 @@
*/
public class RdfN3Representation extends RdfRepresentation {
- /**
- * Constructor.
- *
- * @param linkSet
- * The given graph of links.
- */
- public RdfN3Representation(Graph linkSet) {
- super(linkSet);
- }
+ /**
+ * Constructor.
+ *
+ * @param linkSet
+ * The given graph of links.
+ */
+ public RdfN3Representation(Graph linkSet) {
+ super(linkSet);
+ }
- /**
- * Constructor. Parses the given representation into the given graph.
- *
- * @param rdfRepresentation
- * The RDF N3 representation to parse.
- * @param linkSet
- * The graph to update.
- * @throws IOException
- */
- public RdfN3Representation(Representation rdfRepresentation, Graph linkSet)
- throws IOException {
- super(linkSet);
- new RdfN3ParsingContentHandler(linkSet, rdfRepresentation);
- }
+ /**
+ * Constructor. Parses the given representation into the given graph.
+ *
+ * @param rdfRepresentation
+ * The RDF N3 representation to parse.
+ * @param linkSet
+ * The graph to update.
+ * @throws IOException
+ */
+ public RdfN3Representation(Representation rdfRepresentation, Graph linkSet)
+ throws IOException {
+ super(linkSet);
+ new RdfN3ParsingContentHandler(linkSet, rdfRepresentation);
+ }
- @Override
- public void write(OutputStream outputStream) throws IOException {
- if (getGraph() != null) {
- new RdfN3WritingContentHandler(getGraph(), outputStream);
- }
- }
+ @Override
+ public void write(OutputStream outputStream) throws IOException {
+ if (getGraph() != null) {
+ new RdfN3WritingContentHandler(getGraph(), outputStream);
+ }
+ }
}
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfRepresentation.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfRepresentation.java
index 2fd7a5841d..dcab4f14ec 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfRepresentation.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfRepresentation.java
@@ -45,71 +45,71 @@
*/
public abstract class RdfRepresentation extends OutputRepresentation {
- /** The inner graph of links. */
- private Graph graph;
+ /** The inner graph of links. */
+ private Graph graph;
- /**
- * Constructor with argument.
- *
- * @param linkSet
- * The graph of link.
- */
- public RdfRepresentation(Graph linkSet) {
- super(null);
- this.graph = linkSet;
- }
+ /**
+ * Constructor with argument.
+ *
+ * @param linkSet
+ * The graph of link.
+ */
+ public RdfRepresentation(Graph linkSet) {
+ super(null);
+ this.graph = linkSet;
+ }
- /**
- * Constructor that parsed a given RDF representation into a link set.
- *
- * @param rdfRepresentation
- * The RDF representation to parse.
- * @param linkSet
- * The link set to update.
- * @throws IOException
- */
- public RdfRepresentation(Representation rdfRepresentation, Graph linkSet)
- throws IOException {
- this(linkSet);
- if (MediaType.TEXT_RDF_N3.equals(rdfRepresentation.getMediaType())) {
- new RdfN3Representation(rdfRepresentation, linkSet);
- } else if (MediaType.TEXT_XML.equals(rdfRepresentation.getMediaType())) {
- new RdfXmlRepresentation(rdfRepresentation, linkSet);
- } else if (MediaType.APPLICATION_ALL_XML.includes(rdfRepresentation
- .getMediaType())) {
- new RdfXmlRepresentation(rdfRepresentation, linkSet);
- }
- // Parsing for other media types goes here.
- }
+ /**
+ * Constructor that parsed a given RDF representation into a link set.
+ *
+ * @param rdfRepresentation
+ * The RDF representation to parse.
+ * @param linkSet
+ * The link set to update.
+ * @throws IOException
+ */
+ public RdfRepresentation(Representation rdfRepresentation, Graph linkSet)
+ throws IOException {
+ this(linkSet);
+ if (MediaType.TEXT_RDF_N3.equals(rdfRepresentation.getMediaType())) {
+ new RdfN3Representation(rdfRepresentation, linkSet);
+ } else if (MediaType.TEXT_XML.equals(rdfRepresentation.getMediaType())) {
+ new RdfXmlRepresentation(rdfRepresentation, linkSet);
+ } else if (MediaType.APPLICATION_ALL_XML.includes(rdfRepresentation
+ .getMediaType())) {
+ new RdfXmlRepresentation(rdfRepresentation, linkSet);
+ }
+ // Parsing for other media types goes here.
+ }
- /**
- * Returns the graph of links.
- *
- * @return The graph of links.
- */
- public Graph getGraph() {
- return graph;
- }
+ /**
+ * Returns the graph of links.
+ *
+ * @return The graph of links.
+ */
+ public Graph getGraph() {
+ return graph;
+ }
- /**
- * Sets the graph of links.
- *
- * @param linkSet
- * The graph of links.
- */
- public void setGraph(Graph linkSet) {
- this.graph = linkSet;
- }
+ /**
+ * Sets the graph of links.
+ *
+ * @param linkSet
+ * The graph of links.
+ */
+ public void setGraph(Graph linkSet) {
+ this.graph = linkSet;
+ }
- @Override
- public void write(OutputStream outputStream) throws IOException {
- if (MediaType.TEXT_RDF_N3.equals(getMediaType())) {
- new RdfN3Representation(getGraph()).write(outputStream);
- } else if (MediaType.TEXT_XML.equals(getMediaType())) {
- new RdfXmlRepresentation(getGraph()).write(outputStream);
- } else if (MediaType.APPLICATION_ALL_XML.includes(getMediaType())) {
- new RdfXmlRepresentation(getGraph()).write(outputStream);
- }
- // Writing for other media types goes here.
- }
+ @Override
+ public void write(OutputStream outputStream) throws IOException {
+ if (MediaType.TEXT_RDF_N3.equals(getMediaType())) {
+ new RdfN3Representation(getGraph()).write(outputStream);
+ } else if (MediaType.TEXT_XML.equals(getMediaType())) {
+ new RdfXmlRepresentation(getGraph()).write(outputStream);
+ } else if (MediaType.APPLICATION_ALL_XML.includes(getMediaType())) {
+ new RdfXmlRepresentation(getGraph()).write(outputStream);
+ }
+ // Writing for other media types goes here.
+ }
}
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfXmlRepresentation.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfXmlRepresentation.java
index da509570dc..0f9ee75e3b 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfXmlRepresentation.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/RdfXmlRepresentation.java
@@ -45,35 +45,35 @@
*/
public class RdfXmlRepresentation extends RdfRepresentation {
- /**
- * Constructor.
- *
- * @param linkSet
- * The given graph of links.
- */
- public RdfXmlRepresentation(Graph linkSet) {
- super(linkSet);
- }
+ /**
+ * Constructor.
+ *
+ * @param linkSet
+ * The given graph of links.
+ */
+ public RdfXmlRepresentation(Graph linkSet) {
+ super(linkSet);
+ }
- /**
- * Constructor. Parses the given representation into the given graph.
- *
- * @param rdfRepresentation
- * The RDF N3 representation to parse.
- * @param linkSet
- * The graph to update.
- * @throws IOException
- */
- public RdfXmlRepresentation(Representation rdfRepresentation, Graph linkSet)
- throws IOException {
- super(linkSet);
- new RdfXmlParsingContentHandler(linkSet, rdfRepresentation);
- }
+ /**
+ * Constructor. Parses the given representation into the given graph.
+ *
+ * @param rdfRepresentation
+ * The RDF N3 representation to parse.
+ * @param linkSet
+ * The graph to update.
+ * @throws IOException
+ */
+ public RdfXmlRepresentation(Representation rdfRepresentation, Graph linkSet)
+ throws IOException {
+ super(linkSet);
+ new RdfXmlParsingContentHandler(linkSet, rdfRepresentation);
+ }
- @Override
- public void write(OutputStream outputStream) throws IOException {
- if (getGraph() != null) {
- new RdfXmlWritingContentHandler(getGraph(), outputStream);
- }
- }
+ @Override
+ public void write(OutputStream outputStream) throws IOException {
+ if (getGraph() != null) {
+ new RdfXmlWritingContentHandler(getGraph(), outputStream);
+ }
+ }
}
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/RdfConstants.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/RdfConstants.java
index 724a89436f..0ea71f7fcc 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/RdfConstants.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/RdfConstants.java
@@ -1,3 +1,33 @@
+/**
+ * Copyright 2005-2009 Noelios Technologies.
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL 1.0 (the
+ * "Licenses"). You can select the license that you prefer but you may not use
+ * this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0.html
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1.php
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0.php
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://www.noelios.com/products/restlet-engine
+ *
+ * Restlet is a registered trademark of Noelios Technologies.
+ */
+
package org.restlet.ext.rdf.internal;
import org.restlet.data.Reference;
@@ -5,67 +35,68 @@
/**
* Constants related to RDF documents.
*
+ * @author Thierry Boileau
*/
public class RdfConstants {
- /** List "first". */
- public static final Reference LIST_FIRST = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
-
- /** List "rest". */
- public static final Reference LIST_REST = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
-
- /** Object "nil". */
- public static final Reference OBJECT_NIL = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
-
- /** Predicate "implies" . */
- public static final Reference PREDICATE_IMPLIES = new Reference(
- "http://www.w3.org/2000/10/swap/log#implies");
-
- /** Predicate "object". */
- public static final Reference PREDICATE_OBJECT = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#object");
-
- /** Predicate "predicate". */
- public static final Reference PREDICATE_PREDICATE = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate");
-
- /** Predicate "same as". */
- public static final Reference PREDICATE_SAME = new Reference(
- "http://www.w3.org/2002/07/owl#sameAs");
-
- /** Predicate "statement". */
- public static final Reference PREDICATE_STATEMENT = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement");
-
- /** Predicate "subject". */
- public static final Reference PREDICATE_SUBJECT = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject");
-
- /** Predicate "is a". */
- public static final Reference PREDICATE_TYPE = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
-
- /** Rdf schema. */
- public static final Reference RDF_SCHEMA = new Reference(
- "http://www.w3.org/2000/01/rdf-schema#");
-
- /** Rdf syntax. */
- public static final Reference RDF_SYNTAX = new Reference(
- "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
-
- /** XML schema. */
- public static final Reference XML_SCHEMA = new Reference(
- "http://www.w3.org/2001/XMLSchema#");
-
- /** Float type of the XML schema. */
- public static final Reference XML_SCHEMA_TYPE_FLOAT = new Reference(
- "http://www.w3.org/2001/XMLSchema#float");
-
- /** Integer type of the XML schema. */
- public static final Reference XML_SCHEMA_TYPE_INTEGER = new Reference(
- "http://www.w3.org/2001/XMLSchema#int");
+ /** List "first". */
+ public static final Reference LIST_FIRST = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#first");
+
+ /** List "rest". */
+ public static final Reference LIST_REST = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#rest");
+
+ /** Object "nil". */
+ public static final Reference OBJECT_NIL = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#nil");
+
+ /** Predicate "implies" . */
+ public static final Reference PREDICATE_IMPLIES = new Reference(
+ "http://www.w3.org/2000/10/swap/log#implies");
+
+ /** Predicate "object". */
+ public static final Reference PREDICATE_OBJECT = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#object");
+
+ /** Predicate "predicate". */
+ public static final Reference PREDICATE_PREDICATE = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate");
+
+ /** Predicate "same as". */
+ public static final Reference PREDICATE_SAME = new Reference(
+ "http://www.w3.org/2002/07/owl#sameAs");
+
+ /** Predicate "statement". */
+ public static final Reference PREDICATE_STATEMENT = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement");
+
+ /** Predicate "subject". */
+ public static final Reference PREDICATE_SUBJECT = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#subject");
+
+ /** Predicate "is a". */
+ public static final Reference PREDICATE_TYPE = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#type");
+
+ /** Rdf schema. */
+ public static final Reference RDF_SCHEMA = new Reference(
+ "http://www.w3.org/2000/01/rdf-schema#");
+
+ /** Rdf syntax. */
+ public static final Reference RDF_SYNTAX = new Reference(
+ "http://www.w3.org/1999/02/22-rdf-syntax-ns#");
+
+ /** XML schema. */
+ public static final Reference XML_SCHEMA = new Reference(
+ "http://www.w3.org/2001/XMLSchema#");
+
+ /** Float type of the XML schema. */
+ public static final Reference XML_SCHEMA_TYPE_FLOAT = new Reference(
+ "http://www.w3.org/2001/XMLSchema#float");
+
+ /** Integer type of the XML schema. */
+ public static final Reference XML_SCHEMA_TYPE_INTEGER = new Reference(
+ "http://www.w3.org/2001/XMLSchema#int");
}
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/BlankNodeToken.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/BlankNodeToken.java
index 1ef91baf1a..046105b543 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/BlankNodeToken.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/BlankNodeToken.java
@@ -40,11 +40,13 @@
/**
* Represents a blank node inside a RDF N3 document. Contains all the logic to
* parse a blank node in N3 documents.
+ *
+ * @author Thierry Boileau
*/
public class BlankNodeToken extends LexicalUnit {
/** List of lexical units contained by this blank node. */
- List<LexicalUnit> lexicalUnits;
+ private List<LexicalUnit> lexicalUnits;
/** Indicates if the given blank node has been already resolved. */
private boolean resolved = false;
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/Context.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/Context.java
index ffb3bfbd57..ae5917f65f 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/Context.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/Context.java
@@ -40,8 +40,11 @@
/**
* Contains essentials data updated during the parsing of a N3 document such as
* the list of known namespaces, keywords.
+ *
+ * @author Thierry Boileau
*/
public class Context {
+
/** The value of the "base" keyword. */
private Reference base;
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/FormulaToken.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/FormulaToken.java
index a0714de147..af049ed7ce 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/FormulaToken.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/FormulaToken.java
@@ -35,6 +35,8 @@
/**
* Allows to parse a formula in RDF N3 notation. Please note that this kind of
* feature is not supported yet.
+ *
+ * @author Thierry Boileau
*/
public class FormulaToken extends LexicalUnit {
@@ -44,8 +46,8 @@ public Object resolve() {
return null;
}
- public FormulaToken(RdfN3ParsingContentHandler contentHandler, Context context)
- throws IOException {
+ public FormulaToken(RdfN3ParsingContentHandler contentHandler,
+ Context context) throws IOException {
super(contentHandler, context);
this.parse();
}
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/LexicalUnit.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/LexicalUnit.java
index e1dfda2bba..502194b936 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/LexicalUnit.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/LexicalUnit.java
@@ -34,6 +34,8 @@
/**
* Represents a lexical unit inside a N3 document.
+ *
+ * @author Thierry Boileau
*/
public abstract class LexicalUnit {
@@ -54,7 +56,8 @@ public abstract class LexicalUnit {
* @param context
* The parsing context.
*/
- public LexicalUnit(RdfN3ParsingContentHandler contentHandler, Context context) {
+ public LexicalUnit(RdfN3ParsingContentHandler contentHandler,
+ Context context) {
super();
this.contentHandler = contentHandler;
this.context = context;
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/ListToken.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/ListToken.java
index 2f18fdce8c..a5db88e399 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/ListToken.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/ListToken.java
@@ -38,113 +38,115 @@
import org.restlet.ext.rdf.internal.RdfConstants;
/**
- * Represens a list of N3 tokens.
+ * Represents a list of N3 tokens.
+ *
+ * @author Thierry Boileau
*/
class ListToken extends LexicalUnit {
- /** The list of contained tokens. */
- List<LexicalUnit> lexicalUnits;
+ /** The list of contained tokens. */
+ List<LexicalUnit> lexicalUnits;
- /**
- * Constructor with arguments.
- *
- * @param contentHandler
- * The document's parent handler.
- * @param context
- * The parsing context.
- */
- public ListToken(RdfN3ParsingContentHandler contentHandler, Context context)
- throws IOException {
- super(contentHandler, context);
- lexicalUnits = new ArrayList<LexicalUnit>();
- this.parse();
- }
+ /**
+ * Constructor with arguments.
+ *
+ * @param contentHandler
+ * The document's parent handler.
+ * @param context
+ * The parsing context.
+ */
+ public ListToken(RdfN3ParsingContentHandler contentHandler, Context context)
+ throws IOException {
+ super(contentHandler, context);
+ lexicalUnits = new ArrayList<LexicalUnit>();
+ this.parse();
+ }
- @Override
- public Object resolve() {
- Reference currentBlankNode = (Reference) new BlankNodeToken(
- RdfN3ParsingContentHandler.newBlankNodeId()).resolve();
- for (LexicalUnit lexicalUnit : lexicalUnits) {
- Object element = lexicalUnit.resolve();
+ @Override
+ public Object resolve() {
+ Reference currentBlankNode = (Reference) new BlankNodeToken(
+ RdfN3ParsingContentHandler.newBlankNodeId()).resolve();
+ for (LexicalUnit lexicalUnit : lexicalUnits) {
+ Object element = lexicalUnit.resolve();
- if (element instanceof Reference) {
- getContentHandler().link(currentBlankNode,
- RdfConstants.LIST_FIRST, (Reference) element);
- } else if (element instanceof String) {
- getContentHandler().link(currentBlankNode,
- RdfConstants.LIST_FIRST,
- new Reference((String) element));
- } else {
- // TODO Error.
- }
+ if (element instanceof Reference) {
+ getContentHandler().link(currentBlankNode,
+ RdfConstants.LIST_FIRST, (Reference) element);
+ } else if (element instanceof String) {
+ getContentHandler().link(currentBlankNode,
+ RdfConstants.LIST_FIRST,
+ new Reference((String) element));
+ } else {
+ // TODO Error.
+ }
- Reference restBlankNode = (Reference) new BlankNodeToken(
- RdfN3ParsingContentHandler.newBlankNodeId()).resolve();
+ Reference restBlankNode = (Reference) new BlankNodeToken(
+ RdfN3ParsingContentHandler.newBlankNodeId()).resolve();
- getContentHandler().link(currentBlankNode, RdfConstants.LIST_REST,
- restBlankNode);
- currentBlankNode = restBlankNode;
- }
- getContentHandler().link(currentBlankNode, RdfConstants.LIST_REST,
- RdfConstants.OBJECT_NIL);
+ getContentHandler().link(currentBlankNode, RdfConstants.LIST_REST,
+ restBlankNode);
+ currentBlankNode = restBlankNode;
+ }
+ getContentHandler().link(currentBlankNode, RdfConstants.LIST_REST,
+ RdfConstants.OBJECT_NIL);
- return currentBlankNode;
- }
+ return currentBlankNode;
+ }
- @Override
- public String getValue() {
- return lexicalUnits.toString();
- }
+ @Override
+ public String getValue() {
+ return lexicalUnits.toString();
+ }
- @Override
- public void parse() throws IOException {
- getContentHandler().step();
- do {
- getContentHandler().consumeWhiteSpaces();
- switch (getContentHandler().getChar()) {
- case '(':
- lexicalUnits.add(new ListToken(getContentHandler(),
- getContext()));
- break;
- case '<':
- if (getContentHandler().step() == '=') {
- lexicalUnits.add(new Token("<="));
- getContentHandler().step();
- getContentHandler().discard();
- } else {
- getContentHandler().stepBack();
- lexicalUnits.add(new UriToken(getContentHandler(),
- getContext()));
- }
- break;
- case '_':
- lexicalUnits.add(new BlankNodeToken(getContentHandler()
- .parseToken()));
- break;
- case '"':
- lexicalUnits.add(new StringToken(getContentHandler(),
- getContext()));
- break;
- case '[':
- lexicalUnits.add(new BlankNodeToken(getContentHandler(),
- getContext()));
- break;
- case '{':
- lexicalUnits.add(new FormulaToken(getContentHandler(),
- getContext()));
- break;
- case ')':
- break;
- case RdfN3ParsingContentHandler.EOF:
- break;
- default:
- lexicalUnits.add(new Token(getContentHandler(), getContext()));
- break;
- }
- } while (getContentHandler().getChar() != RdfN3ParsingContentHandler.EOF
- && getContentHandler().getChar() != ')');
- if (getContentHandler().getChar() == ')') {
- // Set the cursor at the right of the list token.
- getContentHandler().step();
- }
- }
+ @Override
+ public void parse() throws IOException {
+ getContentHandler().step();
+ do {
+ getContentHandler().consumeWhiteSpaces();
+ switch (getContentHandler().getChar()) {
+ case '(':
+ lexicalUnits.add(new ListToken(getContentHandler(),
+ getContext()));
+ break;
+ case '<':
+ if (getContentHandler().step() == '=') {
+ lexicalUnits.add(new Token("<="));
+ getContentHandler().step();
+ getContentHandler().discard();
+ } else {
+ getContentHandler().stepBack();
+ lexicalUnits.add(new UriToken(getContentHandler(),
+ getContext()));
+ }
+ break;
+ case '_':
+ lexicalUnits.add(new BlankNodeToken(getContentHandler()
+ .parseToken()));
+ break;
+ case '"':
+ lexicalUnits.add(new StringToken(getContentHandler(),
+ getContext()));
+ break;
+ case '[':
+ lexicalUnits.add(new BlankNodeToken(getContentHandler(),
+ getContext()));
+ break;
+ case '{':
+ lexicalUnits.add(new FormulaToken(getContentHandler(),
+ getContext()));
+ break;
+ case ')':
+ break;
+ case RdfN3ParsingContentHandler.EOF:
+ break;
+ default:
+ lexicalUnits.add(new Token(getContentHandler(), getContext()));
+ break;
+ }
+ } while (getContentHandler().getChar() != RdfN3ParsingContentHandler.EOF
+ && getContentHandler().getChar() != ')');
+ if (getContentHandler().getChar() == ')') {
+ // Set the cursor at the right of the list token.
+ getContentHandler().step();
+ }
+ }
}
\ No newline at end of file
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/RdfN3ParsingContentHandler.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/RdfN3ParsingContentHandler.java
index b3eec7b869..197c9e838c 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/RdfN3ParsingContentHandler.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/RdfN3ParsingContentHandler.java
@@ -46,659 +46,662 @@
/**
* Handler of RDF content according to the N3 notation.
+ *
+ * @author Thierry Boileau
*/
public class RdfN3ParsingContentHandler extends GraphHandler {
- /** Increment used to identify inner blank nodes. */
- private static int blankNodeId = 0;
-
- /** Size of the reading buffer. */
- private static final int BUFFER_SIZE = 4096;
-
- /** End of reading buffer marker. */
- public static final int EOF = 0;
-
- /**
- * Returns true if the given character is alphanumeric.
- *
- * @param c
- * The given character to check.
- * @return true if the given character is alphanumeric.
- */
- public static boolean isAlphaNum(int c) {
- return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
- || (c >= '0' && c <= '9');
- }
-
- /**
- * Returns true if the given character is a delimiter.
- *
- * @param c
- * The given character to check.
- * @return true if the given character is a delimiter.
- */
- public static boolean isDelimiter(int c) {
- return isWhiteSpace(c) || c == '^' || c == '!' || c == '=' || c == '<'
- || c == '"' || c == '{' || c == '}' || c == '[' || c == ']'
- || c == '(' || c == ')' || c == '.' || c == ';' || c == ','
- || c == '@';
- }
-
- /**
- * Returns true if the given character is a whitespace.
- *
- * @param c
- * The given character to check.
- * @return true if the given character is a whitespace.
- */
- public static boolean isWhiteSpace(int c) {
- return c == ' ' || c == '\n' || c == '\r' || c == '\t';
- }
-
- /**
- * Returns the identifier of a new blank node.
- *
- * @return The identifier of a new blank node.
- */
- public static String newBlankNodeId() {
- return "#_bn" + blankNodeId++;
- }
-
- /** Internal buffered reader. */
- private BufferedReader br;
-
- /** The reading buffer. */
- private final char[] buffer;
-
- /** The current context object. */
- private Context context;
-
- /** The set of links to update when parsing. */
- private Graph linkSet;
-
- /** The representation to read. */
- private Representation rdfN3Representation;
-
- /**
- * Index that discovers the end of the current token and the beginning of
- * the futur one.
- */
- private int scoutIndex;
-
- /** Start index of current lexical unit. */
- private int startTokenIndex;
-
- /**
- * Constructor.
- *
- * @param linkSet
- * The set of links to update during the parsing.
- * @param rdfN3Representation
- * The representation to read.
- * @throws IOException
- */
- public RdfN3ParsingContentHandler(Graph linkSet,
- Representation rdfN3Representation) throws IOException {
- super();
- this.linkSet = linkSet;
- this.rdfN3Representation = rdfN3Representation;
-
- // Initialize the buffer in two parts
- this.buffer = new char[(RdfN3ParsingContentHandler.BUFFER_SIZE + 1) * 2];
- // Mark the upper index of each part.
- this.buffer[RdfN3ParsingContentHandler.BUFFER_SIZE] = this.buffer[2 * RdfN3ParsingContentHandler.BUFFER_SIZE + 1] = EOF;
- this.scoutIndex = 2 * RdfN3ParsingContentHandler.BUFFER_SIZE;
- this.startTokenIndex = 0;
-
- this.br = new BufferedReader(new InputStreamReader(
- this.rdfN3Representation.getStream()));
- this.context = new Context();
- context.getKeywords().addAll(
- Arrays.asList("a", "is", "of", "this", "has"));
- parse();
- }
-
- /**
- * Discard all read characters until the end of the statement is reached
- * (marked by a '.').
- *
- * @throws IOException
- */
- public void consumeStatement() throws IOException {
- int c = getChar();
- while (c != RdfN3ParsingContentHandler.EOF && c != '.') {
- c = step();
- }
- if (getChar() == '.') {
- // A further step at the right of the statement.
- step();
- }
- discard();
- }
-
- /**
- * Discard all read characters. A call to {@link getCurrentToken} will
- * return a single character.
- *
- * @throws IOException
- */
- public void consumeWhiteSpaces() throws IOException {
- while (RdfN3ParsingContentHandler.isWhiteSpace(getChar())) {
- step();
- }
- discard();
- }
-
- /**
- * Discard all read characters. A call to {@link getCurrentToken} will
- * return a single character.
- */
- public void discard() {
- startTokenIndex = scoutIndex;
- }
-
- /**
- * Loops over the given list of lexical units and generates the adequat
- * calls to link* methods.
- *
- * @see GraphHandler#link(Graph, Reference, Reference)
- * @see GraphHandler#link(Reference, Reference, Literal)
- * @see GraphHandler#link(Reference, Reference, Reference)
- * @param lexicalUnits
- * The list of lexical units used to generate the links.
- */
- public void generateLinks(List<LexicalUnit> lexicalUnits) {
- Object currentSubject = null;
- Reference currentPredicate = null;
- Object currentObject = null;
- int nbTokens = 0;
- boolean swapSubjectObject = false;
- for (int i = 0; i < lexicalUnits.size(); i++) {
- LexicalUnit lexicalUnit = lexicalUnits.get(i);
-
- nbTokens++;
- switch (nbTokens) {
- case 1:
- if (",".equals(lexicalUnit.getValue())) {
- nbTokens++;
- } else if (!";".equals(lexicalUnit.getValue())) {
- currentSubject = lexicalUnit.resolve();
- }
- break;
- case 2:
- if ("is".equalsIgnoreCase(lexicalUnit.getValue())) {
- nbTokens--;
- swapSubjectObject = true;
- } else if ("has".equalsIgnoreCase(lexicalUnit.getValue())) {
- nbTokens--;
- } else if ("=".equalsIgnoreCase(lexicalUnit.getValue())) {
- currentPredicate = RdfConstants.PREDICATE_SAME;
- } else if ("=>".equalsIgnoreCase(lexicalUnit.getValue())) {
- currentPredicate = RdfConstants.PREDICATE_IMPLIES;
- } else if ("<=".equalsIgnoreCase(lexicalUnit.getValue())) {
- swapSubjectObject = true;
- currentPredicate = RdfConstants.PREDICATE_IMPLIES;
- } else if ("a".equalsIgnoreCase(lexicalUnit.getValue())) {
- currentPredicate = RdfConstants.PREDICATE_TYPE;
- } else if ("!".equalsIgnoreCase(lexicalUnit.getValue())) {
- currentObject = new BlankNodeToken(
- RdfN3ParsingContentHandler.newBlankNodeId())
- .resolve();
- currentPredicate = getPredicate(lexicalUnits.get(++i));
- this.link(currentSubject, currentPredicate, currentObject);
- currentSubject = currentObject;
- nbTokens = 1;
- } else if ("^".equalsIgnoreCase(lexicalUnit.getValue())) {
- currentObject = currentSubject;
- currentPredicate = getPredicate(lexicalUnits.get(++i));
- currentSubject = new BlankNodeToken(
- RdfN3ParsingContentHandler.newBlankNodeId())
- .resolve();
- this.link(currentSubject, currentPredicate, currentObject);
- nbTokens = 1;
- } else {
- currentPredicate = getPredicate(lexicalUnit);
- }
- break;
- case 3:
- if ("of".equalsIgnoreCase(lexicalUnit.getValue())) {
- nbTokens--;
- } else {
- if (swapSubjectObject) {
- currentObject = currentSubject;
- currentSubject = lexicalUnit.resolve();
- } else {
- currentObject = lexicalUnit.resolve();
- }
- this.link(currentSubject, currentPredicate, currentObject);
- nbTokens = 0;
- swapSubjectObject = false;
- }
- break;
- default:
- break;
- }
- }
- }
-
- /**
- * Returns the current parsed character.
- *
- * @return The current parsed character.
- */
- public char getChar() {
- return (char) buffer[scoutIndex];
- }
-
- /**
- * Returns the current token.
- *
- * @return The current token.
- */
- public String getCurrentToken() {
- StringBuilder builder = new StringBuilder();
- if (startTokenIndex <= scoutIndex) {
- if (scoutIndex <= RdfN3ParsingContentHandler.BUFFER_SIZE) {
- for (int i = startTokenIndex; i < scoutIndex; i++) {
- builder.append((char) buffer[i]);
- }
- } else {
- for (int i = startTokenIndex; i < RdfN3ParsingContentHandler.BUFFER_SIZE; i++) {
- builder.append((char) buffer[i]);
- }
- for (int i = RdfN3ParsingContentHandler.BUFFER_SIZE + 1; i < scoutIndex; i++) {
- builder.append((char) buffer[i]);
- }
- }
- } else {
- if (startTokenIndex <= RdfN3ParsingContentHandler.BUFFER_SIZE) {
- for (int i = startTokenIndex; i < RdfN3ParsingContentHandler.BUFFER_SIZE; i++) {
- builder.append((char) buffer[i]);
- }
- for (int i = RdfN3ParsingContentHandler.BUFFER_SIZE + 1; i < (2 * RdfN3ParsingContentHandler.BUFFER_SIZE + 1); i++) {
- builder.append((char) buffer[i]);
- }
- for (int i = 0; i < scoutIndex; i++) {
- builder.append((char) buffer[i]);
- }
- } else {
- for (int i = startTokenIndex; i < (2 * RdfN3ParsingContentHandler.BUFFER_SIZE + 1); i++) {
- builder.append((char) buffer[i]);
- }
- for (int i = 0; i < scoutIndex; i++) {
- builder.append((char) buffer[i]);
- }
- }
- }
- // the current token is consumed.
- startTokenIndex = scoutIndex;
- return builder.toString();
- }
-
- /**
- * Returns the given lexical unit as a predicate.
- *
- * @param lexicalUnit
- * The lexical unit to get as a predicate.
- * @return A RDF URI reference of the predicate.
- */
- private Reference getPredicate(LexicalUnit lexicalUnit) {
- Reference result = null;
- Object p = lexicalUnit.resolve();
- if (p instanceof Reference) {
- result = (Reference) p;
- } else if (p instanceof String) {
- result = new Reference((String) p);
- }
-
- return result;
- }
-
- @Override
- public void link(Graph source, Reference typeRef, Literal target) {
- this.linkSet.add(source, typeRef, target);
- }
-
- @Override
- public void link(Graph source, Reference typeRef, Reference target) {
- this.linkSet.add(source, typeRef, target);
- }
-
- /**
- * Callback method used when a link is parsed or written.
- *
- * @param source
- * The source or subject of the link.
- * @param typeRef
- * The type reference of the link.
- * @param target
- * The target or object of the link.
- */
- private void link(Object source, Reference typeRef, Object target) {
- if (source instanceof Reference) {
- if (target instanceof Reference) {
- link((Reference) source, typeRef, (Reference) target);
- } else if (target instanceof Literal) {
- link((Reference) source, typeRef, (Literal) target);
- } else {
- // Error?
- }
- } else if (source instanceof Graph) {
- if (target instanceof Reference) {
- link((Graph) source, typeRef, (Reference) target);
- } else if (target instanceof Literal) {
- link((Graph) source, typeRef, (Literal) target);
- } else {
- // Error?
- }
- }
- }
-
- @Override
- public void link(Reference source, Reference typeRef, Literal target) {
- this.linkSet.add(source, typeRef, target);
- }
-
- @Override
- public void link(Reference source, Reference typeRef, Reference target) {
- this.linkSet.add(source, typeRef, target);
- }
-
- /**
- * Parses the current representation.
- *
- * @throws IOException
- */
- private void parse() throws IOException {
- // Init the reading.
- step();
- do {
- consumeWhiteSpaces();
- switch (getChar()) {
- case '@':
- parseDirective(this.context);
- break;
- case '#':
- parseComment();
- break;
- case '.':
- step();
- break;
- default:
- parseStatement(this.context);
- break;
- }
- } while (getChar() != RdfN3ParsingContentHandler.EOF);
-
- }
-
- /**
- * Parses a comment.
- *
- * @throws IOException
- */
- public void parseComment() throws IOException {
- int c;
- do {
- c = step();
- } while (c != RdfN3ParsingContentHandler.EOF && c != '\n' && c != '\r');
- discard();
- }
-
- /**
- * Parse the current directive and update the context according to the kind
- * of directive ("base", "prefix", etc).
- *
- * @param context
- * The context to update.
- * @throws IOException
- */
- public void parseDirective(Context context) throws IOException {
- // Remove the leading '@' character.
- step();
- discard();
- String currentKeyword = parseToken();
- if ("base".equalsIgnoreCase(currentKeyword)) {
- consumeWhiteSpaces();
- String base = parseUri();
- Reference ref = new Reference(base);
- if (ref.isRelative()) {
- context.getBase().addSegment(base);
- } else {
- context.setBase(ref);
- }
- consumeStatement();
- } else if ("prefix".equalsIgnoreCase(currentKeyword)) {
- consumeWhiteSpaces();
- String prefix = parseToken();
- consumeWhiteSpaces();
- String uri = parseUri();
- context.getPrefixes().put(prefix, uri);
- consumeStatement();
- } else if ("keywords".equalsIgnoreCase(currentKeyword)) {
- consumeWhiteSpaces();
- int c;
- do {
- c = step();
- } while (c != RdfN3ParsingContentHandler.EOF && c != '.');
- String strKeywords = getCurrentToken();
- String[] keywords = strKeywords.split(",");
- context.getKeywords().clear();
- for (String keyword : keywords) {
- context.getKeywords().add(keyword.trim());
- }
- consumeStatement();
- } else {
- // TODO @ForAll and @ForSome are not supported yet.
- consumeStatement();
- }
- }
-
- /**
- * Reads the current statement until its end, and parses it.
- *
- * @param context
- * The current context.
- * @throws IOException
- */
- public void parseStatement(Context context) throws IOException {
- List<LexicalUnit> lexicalUnits = new ArrayList<LexicalUnit>();
- do {
- consumeWhiteSpaces();
- switch (getChar()) {
- case '(':
- lexicalUnits.add(new ListToken(this, context));
- break;
- case '<':
- if (step() == '=') {
- lexicalUnits.add(new Token("<="));
- step();
- discard();
- } else {
- stepBack();
- lexicalUnits.add(new UriToken(this, context));
- }
- break;
- case '_':
- lexicalUnits.add(new BlankNodeToken(parseToken()));
- break;
- case '"':
- lexicalUnits.add(new StringToken(this, context));
- break;
- case '[':
- lexicalUnits.add(new BlankNodeToken(this, context));
- break;
- case '!':
- lexicalUnits.add(new Token("!"));
- step();
- discard();
- break;
- case '^':
- lexicalUnits.add(new Token("^"));
- step();
- discard();
- break;
- case '=':
- if (step() == '>') {
- lexicalUnits.add(new Token("=>"));
- step();
- discard();
- } else {
- lexicalUnits.add(new Token("="));
- discard();
- }
- break;
- case '@':
- // Remove the leading '@' character.
- step();
- discard();
- lexicalUnits.add(new Token(this, context));
- discard();
- break;
- case ';':
- // TODO
- step();
- discard();
- lexicalUnits.add(new Token(";"));
- break;
- case ',':
- // TODO
- step();
- discard();
- lexicalUnits.add(new Token(","));
- break;
- case '{':
- lexicalUnits.add(new FormulaToken(this, context));
- break;
- case '.':
- break;
- case RdfN3ParsingContentHandler.EOF:
- break;
- default:
- lexicalUnits.add(new Token(this, context));
- break;
- }
- } while (getChar() != RdfN3ParsingContentHandler.EOF
- && getChar() != '.' && getChar() != '}');
-
- // Generate the links
- generateLinks(lexicalUnits);
- }
-
- /**
- * Returns the value of the current token.
- *
- * @return The value of the current token.
- * @throws IOException
- */
- public String parseToken() throws IOException {
- int c;
- do {
- c = step();
- } while (c != RdfN3ParsingContentHandler.EOF && !isDelimiter(c));
- String result = getCurrentToken();
- return result;
- }
-
- /**
- * Returns the value of the current URI.
- *
- * @return The value of the current URI.
- * @throws IOException
- */
- public String parseUri() throws IOException {
- StringBuilder builder = new StringBuilder();
- // Suppose the current character is "<".
- int c = step();
- while (c != RdfN3ParsingContentHandler.EOF && c != '>') {
- if (!isWhiteSpace(c)) {
- // Discard white spaces.
- builder.append((char) c);
- }
- c = step();
- }
- if (c == '>') {
- // Set the cursor at the right of the uri.
- step();
- }
- discard();
-
- return builder.toString();
- }
-
- /**
- * Read a new character.
- *
- * @return The new read character.
- * @throws IOException
- */
- public int step() throws IOException {
- scoutIndex++;
- if (buffer[scoutIndex] == RdfN3ParsingContentHandler.EOF) {
- if (scoutIndex == RdfN3ParsingContentHandler.BUFFER_SIZE) {
- // Reached the end of the first part of the buffer, read into
- // the second one.
- scoutIndex++;
- int len = this.br.read(buffer, 0,
- RdfN3ParsingContentHandler.BUFFER_SIZE);
- if (len == -1) {
- // End of the stream reached
- buffer[scoutIndex] = RdfN3ParsingContentHandler.EOF;
- } else {
- buffer[RdfN3ParsingContentHandler.BUFFER_SIZE + len + 1] = RdfN3ParsingContentHandler.EOF;
- }
- } else if (scoutIndex == (2 * RdfN3ParsingContentHandler.BUFFER_SIZE + 1)) {
- scoutIndex = 0;
- // Reached the end of the second part of the buffer, read into
- // the first one.
- int len = this.br.read(buffer, 0,
- RdfN3ParsingContentHandler.BUFFER_SIZE);
- if (len == -1) {
- // End of the stream reached
- buffer[scoutIndex] = RdfN3ParsingContentHandler.EOF;
- } else {
- buffer[len] = RdfN3ParsingContentHandler.EOF;
- }
- } else {
- // Reached the end of the stream.
- }
- }
-
- return buffer[scoutIndex];
- }
-
- /**
- * Steps forward.
- *
- * @param n
- * the number of steps to go forward.
- * @throws IOException
- */
- public void step(int n) throws IOException {
- for (int i = 0; i < n; i++) {
- step();
- }
- }
-
- /**
- * Steps back of one step.
- *
- */
- public void stepBack() {
- stepBack(1);
- }
-
- /**
- * Steps back.
- *
- * @param n
- * the number of steps to go back.
- */
- public void stepBack(int n) {
- scoutIndex -= n;
- if (scoutIndex < 0) {
- scoutIndex = RdfN3ParsingContentHandler.BUFFER_SIZE * 2 + 1
- - scoutIndex;
- }
- }
+
+ /** Increment used to identify inner blank nodes. */
+ private static int blankNodeId = 0;
+
+ /** Size of the reading buffer. */
+ private static final int BUFFER_SIZE = 4096;
+
+ /** End of reading buffer marker. */
+ public static final int EOF = 0;
+
+ /**
+ * Returns true if the given character is alphanumeric.
+ *
+ * @param c
+ * The given character to check.
+ * @return true if the given character is alphanumeric.
+ */
+ public static boolean isAlphaNum(int c) {
+ return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')
+ || (c >= '0' && c <= '9');
+ }
+
+ /**
+ * Returns true if the given character is a delimiter.
+ *
+ * @param c
+ * The given character to check.
+ * @return true if the given character is a delimiter.
+ */
+ public static boolean isDelimiter(int c) {
+ return isWhiteSpace(c) || c == '^' || c == '!' || c == '=' || c == '<'
+ || c == '"' || c == '{' || c == '}' || c == '[' || c == ']'
+ || c == '(' || c == ')' || c == '.' || c == ';' || c == ','
+ || c == '@';
+ }
+
+ /**
+ * Returns true if the given character is a whitespace.
+ *
+ * @param c
+ * The given character to check.
+ * @return true if the given character is a whitespace.
+ */
+ public static boolean isWhiteSpace(int c) {
+ return c == ' ' || c == '\n' || c == '\r' || c == '\t';
+ }
+
+ /**
+ * Returns the identifier of a new blank node.
+ *
+ * @return The identifier of a new blank node.
+ */
+ public static String newBlankNodeId() {
+ return "#_bn" + blankNodeId++;
+ }
+
+ /** Internal buffered reader. */
+ private BufferedReader br;
+
+ /** The reading buffer. */
+ private final char[] buffer;
+
+ /** The current context object. */
+ private Context context;
+
+ /** The set of links to update when parsing. */
+ private Graph linkSet;
+
+ /** The representation to read. */
+ private Representation rdfN3Representation;
+
+ /**
+ * Index that discovers the end of the current token and the beginning of
+ * the futur one.
+ */
+ private int scoutIndex;
+
+ /** Start index of current lexical unit. */
+ private int startTokenIndex;
+
+ /**
+ * Constructor.
+ *
+ * @param linkSet
+ * The set of links to update during the parsing.
+ * @param rdfN3Representation
+ * The representation to read.
+ * @throws IOException
+ */
+ public RdfN3ParsingContentHandler(Graph linkSet,
+ Representation rdfN3Representation) throws IOException {
+ super();
+ this.linkSet = linkSet;
+ this.rdfN3Representation = rdfN3Representation;
+
+ // Initialize the buffer in two parts
+ this.buffer = new char[(RdfN3ParsingContentHandler.BUFFER_SIZE + 1) * 2];
+ // Mark the upper index of each part.
+ this.buffer[RdfN3ParsingContentHandler.BUFFER_SIZE] = this.buffer[2 * RdfN3ParsingContentHandler.BUFFER_SIZE + 1] = EOF;
+ this.scoutIndex = 2 * RdfN3ParsingContentHandler.BUFFER_SIZE;
+ this.startTokenIndex = 0;
+
+ this.br = new BufferedReader(new InputStreamReader(
+ this.rdfN3Representation.getStream()));
+ this.context = new Context();
+ context.getKeywords().addAll(
+ Arrays.asList("a", "is", "of", "this", "has"));
+ parse();
+ }
+
+ /**
+ * Discard all read characters until the end of the statement is reached
+ * (marked by a '.').
+ *
+ * @throws IOException
+ */
+ public void consumeStatement() throws IOException {
+ int c = getChar();
+ while (c != RdfN3ParsingContentHandler.EOF && c != '.') {
+ c = step();
+ }
+ if (getChar() == '.') {
+ // A further step at the right of the statement.
+ step();
+ }
+ discard();
+ }
+
+ /**
+ * Discard all read characters. A call to {@link getCurrentToken} will
+ * return a single character.
+ *
+ * @throws IOException
+ */
+ public void consumeWhiteSpaces() throws IOException {
+ while (RdfN3ParsingContentHandler.isWhiteSpace(getChar())) {
+ step();
+ }
+ discard();
+ }
+
+ /**
+ * Discard all read characters. A call to {@link getCurrentToken} will
+ * return a single character.
+ */
+ public void discard() {
+ startTokenIndex = scoutIndex;
+ }
+
+ /**
+ * Loops over the given list of lexical units and generates the adequat
+ * calls to link* methods.
+ *
+ * @see GraphHandler#link(Graph, Reference, Reference)
+ * @see GraphHandler#link(Reference, Reference, Literal)
+ * @see GraphHandler#link(Reference, Reference, Reference)
+ * @param lexicalUnits
+ * The list of lexical units used to generate the links.
+ */
+ public void generateLinks(List<LexicalUnit> lexicalUnits) {
+ Object currentSubject = null;
+ Reference currentPredicate = null;
+ Object currentObject = null;
+ int nbTokens = 0;
+ boolean swapSubjectObject = false;
+ for (int i = 0; i < lexicalUnits.size(); i++) {
+ LexicalUnit lexicalUnit = lexicalUnits.get(i);
+
+ nbTokens++;
+ switch (nbTokens) {
+ case 1:
+ if (",".equals(lexicalUnit.getValue())) {
+ nbTokens++;
+ } else if (!";".equals(lexicalUnit.getValue())) {
+ currentSubject = lexicalUnit.resolve();
+ }
+ break;
+ case 2:
+ if ("is".equalsIgnoreCase(lexicalUnit.getValue())) {
+ nbTokens--;
+ swapSubjectObject = true;
+ } else if ("has".equalsIgnoreCase(lexicalUnit.getValue())) {
+ nbTokens--;
+ } else if ("=".equalsIgnoreCase(lexicalUnit.getValue())) {
+ currentPredicate = RdfConstants.PREDICATE_SAME;
+ } else if ("=>".equalsIgnoreCase(lexicalUnit.getValue())) {
+ currentPredicate = RdfConstants.PREDICATE_IMPLIES;
+ } else if ("<=".equalsIgnoreCase(lexicalUnit.getValue())) {
+ swapSubjectObject = true;
+ currentPredicate = RdfConstants.PREDICATE_IMPLIES;
+ } else if ("a".equalsIgnoreCase(lexicalUnit.getValue())) {
+ currentPredicate = RdfConstants.PREDICATE_TYPE;
+ } else if ("!".equalsIgnoreCase(lexicalUnit.getValue())) {
+ currentObject = new BlankNodeToken(
+ RdfN3ParsingContentHandler.newBlankNodeId())
+ .resolve();
+ currentPredicate = getPredicate(lexicalUnits.get(++i));
+ this.link(currentSubject, currentPredicate, currentObject);
+ currentSubject = currentObject;
+ nbTokens = 1;
+ } else if ("^".equalsIgnoreCase(lexicalUnit.getValue())) {
+ currentObject = currentSubject;
+ currentPredicate = getPredicate(lexicalUnits.get(++i));
+ currentSubject = new BlankNodeToken(
+ RdfN3ParsingContentHandler.newBlankNodeId())
+ .resolve();
+ this.link(currentSubject, currentPredicate, currentObject);
+ nbTokens = 1;
+ } else {
+ currentPredicate = getPredicate(lexicalUnit);
+ }
+ break;
+ case 3:
+ if ("of".equalsIgnoreCase(lexicalUnit.getValue())) {
+ nbTokens--;
+ } else {
+ if (swapSubjectObject) {
+ currentObject = currentSubject;
+ currentSubject = lexicalUnit.resolve();
+ } else {
+ currentObject = lexicalUnit.resolve();
+ }
+ this.link(currentSubject, currentPredicate, currentObject);
+ nbTokens = 0;
+ swapSubjectObject = false;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ /**
+ * Returns the current parsed character.
+ *
+ * @return The current parsed character.
+ */
+ public char getChar() {
+ return (char) buffer[scoutIndex];
+ }
+
+ /**
+ * Returns the current token.
+ *
+ * @return The current token.
+ */
+ public String getCurrentToken() {
+ StringBuilder builder = new StringBuilder();
+ if (startTokenIndex <= scoutIndex) {
+ if (scoutIndex <= RdfN3ParsingContentHandler.BUFFER_SIZE) {
+ for (int i = startTokenIndex; i < scoutIndex; i++) {
+ builder.append((char) buffer[i]);
+ }
+ } else {
+ for (int i = startTokenIndex; i < RdfN3ParsingContentHandler.BUFFER_SIZE; i++) {
+ builder.append((char) buffer[i]);
+ }
+ for (int i = RdfN3ParsingContentHandler.BUFFER_SIZE + 1; i < scoutIndex; i++) {
+ builder.append((char) buffer[i]);
+ }
+ }
+ } else {
+ if (startTokenIndex <= RdfN3ParsingContentHandler.BUFFER_SIZE) {
+ for (int i = startTokenIndex; i < RdfN3ParsingContentHandler.BUFFER_SIZE; i++) {
+ builder.append((char) buffer[i]);
+ }
+ for (int i = RdfN3ParsingContentHandler.BUFFER_SIZE + 1; i < (2 * RdfN3ParsingContentHandler.BUFFER_SIZE + 1); i++) {
+ builder.append((char) buffer[i]);
+ }
+ for (int i = 0; i < scoutIndex; i++) {
+ builder.append((char) buffer[i]);
+ }
+ } else {
+ for (int i = startTokenIndex; i < (2 * RdfN3ParsingContentHandler.BUFFER_SIZE + 1); i++) {
+ builder.append((char) buffer[i]);
+ }
+ for (int i = 0; i < scoutIndex; i++) {
+ builder.append((char) buffer[i]);
+ }
+ }
+ }
+ // the current token is consumed.
+ startTokenIndex = scoutIndex;
+ return builder.toString();
+ }
+
+ /**
+ * Returns the given lexical unit as a predicate.
+ *
+ * @param lexicalUnit
+ * The lexical unit to get as a predicate.
+ * @return A RDF URI reference of the predicate.
+ */
+ private Reference getPredicate(LexicalUnit lexicalUnit) {
+ Reference result = null;
+ Object p = lexicalUnit.resolve();
+ if (p instanceof Reference) {
+ result = (Reference) p;
+ } else if (p instanceof String) {
+ result = new Reference((String) p);
+ }
+
+ return result;
+ }
+
+ @Override
+ public void link(Graph source, Reference typeRef, Literal target) {
+ this.linkSet.add(source, typeRef, target);
+ }
+
+ @Override
+ public void link(Graph source, Reference typeRef, Reference target) {
+ this.linkSet.add(source, typeRef, target);
+ }
+
+ /**
+ * Callback method used when a link is parsed or written.
+ *
+ * @param source
+ * The source or subject of the link.
+ * @param typeRef
+ * The type reference of the link.
+ * @param target
+ * The target or object of the link.
+ */
+ private void link(Object source, Reference typeRef, Object target) {
+ if (source instanceof Reference) {
+ if (target instanceof Reference) {
+ link((Reference) source, typeRef, (Reference) target);
+ } else if (target instanceof Literal) {
+ link((Reference) source, typeRef, (Literal) target);
+ } else {
+ // Error?
+ }
+ } else if (source instanceof Graph) {
+ if (target instanceof Reference) {
+ link((Graph) source, typeRef, (Reference) target);
+ } else if (target instanceof Literal) {
+ link((Graph) source, typeRef, (Literal) target);
+ } else {
+ // Error?
+ }
+ }
+ }
+
+ @Override
+ public void link(Reference source, Reference typeRef, Literal target) {
+ this.linkSet.add(source, typeRef, target);
+ }
+
+ @Override
+ public void link(Reference source, Reference typeRef, Reference target) {
+ this.linkSet.add(source, typeRef, target);
+ }
+
+ /**
+ * Parses the current representation.
+ *
+ * @throws IOException
+ */
+ private void parse() throws IOException {
+ // Init the reading.
+ step();
+ do {
+ consumeWhiteSpaces();
+ switch (getChar()) {
+ case '@':
+ parseDirective(this.context);
+ break;
+ case '#':
+ parseComment();
+ break;
+ case '.':
+ step();
+ break;
+ default:
+ parseStatement(this.context);
+ break;
+ }
+ } while (getChar() != RdfN3ParsingContentHandler.EOF);
+
+ }
+
+ /**
+ * Parses a comment.
+ *
+ * @throws IOException
+ */
+ public void parseComment() throws IOException {
+ int c;
+ do {
+ c = step();
+ } while (c != RdfN3ParsingContentHandler.EOF && c != '\n' && c != '\r');
+ discard();
+ }
+
+ /**
+ * Parse the current directive and update the context according to the kind
+ * of directive ("base", "prefix", etc).
+ *
+ * @param context
+ * The context to update.
+ * @throws IOException
+ */
+ public void parseDirective(Context context) throws IOException {
+ // Remove the leading '@' character.
+ step();
+ discard();
+ String currentKeyword = parseToken();
+ if ("base".equalsIgnoreCase(currentKeyword)) {
+ consumeWhiteSpaces();
+ String base = parseUri();
+ Reference ref = new Reference(base);
+ if (ref.isRelative()) {
+ context.getBase().addSegment(base);
+ } else {
+ context.setBase(ref);
+ }
+ consumeStatement();
+ } else if ("prefix".equalsIgnoreCase(currentKeyword)) {
+ consumeWhiteSpaces();
+ String prefix = parseToken();
+ consumeWhiteSpaces();
+ String uri = parseUri();
+ context.getPrefixes().put(prefix, uri);
+ consumeStatement();
+ } else if ("keywords".equalsIgnoreCase(currentKeyword)) {
+ consumeWhiteSpaces();
+ int c;
+ do {
+ c = step();
+ } while (c != RdfN3ParsingContentHandler.EOF && c != '.');
+ String strKeywords = getCurrentToken();
+ String[] keywords = strKeywords.split(",");
+ context.getKeywords().clear();
+ for (String keyword : keywords) {
+ context.getKeywords().add(keyword.trim());
+ }
+ consumeStatement();
+ } else {
+ // TODO @ForAll and @ForSome are not supported yet.
+ consumeStatement();
+ }
+ }
+
+ /**
+ * Reads the current statement until its end, and parses it.
+ *
+ * @param context
+ * The current context.
+ * @throws IOException
+ */
+ public void parseStatement(Context context) throws IOException {
+ List<LexicalUnit> lexicalUnits = new ArrayList<LexicalUnit>();
+ do {
+ consumeWhiteSpaces();
+ switch (getChar()) {
+ case '(':
+ lexicalUnits.add(new ListToken(this, context));
+ break;
+ case '<':
+ if (step() == '=') {
+ lexicalUnits.add(new Token("<="));
+ step();
+ discard();
+ } else {
+ stepBack();
+ lexicalUnits.add(new UriToken(this, context));
+ }
+ break;
+ case '_':
+ lexicalUnits.add(new BlankNodeToken(parseToken()));
+ break;
+ case '"':
+ lexicalUnits.add(new StringToken(this, context));
+ break;
+ case '[':
+ lexicalUnits.add(new BlankNodeToken(this, context));
+ break;
+ case '!':
+ lexicalUnits.add(new Token("!"));
+ step();
+ discard();
+ break;
+ case '^':
+ lexicalUnits.add(new Token("^"));
+ step();
+ discard();
+ break;
+ case '=':
+ if (step() == '>') {
+ lexicalUnits.add(new Token("=>"));
+ step();
+ discard();
+ } else {
+ lexicalUnits.add(new Token("="));
+ discard();
+ }
+ break;
+ case '@':
+ // Remove the leading '@' character.
+ step();
+ discard();
+ lexicalUnits.add(new Token(this, context));
+ discard();
+ break;
+ case ';':
+ // TODO
+ step();
+ discard();
+ lexicalUnits.add(new Token(";"));
+ break;
+ case ',':
+ // TODO
+ step();
+ discard();
+ lexicalUnits.add(new Token(","));
+ break;
+ case '{':
+ lexicalUnits.add(new FormulaToken(this, context));
+ break;
+ case '.':
+ break;
+ case RdfN3ParsingContentHandler.EOF:
+ break;
+ default:
+ lexicalUnits.add(new Token(this, context));
+ break;
+ }
+ } while (getChar() != RdfN3ParsingContentHandler.EOF
+ && getChar() != '.' && getChar() != '}');
+
+ // Generate the links
+ generateLinks(lexicalUnits);
+ }
+
+ /**
+ * Returns the value of the current token.
+ *
+ * @return The value of the current token.
+ * @throws IOException
+ */
+ public String parseToken() throws IOException {
+ int c;
+ do {
+ c = step();
+ } while (c != RdfN3ParsingContentHandler.EOF && !isDelimiter(c));
+ String result = getCurrentToken();
+ return result;
+ }
+
+ /**
+ * Returns the value of the current URI.
+ *
+ * @return The value of the current URI.
+ * @throws IOException
+ */
+ public String parseUri() throws IOException {
+ StringBuilder builder = new StringBuilder();
+ // Suppose the current character is "<".
+ int c = step();
+ while (c != RdfN3ParsingContentHandler.EOF && c != '>') {
+ if (!isWhiteSpace(c)) {
+ // Discard white spaces.
+ builder.append((char) c);
+ }
+ c = step();
+ }
+ if (c == '>') {
+ // Set the cursor at the right of the uri.
+ step();
+ }
+ discard();
+
+ return builder.toString();
+ }
+
+ /**
+ * Read a new character.
+ *
+ * @return The new read character.
+ * @throws IOException
+ */
+ public int step() throws IOException {
+ scoutIndex++;
+ if (buffer[scoutIndex] == RdfN3ParsingContentHandler.EOF) {
+ if (scoutIndex == RdfN3ParsingContentHandler.BUFFER_SIZE) {
+ // Reached the end of the first part of the buffer, read into
+ // the second one.
+ scoutIndex++;
+ int len = this.br.read(buffer, 0,
+ RdfN3ParsingContentHandler.BUFFER_SIZE);
+ if (len == -1) {
+ // End of the stream reached
+ buffer[scoutIndex] = RdfN3ParsingContentHandler.EOF;
+ } else {
+ buffer[RdfN3ParsingContentHandler.BUFFER_SIZE + len + 1] = RdfN3ParsingContentHandler.EOF;
+ }
+ } else if (scoutIndex == (2 * RdfN3ParsingContentHandler.BUFFER_SIZE + 1)) {
+ scoutIndex = 0;
+ // Reached the end of the second part of the buffer, read into
+ // the first one.
+ int len = this.br.read(buffer, 0,
+ RdfN3ParsingContentHandler.BUFFER_SIZE);
+ if (len == -1) {
+ // End of the stream reached
+ buffer[scoutIndex] = RdfN3ParsingContentHandler.EOF;
+ } else {
+ buffer[len] = RdfN3ParsingContentHandler.EOF;
+ }
+ } else {
+ // Reached the end of the stream.
+ }
+ }
+
+ return buffer[scoutIndex];
+ }
+
+ /**
+ * Steps forward.
+ *
+ * @param n
+ * the number of steps to go forward.
+ * @throws IOException
+ */
+ public void step(int n) throws IOException {
+ for (int i = 0; i < n; i++) {
+ step();
+ }
+ }
+
+ /**
+ * Steps back of one step.
+ *
+ */
+ public void stepBack() {
+ stepBack(1);
+ }
+
+ /**
+ * Steps back.
+ *
+ * @param n
+ * the number of steps to go back.
+ */
+ public void stepBack(int n) {
+ scoutIndex -= n;
+ if (scoutIndex < 0) {
+ scoutIndex = RdfN3ParsingContentHandler.BUFFER_SIZE * 2 + 1
+ - scoutIndex;
+ }
+ }
}
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/RdfN3WritingContentHandler.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/RdfN3WritingContentHandler.java
index b6db8b3713..2ab77fb250 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/RdfN3WritingContentHandler.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/RdfN3WritingContentHandler.java
@@ -47,252 +47,254 @@
/**
* Handler of RDF content according to the N3 notation.
+ *
+ * @author Thierry Boileau
*/
public class RdfN3WritingContentHandler extends GraphHandler {
- /** Buffered writer. */
- BufferedWriter bw;
+ /** Buffered writer. */
+ private BufferedWriter bw;
- /** The current context object. */
- private Context context;
+ /** The current context object. */
+ private Context context;
- /** The preceding predicate used for factorization matter. */
- private Reference precPredicate;
+ /** The preceding predicate used for factorization matter. */
+ private Reference precPredicate;
- /** The preceding source used for factorization matter. */
- private Reference precSource;
+ /** The preceding source used for factorization matter. */
+ private Reference precSource;
- /** Indicates if the end of the statement is to be written. */
- private boolean writeExtraDot;
+ /** Indicates if the end of the statement is to be written. */
+ private boolean writeExtraDot;
- /**
- * Constructor.
- *
- * @param linkSet
- * The set of links to write to the output stream.
- * @param outputStream
- * The output stream to write to.
- * @throws IOException
- * @throws IOException
- */
- public RdfN3WritingContentHandler(Graph linkset, OutputStream outputStream)
- throws IOException {
- super();
- this.bw = new BufferedWriter(new OutputStreamWriter(outputStream));
- this.context = new Context();
- Map<String, String> prefixes = context.getPrefixes();
- prefixes.put(RdfConstants.RDF_SCHEMA.toString(), "rdf");
- prefixes.put(RdfConstants.RDF_SYNTAX.toString(), "rdfs");
- prefixes.put("http://www.w3.org/2000/10/swap/grammar/bnf#", "cfg");
- prefixes.put("http://www.w3.org/2000/10/swap/grammar/n3#", "n3");
- prefixes.put("http://www.w3.org/2000/10/swap/list#", "list");
- prefixes.put("http://www.w3.org/2000/10/swap/pim/doc#", "doc");
- prefixes.put("http://www.w3.org/2002/07/owl#", "owl");
- prefixes.put("http://www.w3.org/2000/10/swap/log#", "log");
- prefixes.put("http://purl.org/dc/elements/1.1/", "dc");
- prefixes.put("http://www.w3.org/2001/XMLSchema#", "type");
+ /**
+ * Constructor.
+ *
+ * @param linkSet
+ * The set of links to write to the output stream.
+ * @param outputStream
+ * The output stream to write to.
+ * @throws IOException
+ * @throws IOException
+ */
+ public RdfN3WritingContentHandler(Graph linkset, OutputStream outputStream)
+ throws IOException {
+ super();
+ this.bw = new BufferedWriter(new OutputStreamWriter(outputStream));
+ this.context = new Context();
+ Map<String, String> prefixes = context.getPrefixes();
+ prefixes.put(RdfConstants.RDF_SCHEMA.toString(), "rdf");
+ prefixes.put(RdfConstants.RDF_SYNTAX.toString(), "rdfs");
+ prefixes.put("http://www.w3.org/2000/10/swap/grammar/bnf#", "cfg");
+ prefixes.put("http://www.w3.org/2000/10/swap/grammar/n3#", "n3");
+ prefixes.put("http://www.w3.org/2000/10/swap/list#", "list");
+ prefixes.put("http://www.w3.org/2000/10/swap/pim/doc#", "doc");
+ prefixes.put("http://www.w3.org/2002/07/owl#", "owl");
+ prefixes.put("http://www.w3.org/2000/10/swap/log#", "log");
+ prefixes.put("http://purl.org/dc/elements/1.1/", "dc");
+ prefixes.put("http://www.w3.org/2001/XMLSchema#", "type");
- for (Entry<String, String> entry : prefixes.entrySet()) {
- this.bw.append("@prefix ").append(entry.getValue()).append(": ")
- .append(entry.getKey()).append(".\n");
- }
- this.bw.append("@keywords a, is, of, has.\n");
+ for (Entry<String, String> entry : prefixes.entrySet()) {
+ this.bw.append("@prefix ").append(entry.getValue()).append(": ")
+ .append(entry.getKey()).append(".\n");
+ }
+ this.bw.append("@keywords a, is, of, has.\n");
- this.write(linkset);
- this.bw.flush();
- }
+ this.write(linkset);
+ this.bw.flush();
+ }
- @Override
- public void link(Graph source, Reference typeRef, Literal target) {
- try {
- this.bw.write("{");
- write(source);
- this.bw.write("} ");
- write(typeRef, this.context.getPrefixes());
- this.bw.write(" ");
- write(target);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- }
- }
+ @Override
+ public void link(Graph source, Reference typeRef, Literal target) {
+ try {
+ this.bw.write("{");
+ write(source);
+ this.bw.write("} ");
+ write(typeRef, this.context.getPrefixes());
+ this.bw.write(" ");
+ write(target);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+ }
- @Override
- public void link(Graph source, Reference typeRef, Reference target) {
- try {
- this.bw.write("{");
- write(source);
- this.bw.write("} ");
- write(typeRef, this.context.getPrefixes());
- this.bw.write(" ");
- write(target, this.context.getPrefixes());
- } catch (IOException e) {
- // TODO Auto-generated catch block
- }
- }
+ @Override
+ public void link(Graph source, Reference typeRef, Reference target) {
+ try {
+ this.bw.write("{");
+ write(source);
+ this.bw.write("} ");
+ write(typeRef, this.context.getPrefixes());
+ this.bw.write(" ");
+ write(target, this.context.getPrefixes());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+ }
- @Override
- public void link(Reference source, Reference typeRef, Literal target) {
- try {
- if (source.equals(this.precSource)) {
- if (typeRef.equals(this.precPredicate)) {
- this.bw.write(", ");
- } else {
- this.bw.write("; ");
- write(typeRef, this.context.getPrefixes());
- this.bw.write(" ");
- }
- } else {
- write(source, this.context.getPrefixes());
- this.bw.write(" ");
- write(typeRef, this.context.getPrefixes());
- this.bw.write(" ");
- }
- write(target);
- } catch (IOException e) {
- // TODO Auto-generated catch block
- }
- }
+ @Override
+ public void link(Reference source, Reference typeRef, Literal target) {
+ try {
+ if (source.equals(this.precSource)) {
+ if (typeRef.equals(this.precPredicate)) {
+ this.bw.write(", ");
+ } else {
+ this.bw.write("; ");
+ write(typeRef, this.context.getPrefixes());
+ this.bw.write(" ");
+ }
+ } else {
+ write(source, this.context.getPrefixes());
+ this.bw.write(" ");
+ write(typeRef, this.context.getPrefixes());
+ this.bw.write(" ");
+ }
+ write(target);
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+ }
- @Override
- public void link(Reference source, Reference typeRef, Reference target) {
- try {
- if (source.equals(this.precSource)) {
- this.writeExtraDot = false;
- if (typeRef.equals(this.precPredicate)) {
- this.bw.write(", ");
- } else {
- this.bw.write("; ");
- write(typeRef, this.context.getPrefixes());
- this.bw.write(" ");
- }
- } else {
- this.writeExtraDot = true;
- write(source, this.context.getPrefixes());
- this.bw.write(" ");
- write(typeRef, this.context.getPrefixes());
- this.bw.write(" ");
- }
- write(target, this.context.getPrefixes());
- } catch (IOException e) {
- // TODO Auto-generated catch block
- }
- }
+ @Override
+ public void link(Reference source, Reference typeRef, Reference target) {
+ try {
+ if (source.equals(this.precSource)) {
+ this.writeExtraDot = false;
+ if (typeRef.equals(this.precPredicate)) {
+ this.bw.write(", ");
+ } else {
+ this.bw.write("; ");
+ write(typeRef, this.context.getPrefixes());
+ this.bw.write(" ");
+ }
+ } else {
+ this.writeExtraDot = true;
+ write(source, this.context.getPrefixes());
+ this.bw.write(" ");
+ write(typeRef, this.context.getPrefixes());
+ this.bw.write(" ");
+ }
+ write(target, this.context.getPrefixes());
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ }
+ }
- /**
- * Write the representation of the given graph of links.
- *
- * @param linkset
- * the given graph of links.
- * @throws IOException
- * @throws IOException
- */
- private void write(Graph linkset) throws IOException {
- for (Link link : linkset) {
- if (link.hasReferenceSource()) {
- if (!link.getSourceAsReference().equals(this.precSource)) {
- this.bw.write(".\n");
- this.writeExtraDot = true;
- }
- if (link.hasReferenceTarget()) {
- link(link.getSourceAsReference(), link.getTypeRef(), link
- .getTargetAsReference());
- } else if (link.hasLiteralTarget()) {
- link(link.getSourceAsReference(), link.getTypeRef(), link
- .getTargetAsLiteral());
- } else if (link.hasLiteralTarget()) {
- // TODO Hande source as link.
- } else {
- // Error?
- }
- } else if (link.hasGraphSource()) {
- this.writeExtraDot = false;
- if (link.hasReferenceTarget()) {
- link(link.getSourceAsGraph(), link.getTypeRef(), link
- .getTargetAsReference());
- } else if (link.hasLiteralTarget()) {
- link(link.getSourceAsGraph(), link.getTypeRef(), link
- .getTargetAsLiteral());
- } else if (link.hasLiteralTarget()) {
- // TODO Hande source as link.
- } else {
- // Error?
- }
- this.bw.write(".\n");
- }
- this.precSource = link.getSourceAsReference();
- this.precPredicate = link.getTypeRef();
- }
- if (writeExtraDot) {
- this.bw.write(".\n");
- }
- }
+ /**
+ * Write the representation of the given graph of links.
+ *
+ * @param linkset
+ * the given graph of links.
+ * @throws IOException
+ * @throws IOException
+ */
+ private void write(Graph linkset) throws IOException {
+ for (Link link : linkset) {
+ if (link.hasReferenceSource()) {
+ if (!link.getSourceAsReference().equals(this.precSource)) {
+ this.bw.write(".\n");
+ this.writeExtraDot = true;
+ }
+ if (link.hasReferenceTarget()) {
+ link(link.getSourceAsReference(), link.getTypeRef(), link
+ .getTargetAsReference());
+ } else if (link.hasLiteralTarget()) {
+ link(link.getSourceAsReference(), link.getTypeRef(), link
+ .getTargetAsLiteral());
+ } else if (link.hasLiteralTarget()) {
+ // TODO Hande source as link.
+ } else {
+ // Error?
+ }
+ } else if (link.hasGraphSource()) {
+ this.writeExtraDot = false;
+ if (link.hasReferenceTarget()) {
+ link(link.getSourceAsGraph(), link.getTypeRef(), link
+ .getTargetAsReference());
+ } else if (link.hasLiteralTarget()) {
+ link(link.getSourceAsGraph(), link.getTypeRef(), link
+ .getTargetAsLiteral());
+ } else if (link.hasLiteralTarget()) {
+ // TODO Handle source as link.
+ } else {
+ // Error?
+ }
+ this.bw.write(".\n");
+ }
+ this.precSource = link.getSourceAsReference();
+ this.precPredicate = link.getTypeRef();
+ }
+ if (writeExtraDot) {
+ this.bw.write(".\n");
+ }
+ }
- /**
- * Writes the representation of a given reference to a byte stream.
- *
- * @param outputStream
- * The output stream.
- * @param reference
- * The reference to write.
- * @param prefixes
- * The map of known namespaces.
- * @throws IOException
- */
- private void write(Literal literal) throws IOException {
- // Write it as a string
- this.bw.write("\"");
- if (literal.getValue().contains("\n")) {
- this.bw.write("\"");
- this.bw.write("\"");
- this.bw.write(literal.getValue());
- this.bw.write("\"");
- this.bw.write("\"");
- } else {
- this.bw.write(literal.getValue());
- }
+ /**
+ * Writes the representation of a given reference to a byte stream.
+ *
+ * @param outputStream
+ * The output stream.
+ * @param reference
+ * The reference to write.
+ * @param prefixes
+ * The map of known namespaces.
+ * @throws IOException
+ */
+ private void write(Literal literal) throws IOException {
+ // Write it as a string
+ this.bw.write("\"");
+ if (literal.getValue().contains("\n")) {
+ this.bw.write("\"");
+ this.bw.write("\"");
+ this.bw.write(literal.getValue());
+ this.bw.write("\"");
+ this.bw.write("\"");
+ } else {
+ this.bw.write(literal.getValue());
+ }
- this.bw.write("\"");
- if (literal.getDatatypeRef() != null) {
- this.bw.write("^^");
- write(literal.getDatatypeRef(), context.getPrefixes());
- }
- if (literal.getLanguage() != null) {
- this.bw.write("@");
- this.bw.write(literal.getLanguage().toString());
- }
- }
+ this.bw.write("\"");
+ if (literal.getDatatypeRef() != null) {
+ this.bw.write("^^");
+ write(literal.getDatatypeRef(), context.getPrefixes());
+ }
+ if (literal.getLanguage() != null) {
+ this.bw.write("@");
+ this.bw.write(literal.getLanguage().toString());
+ }
+ }
- /**
- * Writes the representation of a given reference.
- *
- * @param reference
- * The reference to write.
- * @param prefixes
- * The map of known namespaces.
- * @throws IOException
- */
- private void write(Reference reference, Map<String, String> prefixes)
- throws IOException {
- String uri = reference.toString();
- if (LinkReference.isBlank(reference)) {
- this.bw.write(uri);
- } else {
- boolean found = false;
- for (Entry<String, String> entry : prefixes.entrySet()) {
- if (uri.startsWith(entry.getKey())) {
- found = true;
- this.bw.append(entry.getValue());
- this.bw.append(":");
- this.bw.append(uri.substring(entry.getKey().length()));
- break;
- }
- }
- if (!found) {
- this.bw.append("<");
- this.bw.append(uri);
- this.bw.append(">");
- }
- }
- }
+ /**
+ * Writes the representation of a given reference.
+ *
+ * @param reference
+ * The reference to write.
+ * @param prefixes
+ * The map of known namespaces.
+ * @throws IOException
+ */
+ private void write(Reference reference, Map<String, String> prefixes)
+ throws IOException {
+ String uri = reference.toString();
+ if (LinkReference.isBlank(reference)) {
+ this.bw.write(uri);
+ } else {
+ boolean found = false;
+ for (Entry<String, String> entry : prefixes.entrySet()) {
+ if (uri.startsWith(entry.getKey())) {
+ found = true;
+ this.bw.append(entry.getValue());
+ this.bw.append(":");
+ this.bw.append(uri.substring(entry.getKey().length()));
+ break;
+ }
+ }
+ if (!found) {
+ this.bw.append("<");
+ this.bw.append(uri);
+ this.bw.append(">");
+ }
+ }
+ }
}
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/StringToken.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/StringToken.java
index ee99cf9227..6922c42e0c 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/StringToken.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/StringToken.java
@@ -38,6 +38,8 @@
/**
* Represents a string of characters. This string could have a type and a
* language.
+ *
+ * @author Thierry Boileau
*/
class StringToken extends LexicalUnit {
/** Does this string contains at least a new line character? */
@@ -57,8 +59,8 @@ class StringToken extends LexicalUnit {
* @param context
* The parsing context.
*/
- public StringToken(RdfN3ParsingContentHandler contentHandler, Context context)
- throws IOException {
+ public StringToken(RdfN3ParsingContentHandler contentHandler,
+ Context context) throws IOException {
super(contentHandler, context);
multiLines = false;
this.parse();
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/Token.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/Token.java
index 08e63ff360..9d9eecfce9 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/Token.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/Token.java
@@ -37,65 +37,67 @@
/**
* Represents a still unidentified N3 token.
+ *
+ * @author Thierry Boileau
*/
class Token extends LexicalUnit {
- /**
- * Constructor with arguments.
- *
- * @param contentHandler
- * The document's parent handler.
- * @param context
- * The parsing context.
- */
- public Token(RdfN3ParsingContentHandler contentHandler, Context context)
- throws IOException {
- super(contentHandler, context);
- this.parse();
- }
+ /**
+ * Constructor with arguments.
+ *
+ * @param contentHandler
+ * The document's parent handler.
+ * @param context
+ * The parsing context.
+ */
+ public Token(RdfN3ParsingContentHandler contentHandler, Context context)
+ throws IOException {
+ super(contentHandler, context);
+ this.parse();
+ }
- /**
- * Constructor with value.
- *
- * @param value
- * The value of the current lexical unit.
- */
- public Token(String value) {
- super(value);
- }
+ /**
+ * Constructor with value.
+ *
+ * @param value
+ * The value of the current lexical unit.
+ */
+ public Token(String value) {
+ super(value);
+ }
- @Override
- public void parse() throws IOException {
- int c;
- do {
- c = getContentHandler().step();
- } while (c != RdfN3ParsingContentHandler.EOF
- && !RdfN3ParsingContentHandler.isDelimiter(c));
- setValue(getContentHandler().getCurrentToken());
- }
+ @Override
+ public void parse() throws IOException {
+ int c;
+ do {
+ c = getContentHandler().step();
+ } while (c != RdfN3ParsingContentHandler.EOF
+ && !RdfN3ParsingContentHandler.isDelimiter(c));
+ setValue(getContentHandler().getCurrentToken());
+ }
- @Override
- public Object resolve() {
- Object result = null;
- if (getContext().isQName(getValue())) {
- result = (getContext() != null) ? getContext().resolve(getValue())
- : getValue();
- } else {
- // Must be a literal
- if (getValue().charAt(0) > '0' && getValue().charAt(0) < '9') {
- if (getValue().contains(".")) {
- // Consider it as a float
- result = new Literal(getValue(),
- RdfConstants.XML_SCHEMA_TYPE_FLOAT);
- } else {
- // Consider it as an integer
- result = new Literal(getValue(),
- RdfConstants.XML_SCHEMA_TYPE_INTEGER);
- }
- } else {
- // TODO What kind of literal?
- }
- }
- return result;
- }
+ @Override
+ public Object resolve() {
+ Object result = null;
+ if (getContext().isQName(getValue())) {
+ result = (getContext() != null) ? getContext().resolve(getValue())
+ : getValue();
+ } else {
+ // Must be a literal
+ if (getValue().charAt(0) > '0' && getValue().charAt(0) < '9') {
+ if (getValue().contains(".")) {
+ // Consider it as a float
+ result = new Literal(getValue(),
+ RdfConstants.XML_SCHEMA_TYPE_FLOAT);
+ } else {
+ // Consider it as an integer
+ result = new Literal(getValue(),
+ RdfConstants.XML_SCHEMA_TYPE_INTEGER);
+ }
+ } else {
+ // TODO What kind of literal?
+ }
+ }
+ return result;
+ }
}
\ No newline at end of file
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/UriToken.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/UriToken.java
index aab5170289..ff5737d905 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/UriToken.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/n3/UriToken.java
@@ -36,6 +36,8 @@
/**
* Represents a URI token inside a RDF N3 document.
+ *
+ * @author Thierry Boileau
*/
class UriToken extends LexicalUnit {
/**
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/ContentReader.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/ContentReader.java
new file mode 100644
index 0000000000..0cfb970367
--- /dev/null
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/ContentReader.java
@@ -0,0 +1,695 @@
+/**
+ * Copyright 2005-2009 Noelios Technologies.
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL 1.0 (the
+ * "Licenses"). You can select the license that you prefer but you may not use
+ * this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0.html
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1.php
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0.php
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://www.noelios.com/products/restlet-engine
+ *
+ * Restlet is a registered trademark of Noelios Technologies.
+ */
+
+package org.restlet.ext.rdf.internal.xml;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.restlet.data.Language;
+import org.restlet.data.Reference;
+import org.restlet.ext.rdf.GraphHandler;
+import org.restlet.ext.rdf.LinkReference;
+import org.restlet.ext.rdf.Literal;
+import org.restlet.ext.rdf.RdfRepresentation;
+import org.restlet.ext.rdf.internal.RdfConstants;
+import org.restlet.representation.Representation;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Content reader part.
+ *
+ * @author Thierry Boileau
+ */
+class ContentReader extends DefaultHandler {
+ public enum State {
+ LITERAL, NONE, OBJECT, PREDICATE, SUBJECT
+ }
+
+ /** Increment used to identify inner blank nodes. */
+ private static int blankNodeId = 0;
+
+ /**
+ * Returns the identifier of a new blank node.
+ *
+ * @return The identifier of a new blank node.
+ */
+ private static String newBlankNodeId() {
+ return "#_bn" + blankNodeId++;
+ }
+
+ /** The value of the "base" URI. */
+ private ScopedProperty<Reference> base;
+
+ /** Container for string content. */
+ private StringBuilder builder;
+
+ /** Indicates if the string content must be consumed. */
+ private boolean consumeContent;
+
+ /** Current data type. */
+ private String currentDataType;
+
+ /** Current language. */
+ private ScopedProperty<Language> language;
+
+ /** Current object. */
+ private Object currentObject;
+
+ /** Current predicate. */
+ private Reference currentPredicate;
+
+ /** The graph handler to call when a link is detected. */
+ private GraphHandler graphHandler;
+
+ /** Used to get the content of XMl literal. */
+ private int nodeDepth;
+
+ /** The list of known prefixes. */
+ private Map<String, String> prefixes;
+
+ /**
+ * True if {@link RdfRepresentation#RDF_SYNTAX} is the default namespace.
+ */
+ private boolean rdfDefaultNamespace;
+
+ /** Used when a statement must be reified. */
+ private Reference reifiedRef;
+
+ /** Heap of states. */
+ private List<ContentReader.State> states;
+
+ /** Heap of subjects. */
+ private List<Reference> subjects;
+
+ /**
+ *
+ *
+ * @param graphHandler
+ *
+ */
+ /**
+ * Constructor.
+ *
+ * @param graphHandler
+ * The graph handler to call when a link is detected.
+ * @param representation
+ * The input representation.
+ */
+ public ContentReader(GraphHandler graphHandler,
+ Representation representation) {
+ super();
+ this.graphHandler = graphHandler;
+ this.base = new ScopedProperty<Reference>();
+ this.language = new ScopedProperty<Language>();
+ if (representation.getIdentifier() != null) {
+ this.base.add(representation.getIdentifier().getTargetRef());
+ this.base.incrDepth();
+ }
+ if (representation.getLanguages().size() == 1) {
+ this.language.add(representation.getLanguages().get(1));
+ this.language.incrDepth();
+ }
+ }
+
+ @Override
+ public void characters(char[] ch, int start, int length)
+ throws SAXException {
+ if (consumeContent) {
+ builder.append(ch, start, length);
+ }
+ }
+
+ /**
+ * Returns true if the given qualified name is in the RDF namespace and is
+ * equal to the given local name.
+ *
+ * @param localName
+ * The local name to compare to.
+ * @param qName
+ * The qualified name
+ */
+ private boolean checkRdfQName(String localName, String qName) {
+ boolean result = qName.equals("rdf:" + localName);
+ if (!result) {
+ int index = qName.indexOf(":");
+ // The qualified name has no prefix.
+ result = rdfDefaultNamespace && (index == -1)
+ && localName.equals(qName);
+ }
+
+ return result;
+ }
+
+ @Override
+ public void endDocument() throws SAXException {
+ this.builder = null;
+ this.currentObject = null;
+ this.currentPredicate = null;
+ this.graphHandler = null;
+ this.prefixes.clear();
+ this.prefixes = null;
+ this.states.clear();
+ this.states = null;
+ this.subjects.clear();
+ this.subjects = null;
+ this.nodeDepth = 0;
+ }
+
+ @Override
+ public void endElement(String uri, String localName, String name)
+ throws SAXException {
+ ContentReader.State state = popState();
+
+ if (state == State.SUBJECT) {
+ popSubject();
+ } else if (state == State.PREDICATE) {
+ if (this.consumeContent) {
+ link(getCurrentSubject(), this.currentPredicate, getLiteral(
+ builder.toString(), null, this.language.getValue()));
+ this.consumeContent = false;
+ }
+ } else if (state == State.OBJECT) {
+ } else if (state == State.LITERAL) {
+ if (nodeDepth == 0) {
+ // End of the XML literal
+ link(getCurrentSubject(), this.currentPredicate, getLiteral(
+ builder.toString(), this.currentDataType, this.language
+ .getValue()));
+ } else {
+ // Still gleaning the content of an XML literal
+ // Glean the XML content
+ this.builder.append("</");
+ if (uri != null && !"".equals(uri)) {
+ this.builder.append(uri).append(":");
+ }
+ this.builder.append(localName).append(">");
+ nodeDepth--;
+ pushState(state);
+ }
+ }
+ this.base.decrDepth();
+ this.language.decrDepth();
+ }
+
+ @Override
+ public void endPrefixMapping(String prefix) throws SAXException {
+ this.prefixes.remove(prefix);
+ }
+
+ /**
+ * Returns the state at the top of the heap.
+ *
+ * @return The state at the top of the heap.
+ */
+ private ContentReader.State getCurrentState() {
+ ContentReader.State result = null;
+ int size = this.states.size();
+
+ if (size > 0) {
+ result = this.states.get(size - 1);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the subject at the top of the heap.
+ *
+ * @return The subject at the top of the heap.
+ */
+ private Reference getCurrentSubject() {
+ Reference result = null;
+ int size = this.subjects.size();
+
+ if (size > 0) {
+ result = this.subjects.get(size - 1);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns a Literal object according to the given parameters.
+ *
+ * @param value
+ * The value of the literal.
+ * @param datatype
+ * The datatype of the literal.
+ * @param language
+ * The language of the literal.
+ * @return A Literal object
+ */
+ private Literal getLiteral(String value, String datatype, Language language) {
+ Literal literal = new Literal(value);
+ if (datatype != null) {
+ literal.setDatatypeRef(new Reference(datatype));
+ }
+ if (language != null) {
+ literal.setLanguage(language);
+ }
+ return literal;
+ }
+
+ /**
+ * A new statement has been detected with the current subject, predicate and
+ * object.
+ */
+ private void link() {
+ Reference currentSubject = getCurrentSubject();
+ if (currentSubject instanceof Reference) {
+ if (this.currentObject instanceof Reference) {
+ link(currentSubject, this.currentPredicate,
+ (Reference) this.currentObject);
+ } else if (this.currentObject instanceof Literal) {
+ link(currentSubject, this.currentPredicate,
+ (Literal) this.currentObject);
+ } else {
+ // TODO Error.
+ }
+ } else {
+ // TODO Error.
+ }
+ }
+
+ /**
+ * Creates a statement and reify it, if necessary.
+ *
+ * @param subject
+ * The subject of the statement.
+ * @param predicate
+ * The predicate of the statement.
+ * @param object
+ * The object of the statement.
+ */
+ private void link(Reference subject, Reference predicate, Literal object) {
+ this.graphHandler.link(subject, predicate, object);
+ if (this.reifiedRef != null) {
+ this.graphHandler.link(this.reifiedRef,
+ RdfConstants.PREDICATE_SUBJECT, subject);
+ this.graphHandler.link(this.reifiedRef,
+ RdfConstants.PREDICATE_PREDICATE, predicate);
+ this.graphHandler.link(this.reifiedRef,
+ RdfConstants.PREDICATE_OBJECT, object);
+ this.graphHandler.link(reifiedRef, RdfConstants.PREDICATE_TYPE,
+ RdfConstants.PREDICATE_STATEMENT);
+ this.reifiedRef = null;
+ }
+ }
+
+ /**
+ * Creates a statement and reify it, if necessary.
+ *
+ * @param subject
+ * The subject of the statement.
+ * @param predicate
+ * The predicate of the statement.
+ * @param object
+ * The object of the statement.
+ */
+ private void link(Reference subject, Reference predicate, Reference object) {
+ this.graphHandler.link(subject, predicate, object);
+
+ if (this.reifiedRef != null) {
+ this.graphHandler.link(this.reifiedRef,
+ RdfConstants.PREDICATE_SUBJECT, subject);
+ this.graphHandler.link(this.reifiedRef,
+ RdfConstants.PREDICATE_PREDICATE, predicate);
+ this.graphHandler.link(this.reifiedRef,
+ RdfConstants.PREDICATE_OBJECT, object);
+ this.graphHandler.link(reifiedRef, RdfConstants.PREDICATE_TYPE,
+ RdfConstants.PREDICATE_STATEMENT);
+ this.reifiedRef = null;
+ }
+ }
+
+ /**
+ * Returns the RDF URI of the given node represented by its namespace uri,
+ * local name, name, and attributes. It also generates the available
+ * statements, thanks to some shortcuts provided by the RDF XML syntax.
+ *
+ * @param uri
+ * @param localName
+ * @param name
+ * @param attributes
+ * @return The RDF URI of the given node.
+ */
+ private Reference parseNode(String uri, String localName, String name,
+ Attributes attributes) {
+ Reference result = null;
+ // Stores the arcs
+ List<String[]> arcs = new ArrayList<String[]>();
+ boolean found = false;
+ if (attributes.getIndex("xml:base") != -1) {
+ this.base.add(new Reference(attributes.getValue("xml:base")));
+ }
+ // Get the RDF URI of this node
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String qName = attributes.getQName(i);
+ if (checkRdfQName("about", qName)) {
+ found = true;
+ result = resolve(attributes.getValue(i), false);
+ } else if (checkRdfQName("nodeID", qName)) {
+ found = true;
+ result = LinkReference.createBlank(attributes.getValue(i));
+ } else if (checkRdfQName("ID", qName)) {
+ found = true;
+ result = resolve(attributes.getValue(i), true);
+ } else if ("xml:lang".equals(qName)) {
+ this.language.add(Language.valueOf(attributes.getValue(i)));
+ } else if ("xml:base".equals(qName)) {
+ // Already stored
+ } else {
+ if (!qName.startsWith("xmlns")) {
+ String[] arc = { qName, attributes.getValue(i) };
+ arcs.add(arc);
+ }
+ }
+ }
+ if (!found) {
+ // Blank node with no given ID
+ result = LinkReference.createBlank(ContentReader.newBlankNodeId());
+ }
+
+ // Create the available statements
+ if (!checkRdfQName("Description", name)) {
+ // Handle typed node
+ this.graphHandler.link(result, RdfConstants.PREDICATE_TYPE,
+ resolve(uri, name));
+ }
+ for (String[] arc : arcs) {
+ this.graphHandler.link(result, resolve(null, arc[0]), getLiteral(
+ arc[1], null, this.language.getValue()));
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the state at the top of the heap and removes it from the heap.
+ *
+ * @return The state at the top of the heap.
+ */
+ private ContentReader.State popState() {
+ ContentReader.State result = null;
+ int size = this.states.size();
+
+ if (size > 0) {
+ result = this.states.remove(size - 1);
+ }
+
+ return result;
+ }
+
+ /**
+ * Returns the subject at the top of the heap and removes it from the heap.
+ *
+ * @return The subject at the top of the heap.
+ */
+ private Reference popSubject() {
+ Reference result = null;
+ int size = this.subjects.size();
+
+ if (size > 0) {
+ result = this.subjects.remove(size - 1);
+ }
+
+ return result;
+ }
+
+ /**
+ * Adds a new state at the top of the heap.
+ *
+ * @param state
+ * The state to add.
+ */
+ private void pushState(ContentReader.State state) {
+ this.states.add(state);
+ }
+
+ /**
+ * Adds a new subject at the top of the heap.
+ *
+ * @param subject
+ * The subject to add.
+ */
+ private void pushSubject(Reference subject) {
+ this.subjects.add(subject);
+ }
+
+ /**
+ * Returns the absolute reference for a given value. If this value is not an
+ * absolute URI, then the base URI is used.
+ *
+ * @param value
+ * The value.
+ * @param fragment
+ * True if the value is a fragment to add to the base reference.
+ * @return Returns the absolute reference for a given value.
+ */
+ private Reference resolve(String value, boolean fragment) {
+ Reference result = null;
+
+ if (fragment) {
+ result = new Reference(this.base.getValue());
+ result.setFragment(value);
+ } else {
+ result = new Reference(value);
+ if (result.isRelative()) {
+ result = new Reference(this.base.getValue(), value);
+ }
+ }
+ return result.getTargetRef();
+ }
+
+ /**
+ * Returns the absolute reference of a parsed element according to its URI,
+ * qualified name. In case the base URI is null or empty, then an attempt is
+ * made to look for the mapped URI according to the qName.
+ *
+ * @param uri
+ * The base URI.
+ * @param qName
+ * The qualified name of the parsed element.
+ * @return Returns the absolute reference of a parsed element.
+ */
+ private Reference resolve(String uri, String qName) {
+ Reference result = null;
+
+ int index = qName.indexOf(":");
+ String prefix = null;
+ String localName = null;
+ if (index != -1) {
+ prefix = qName.substring(0, index);
+ localName = qName.substring(index + 1);
+ } else {
+ localName = qName;
+ prefix = "";
+ }
+
+ if (uri != null && !"".equals(uri)) {
+ if (!uri.endsWith("#") && !uri.endsWith("/")) {
+ result = new Reference(uri + "/" + localName);
+ } else {
+ result = new Reference(uri + localName);
+ }
+ } else {
+ String baseUri = this.prefixes.get(prefix);
+ if (baseUri != null) {
+ result = new Reference(baseUri + localName);
+ }
+ }
+
+ return (result == null) ? null : result.getTargetRef();
+ }
+
+ @Override
+ public void startDocument() throws SAXException {
+ this.prefixes = new HashMap<String, String>();
+ this.builder = new StringBuilder();
+ this.states = new ArrayList<ContentReader.State>();
+ this.subjects = new ArrayList<Reference>();
+ nodeDepth = 0;
+ pushState(State.NONE);
+ }
+
+ @Override
+ public void startElement(String uri, String localName, String name,
+ Attributes attributes) throws SAXException {
+ ContentReader.State state = getCurrentState();
+ this.base.incrDepth();
+ this.language.incrDepth();
+ if (!this.consumeContent && this.builder != null) {
+ this.builder = null;
+ }
+ if (state == State.NONE) {
+ if (checkRdfQName("RDF", name)) {
+ // Top element
+ String base = attributes.getValue("xml:base");
+ if (base != null) {
+ this.base.add(new Reference(base));
+ }
+ } else {
+ // Parse the current subject
+ pushSubject(parseNode(uri, localName, name, attributes));
+ pushState(State.SUBJECT);
+ }
+ } else if (state == State.SUBJECT) {
+ // Parse the current predicate
+ List<String[]> arcs = new ArrayList<String[]>();
+ pushState(State.PREDICATE);
+ this.consumeContent = true;
+ Reference currentSubject = getCurrentSubject();
+ this.currentPredicate = resolve(uri, name);
+ Reference currentObject = null;
+ for (int i = 0; i < attributes.getLength(); i++) {
+ String qName = attributes.getQName(i);
+ if (checkRdfQName("resource", qName)) {
+ this.consumeContent = false;
+ currentObject = resolve(attributes.getValue(i), false);
+ popState();
+ pushState(State.OBJECT);
+ } else if (checkRdfQName("datatype", qName)) {
+ // The object is a literal
+ this.consumeContent = true;
+ popState();
+ pushState(State.LITERAL);
+ this.currentDataType = attributes.getValue(i);
+ } else if (checkRdfQName("parseType", qName)) {
+ String value = attributes.getValue(i);
+ if ("Literal".equals(value)) {
+ this.consumeContent = true;
+ // The object is an XML literal
+ popState();
+ pushState(State.LITERAL);
+ this.currentDataType = RdfConstants.RDF_SYNTAX
+ + "XMLLiteral";
+ nodeDepth = 0;
+ } else if ("Resource".equals(value)) {
+ this.consumeContent = false;
+ // Create a new blank node
+ currentObject = LinkReference.createBlank(ContentReader
+ .newBlankNodeId());
+ popState();
+ pushState(State.SUBJECT);
+ pushSubject(currentObject);
+ } else {
+ this.consumeContent = false;
+ // Error
+ }
+ } else if (checkRdfQName("nodeID", qName)) {
+ this.consumeContent = false;
+ currentObject = LinkReference.createBlank(attributes
+ .getValue(i));
+ popState();
+ pushState(State.SUBJECT);
+ pushSubject(currentObject);
+ } else if (checkRdfQName("ID", qName)) {
+ // Reify the statement
+ reifiedRef = resolve(attributes.getValue(i), true);
+ } else if ("xml:lang".equals(qName)) {
+ this.language.add(Language.valueOf(attributes.getValue(i)));
+ } else {
+ if (!qName.startsWith("xmlns")) {
+ // Add arcs.
+ String[] arc = { qName, attributes.getValue(i) };
+ arcs.add(arc);
+ }
+ }
+ }
+ if (currentObject != null) {
+ link(currentSubject, this.currentPredicate, currentObject);
+ }
+
+ if (!arcs.isEmpty()) {
+ // Create arcs that starts from a blank node and ends to
+ // literal values. This blank node is the object of the
+ // current statement.
+
+ boolean found = false;
+ Reference blankNode = LinkReference.createBlank(ContentReader
+ .newBlankNodeId());
+ for (String[] arc : arcs) {
+ Reference pRef = resolve(null, arc[0]);
+ // Silently remove unrecognized attributes
+ if (pRef != null) {
+ found = true;
+ this.graphHandler.link(blankNode, pRef, new Literal(
+ arc[1]));
+ }
+ }
+ if (found) {
+ link(currentSubject, this.currentPredicate, blankNode);
+ popState();
+ pushState(State.OBJECT);
+ }
+ }
+ if (this.consumeContent) {
+ builder = new StringBuilder();
+ }
+ } else if (state == State.PREDICATE) {
+ this.consumeContent = false;
+ // Parse the current object, create the current link
+ Reference object = parseNode(uri, localName, name, attributes);
+ this.currentObject = object;
+ link();
+ pushSubject(object);
+ pushState(State.SUBJECT);
+ } else if (state == State.OBJECT) {
+ } else if (state == State.LITERAL) {
+ // Glean the XML content
+ nodeDepth++;
+ this.builder.append("<");
+ if (uri != null && !"".equals(uri)) {
+ this.builder.append(uri).append(":");
+ }
+ this.builder.append(localName).append(">");
+ }
+ }
+
+ @Override
+ public void startPrefixMapping(String prefix, String uri)
+ throws SAXException {
+ this.rdfDefaultNamespace = this.rdfDefaultNamespace
+ || ((prefix == null || "".equals(prefix)
+ && RdfConstants.RDF_SYNTAX.toString(true, true).equals(
+ uri)));
+
+ if (!uri.endsWith("#") && !uri.endsWith("/")) {
+ this.prefixes.put(prefix, uri + "/");
+ } else {
+ this.prefixes.put(prefix, uri);
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/RdfXmlParsingContentHandler.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/RdfXmlParsingContentHandler.java
index c5309f9bc0..7629798903 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/RdfXmlParsingContentHandler.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/RdfXmlParsingContentHandler.java
@@ -1,839 +1,120 @@
+/**
+ * Copyright 2005-2009 Noelios Technologies.
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL 1.0 (the
+ * "Licenses"). You can select the license that you prefer but you may not use
+ * this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0.html
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1.php
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0.php
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://www.noelios.com/products/restlet-engine
+ *
+ * Restlet is a registered trademark of Noelios Technologies.
+ */
+
package org.restlet.ext.rdf.internal.xml;
import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.restlet.data.Language;
import org.restlet.data.Reference;
import org.restlet.ext.rdf.Graph;
import org.restlet.ext.rdf.GraphHandler;
-import org.restlet.ext.rdf.LinkReference;
import org.restlet.ext.rdf.Literal;
-import org.restlet.ext.rdf.RdfRepresentation;
-import org.restlet.ext.rdf.internal.RdfConstants;
import org.restlet.representation.Representation;
import org.restlet.representation.SaxRepresentation;
-import org.xml.sax.Attributes;
-import org.xml.sax.SAXException;
-import org.xml.sax.helpers.DefaultHandler;
+/**
+ * Handler of RDF content according to the RDF/XML format.
+ *
+ * @author Thierry Boileau
+ */
public class RdfXmlParsingContentHandler extends GraphHandler {
- /**
- * Content reader part.
- */
- private static class ContentReader extends DefaultHandler {
- public enum State {
- LITERAL, NONE, OBJECT, PREDICATE, SUBJECT
- }
-
- /** Increment used to identify inner blank nodes. */
- private static int blankNodeId = 0;
-
- /**
- * Returns the identifier of a new blank node.
- *
- * @return The identifier of a new blank node.
- */
- private static String newBlankNodeId() {
- return "#_bn" + blankNodeId++;
- }
-
- /** The value of the "base" URI. */
- private ScopedProperty<Reference> base;
-
- /** Container for string content. */
- private StringBuilder builder;
-
- /** Indicates if the string content must be consumed. */
- private boolean consumeContent;
-
- /** Current data type. */
- private String currentDataType;
-
- /** Current language. */
- private ScopedProperty<Language> language;
-
- /** Current object. */
- private Object currentObject;
-
- /** Current predicate. */
- private Reference currentPredicate;
-
- /** The graph handler to call when a link is detected. */
- private GraphHandler graphHandler;
-
- /** Used to get the content of XMl literal. */
- private int nodeDepth;
-
- /** The list of known prefixes. */
- private Map<String, String> prefixes;
-
- /**
- * True if {@link RdfRepresentation#RDF_SYNTAX} is the default
- * namespace.
- */
- private boolean rdfDefaultNamespace;
-
- /** Used when a statement must be reified. */
- private Reference reifiedRef;
-
- /** Heap of states. */
- private List<State> states;
-
- /** Heap of subjects. */
- private List<Reference> subjects;
-
- /**
- *
- *
- * @param graphHandler
- *
- */
- /**
- * Constructor.
- *
- * @param graphHandler
- * The graph handler to call when a link is detected.
- * @param representation
- * The input representation.
- */
- public ContentReader(GraphHandler graphHandler,
- Representation representation) {
- super();
- this.graphHandler = graphHandler;
- this.base = new ScopedProperty<Reference>();
- this.language = new ScopedProperty<Language>();
- if (representation.getIdentifier() != null) {
- this.base.add(representation.getIdentifier().getTargetRef());
- this.base.incrDepth();
- }
- if (representation.getLanguages().size() == 1) {
- this.language.add(representation.getLanguages().get(1));
- this.language.incrDepth();
- }
- }
-
- @Override
- public void characters(char[] ch, int start, int length)
- throws SAXException {
- if (consumeContent) {
- builder.append(ch, start, length);
- }
- }
-
- /**
- * Returns true if the given qualified name is in the RDF namespace and
- * is equal to the given local name.
- *
- * @param localName
- * The local name to compare to.
- * @param qName
- * The qualified name
- */
- private boolean checkRdfQName(String localName, String qName) {
- boolean result = qName.equals("rdf:" + localName);
- if (!result) {
- int index = qName.indexOf(":");
- // The qualified name has no prefix.
- result = rdfDefaultNamespace && (index == -1)
- && localName.equals(qName);
- }
-
- return result;
- }
-
- @Override
- public void endDocument() throws SAXException {
- this.builder = null;
- this.currentObject = null;
- this.currentPredicate = null;
- this.graphHandler = null;
- this.prefixes.clear();
- this.prefixes = null;
- this.states.clear();
- this.states = null;
- this.subjects.clear();
- this.subjects = null;
- this.nodeDepth = 0;
- }
-
- @Override
- public void endElement(String uri, String localName, String name)
- throws SAXException {
- State state = popState();
-
- if (state == State.SUBJECT) {
- popSubject();
- } else if (state == State.PREDICATE) {
- if (this.consumeContent) {
- link(getCurrentSubject(), this.currentPredicate,
- getLiteral(builder.toString(), null, this.language
- .getValue()));
- this.consumeContent = false;
- }
- } else if (state == State.OBJECT) {
- } else if (state == State.LITERAL) {
- if (nodeDepth == 0) {
- // End of the XML literal
- link(getCurrentSubject(), this.currentPredicate,
- getLiteral(builder.toString(),
- this.currentDataType, this.language
- .getValue()));
- } else {
- // Still gleaning the content of an XML literal
- // Glean the XML content
- this.builder.append("</");
- if (uri != null && !"".equals(uri)) {
- this.builder.append(uri).append(":");
- }
- this.builder.append(localName).append(">");
- nodeDepth--;
- pushState(state);
- }
- }
- this.base.decrDepth();
- this.language.decrDepth();
- }
-
- @Override
- public void endPrefixMapping(String prefix) throws SAXException {
- this.prefixes.remove(prefix);
- }
-
- /**
- * Returns the state at the top of the heap.
- *
- * @return The state at the top of the heap.
- */
- private State getCurrentState() {
- State result = null;
- int size = this.states.size();
-
- if (size > 0) {
- result = this.states.get(size - 1);
- }
-
- return result;
- }
-
- /**
- * Returns the subject at the top of the heap.
- *
- * @return The subject at the top of the heap.
- */
- private Reference getCurrentSubject() {
- Reference result = null;
- int size = this.subjects.size();
-
- if (size > 0) {
- result = this.subjects.get(size - 1);
- }
-
- return result;
- }
-
- /**
- * Returns a Literal object according to the given parameters.
- *
- * @param value
- * The value of the literal.
- * @param datatype
- * The datatype of the literal.
- * @param language
- * The language of the literal.
- * @return A Literal object
- */
- private Literal getLiteral(String value, String datatype,
- Language language) {
- Literal literal = new Literal(value);
- if (datatype != null) {
- literal.setDatatypeRef(new Reference(datatype));
- }
- if (language != null) {
- literal.setLanguage(language);
- }
- return literal;
- }
-
- /**
- * A new statement has been detected with the current subject, predicate
- * and object.
- */
- private void link() {
- Reference currentSubject = getCurrentSubject();
- if (currentSubject instanceof Reference) {
- if (this.currentObject instanceof Reference) {
- link(currentSubject, this.currentPredicate,
- (Reference) this.currentObject);
- } else if (this.currentObject instanceof Literal) {
- link(currentSubject, this.currentPredicate,
- (Literal) this.currentObject);
- } else {
- // TODO Error.
- }
- } else {
- // TODO Error.
- }
- }
-
- /**
- * Creates a statement and reify it, if necessary.
- *
- * @param subject
- * The subject of the statement.
- * @param predicate
- * The predicate of the statement.
- * @param object
- * The object of the statement.
- */
- private void link(Reference subject, Reference predicate, Literal object) {
- this.graphHandler.link(subject, predicate, object);
- if (this.reifiedRef != null) {
- this.graphHandler.link(this.reifiedRef,
- RdfConstants.PREDICATE_SUBJECT, subject);
- this.graphHandler.link(this.reifiedRef,
- RdfConstants.PREDICATE_PREDICATE, predicate);
- this.graphHandler.link(this.reifiedRef,
- RdfConstants.PREDICATE_OBJECT, object);
- this.graphHandler.link(reifiedRef, RdfConstants.PREDICATE_TYPE,
- RdfConstants.PREDICATE_STATEMENT);
- this.reifiedRef = null;
- }
- }
-
- /**
- * Creates a statement and reify it, if necessary.
- *
- * @param subject
- * The subject of the statement.
- * @param predicate
- * The predicate of the statement.
- * @param object
- * The object of the statement.
- */
- private void link(Reference subject, Reference predicate,
- Reference object) {
- this.graphHandler.link(subject, predicate, object);
-
- if (this.reifiedRef != null) {
- this.graphHandler.link(this.reifiedRef,
- RdfConstants.PREDICATE_SUBJECT, subject);
- this.graphHandler.link(this.reifiedRef,
- RdfConstants.PREDICATE_PREDICATE, predicate);
- this.graphHandler.link(this.reifiedRef,
- RdfConstants.PREDICATE_OBJECT, object);
- this.graphHandler.link(reifiedRef, RdfConstants.PREDICATE_TYPE,
- RdfConstants.PREDICATE_STATEMENT);
- this.reifiedRef = null;
- }
- }
-
- /**
- * Returns the RDF URI of the given node represented by its namespace
- * uri, local name, name, and attributes. It also generates the
- * available statements, thanks to some shortcuts provided by the RDF
- * XML syntax.
- *
- * @param uri
- * @param localName
- * @param name
- * @param attributes
- * @return The RDF URI of the given node.
- */
- private Reference parseNode(String uri, String localName, String name,
- Attributes attributes) {
- Reference result = null;
- // Stores the arcs
- List<String[]> arcs = new ArrayList<String[]>();
- boolean found = false;
- if (attributes.getIndex("xml:base") != -1) {
- this.base.add(new Reference(attributes.getValue("xml:base")));
- }
- // Get the RDF URI of this node
- for (int i = 0; i < attributes.getLength(); i++) {
- String qName = attributes.getQName(i);
- if (checkRdfQName("about", qName)) {
- found = true;
- result = resolve(attributes.getValue(i), false);
- } else if (checkRdfQName("nodeID", qName)) {
- found = true;
- result = LinkReference.createBlank(attributes.getValue(i));
- } else if (checkRdfQName("ID", qName)) {
- found = true;
- result = resolve(attributes.getValue(i), true);
- } else if ("xml:lang".equals(qName)) {
- this.language.add(Language.valueOf(attributes.getValue(i)));
- } else if ("xml:base".equals(qName)) {
- // Already stored
- } else {
- if (!qName.startsWith("xmlns")) {
- String[] arc = { qName, attributes.getValue(i) };
- arcs.add(arc);
- }
- }
- }
- if (!found) {
- // Blank node with no given ID
- result = LinkReference.createBlank(ContentReader
- .newBlankNodeId());
- }
-
- // Create the available statements
- if (!checkRdfQName("Description", name)) {
- // Handle typed node
- this.graphHandler.link(result, RdfConstants.PREDICATE_TYPE,
- resolve(uri, name));
- }
- for (String[] arc : arcs) {
- this.graphHandler.link(result, resolve(null, arc[0]),
- getLiteral(arc[1], null, this.language.getValue()));
- }
-
- return result;
- }
-
- /**
- * Returns the state at the top of the heap and removes it from the
- * heap.
- *
- * @return The state at the top of the heap.
- */
- private State popState() {
- State result = null;
- int size = this.states.size();
-
- if (size > 0) {
- result = this.states.remove(size - 1);
- }
-
- return result;
- }
-
- /**
- * Returns the subject at the top of the heap and removes it from the
- * heap.
- *
- * @return The subject at the top of the heap.
- */
- private Reference popSubject() {
- Reference result = null;
- int size = this.subjects.size();
-
- if (size > 0) {
- result = this.subjects.remove(size - 1);
- }
-
- return result;
- }
-
- /**
- * Adds a new state at the top of the heap.
- *
- * @param state
- * The state to add.
- */
- private void pushState(State state) {
- this.states.add(state);
- }
-
- /**
- * Adds a new subject at the top of the heap.
- *
- * @param subject
- * The subject to add.
- */
- private void pushSubject(Reference subject) {
- this.subjects.add(subject);
- }
-
- /**
- * Returns the absolute reference for a given value. If this value is
- * not an absolute URI, then the base URI is used.
- *
- * @param value
- * The value.
- * @param fragment
- * True if the value is a fragment to add to the base
- * reference.
- * @return Returns the absolute reference for a given value.
- */
- private Reference resolve(String value, boolean fragment) {
- Reference result = null;
-
- if (fragment) {
- result = new Reference(this.base.getValue());
- result.setFragment(value);
- } else {
- result = new Reference(value);
- if (result.isRelative()) {
- result = new Reference(this.base.getValue(), value);
- }
- }
- return result.getTargetRef();
- }
-
- /**
- * Returns the absolute reference of a parsed element according to its
- * URI, qualified name. In case the base URI is null or empty, then an
- * attempt is made to look for the mapped URI according to the qName.
- *
- * @param uri
- * The base URI.
- * @param qName
- * The qualified name of the parsed element.
- * @return Returns the absolute reference of a parsed element.
- */
- private Reference resolve(String uri, String qName) {
- Reference result = null;
-
- int index = qName.indexOf(":");
- String prefix = null;
- String localName = null;
- if (index != -1) {
- prefix = qName.substring(0, index);
- localName = qName.substring(index + 1);
- } else {
- localName = qName;
- prefix = "";
- }
-
- if (uri != null && !"".equals(uri)) {
- if (!uri.endsWith("#") && !uri.endsWith("/")) {
- result = new Reference(uri + "/" + localName);
- } else {
- result = new Reference(uri + localName);
- }
- } else {
- String baseUri = this.prefixes.get(prefix);
- if (baseUri != null) {
- result = new Reference(baseUri + localName);
- }
- }
-
- return (result == null) ? null : result.getTargetRef();
- }
-
- @Override
- public void startDocument() throws SAXException {
- this.prefixes = new HashMap<String, String>();
- this.builder = new StringBuilder();
- this.states = new ArrayList<State>();
- this.subjects = new ArrayList<Reference>();
- nodeDepth = 0;
- pushState(State.NONE);
- }
-
- @Override
- public void startElement(String uri, String localName, String name,
- Attributes attributes) throws SAXException {
- State state = getCurrentState();
- this.base.incrDepth();
- this.language.incrDepth();
- if (!this.consumeContent && this.builder != null) {
- this.builder = null;
- }
- if (state == State.NONE) {
- if (checkRdfQName("RDF", name)) {
- // Top element
- String base = attributes.getValue("xml:base");
- if (base != null) {
- this.base.add(new Reference(base));
- }
- } else {
- // Parse the current subject
- pushSubject(parseNode(uri, localName, name, attributes));
- pushState(State.SUBJECT);
- }
- } else if (state == State.SUBJECT) {
- // Parse the current predicate
- List<String[]> arcs = new ArrayList<String[]>();
- pushState(State.PREDICATE);
- this.consumeContent = true;
- Reference currentSubject = getCurrentSubject();
- this.currentPredicate = resolve(uri, name);
- Reference currentObject = null;
- for (int i = 0; i < attributes.getLength(); i++) {
- String qName = attributes.getQName(i);
- if (checkRdfQName("resource", qName)) {
- this.consumeContent = false;
- currentObject = resolve(attributes.getValue(i), false);
- popState();
- pushState(State.OBJECT);
- } else if (checkRdfQName("datatype", qName)) {
- // The object is a literal
- this.consumeContent = true;
- popState();
- pushState(State.LITERAL);
- this.currentDataType = attributes.getValue(i);
- } else if (checkRdfQName("parseType", qName)) {
- String value = attributes.getValue(i);
- if ("Literal".equals(value)) {
- this.consumeContent = true;
- // The object is an XML literal
- popState();
- pushState(State.LITERAL);
- this.currentDataType = RdfConstants.RDF_SYNTAX
- + "XMLLiteral";
- nodeDepth = 0;
- } else if ("Resource".equals(value)) {
- this.consumeContent = false;
- // Create a new blank node
- currentObject = LinkReference
- .createBlank(ContentReader.newBlankNodeId());
- popState();
- pushState(State.SUBJECT);
- pushSubject(currentObject);
- } else {
- this.consumeContent = false;
- // Error
- }
- } else if (checkRdfQName("nodeID", qName)) {
- this.consumeContent = false;
- currentObject = LinkReference.createBlank(attributes
- .getValue(i));
- popState();
- pushState(State.SUBJECT);
- pushSubject(currentObject);
- } else if (checkRdfQName("ID", qName)) {
- // Reify the statement
- reifiedRef = resolve(attributes.getValue(i), true);
- } else if ("xml:lang".equals(qName)) {
- this.language.add(Language.valueOf(attributes
- .getValue(i)));
- } else {
- if (!qName.startsWith("xmlns")) {
- // Add arcs.
- String[] arc = { qName, attributes.getValue(i) };
- arcs.add(arc);
- }
- }
- }
- if (currentObject != null) {
- link(currentSubject, this.currentPredicate, currentObject);
- }
-
- if (!arcs.isEmpty()) {
- // Create arcs that starts from a blank node and ends to
- // literal values. This blank node is the object of the
- // current statement.
-
- boolean found = false;
- Reference blankNode = LinkReference
- .createBlank(ContentReader.newBlankNodeId());
- for (String[] arc : arcs) {
- Reference pRef = resolve(null, arc[0]);
- // Silently remove unrecognized attributes
- if (pRef != null) {
- found = true;
- this.graphHandler.link(blankNode, pRef,
- new Literal(arc[1]));
- }
- }
- if (found) {
- link(currentSubject, this.currentPredicate, blankNode);
- popState();
- pushState(State.OBJECT);
- }
- }
- if (this.consumeContent) {
- builder = new StringBuilder();
- }
- } else if (state == State.PREDICATE) {
- this.consumeContent = false;
- // Parse the current object, create the current link
- Reference object = parseNode(uri, localName, name, attributes);
- this.currentObject = object;
- link();
- pushSubject(object);
- pushState(State.SUBJECT);
- } else if (state == State.OBJECT) {
- } else if (state == State.LITERAL) {
- // Glean the XML content
- nodeDepth++;
- this.builder.append("<");
- if (uri != null && !"".equals(uri)) {
- this.builder.append(uri).append(":");
- }
- this.builder.append(localName).append(">");
- }
- }
-
- @Override
- public void startPrefixMapping(String prefix, String uri)
- throws SAXException {
- this.rdfDefaultNamespace = this.rdfDefaultNamespace
- || ((prefix == null || "".equals(prefix)
- && RdfConstants.RDF_SYNTAX.toString(true, true)
- .equals(uri)));
-
- if (!uri.endsWith("#") && !uri.endsWith("/")) {
- this.prefixes.put(prefix, uri + "/");
- } else {
- this.prefixes.put(prefix, uri);
- }
- }
- }
-
- /**
- * Used to handle properties that have a scope such as the base URI, the
- * xml:lang property.
- *
- * @param <E>
- * The type of the property.
- */
- private static class ScopedProperty<E> {
- private int[] depths;
- private List<E> values;
- private int size;
-
- /**
- * Constructor.
- */
- public ScopedProperty() {
- super();
- this.depths = new int[10];
- this.values = new ArrayList<E>();
- this.size = 0;
- }
-
- /**
- * Constructor.
- *
- * @param value
- * Value.
- */
- public ScopedProperty(E value) {
- this();
- add(value);
- incrDepth();
- }
-
- /**
- * Add a new value.
- *
- * @param value
- * The value to be added.
- */
- public void add(E value) {
- this.values.add(value);
- if (this.size == this.depths.length) {
- int[] temp = new int[2 * this.depths.length];
- System.arraycopy(this.depths, 0, temp, 0, this.depths.length);
- this.depths = temp;
- }
- this.size++;
- this.depths[size - 1] = 0;
- }
-
- /**
- * Decrements the depth of the current value, and remove it if
- * necessary.
- */
- public void decrDepth() {
- if (this.size > 0) {
- this.depths[size - 1]--;
- if (this.depths[size - 1] < 0) {
- this.size--;
- this.values.remove(size);
- }
- }
- }
-
- /**
- * Returns the current value.
- *
- * @return The current value.
- */
- public E getValue() {
- if (this.size > 0) {
- return this.values.get(this.size - 1);
- }
- return null;
- }
-
- /**
- * Increments the depth of the current value.
- */
- public void incrDepth() {
- if (this.size > 0) {
- this.depths[size - 1]++;
- }
- }
- }
-
- /** The set of links to update when parsing, or to read when writing. */
- private Graph linkSet;
-
- /** The representation to read. */
- private SaxRepresentation rdfXmlRepresentation;
-
- /**
- * Constructor.
- *
- * @param linkSet
- * The set of links to update during the parsing.
- * @param rdfXmlRepresentation
- * The representation to read.
- * @throws IOException
- */
- public RdfXmlParsingContentHandler(Graph linkSet,
- Representation rdfXmlRepresentation) throws IOException {
- super();
- this.linkSet = linkSet;
- if (rdfXmlRepresentation instanceof SaxRepresentation) {
- this.rdfXmlRepresentation = (SaxRepresentation) rdfXmlRepresentation;
- } else {
- this.rdfXmlRepresentation = new SaxRepresentation(
- rdfXmlRepresentation);
- // Transmit the identifier used as a base for the resolution of
- // relative URIs.
- this.rdfXmlRepresentation.setIdentifier(rdfXmlRepresentation
- .getIdentifier());
- }
-
- parse();
- }
-
- @Override
- public void link(Graph source, Reference typeRef, Literal target) {
- if (source != null && typeRef != null && target != null) {
- this.linkSet.add(source, typeRef, target);
- }
- }
-
- @Override
- public void link(Graph source, Reference typeRef, Reference target) {
- if (source != null && typeRef != null && target != null) {
- this.linkSet.add(source, typeRef, target);
- }
- }
-
- @Override
- public void link(Reference source, Reference typeRef, Literal target) {
- if (source != null && typeRef != null && target != null) {
- this.linkSet.add(source, typeRef, target);
- }
- }
-
- @Override
- public void link(Reference source, Reference typeRef, Reference target) {
- if (source != null && typeRef != null && target != null) {
- this.linkSet.add(source, typeRef, target);
- }
- }
-
- /**
- * Parses the current representation.
- *
- * @throws IOException
- */
- private void parse() throws IOException {
- this.rdfXmlRepresentation.parse(new ContentReader(this,
- rdfXmlRepresentation));
- }
+ /** The set of links to update when parsing, or to read when writing. */
+ private Graph linkSet;
+
+ /** The representation to read. */
+ private SaxRepresentation rdfXmlRepresentation;
+
+ /**
+ * Constructor.
+ *
+ * @param linkSet
+ * The set of links to update during the parsing.
+ * @param rdfXmlRepresentation
+ * The representation to read.
+ * @throws IOException
+ */
+ public RdfXmlParsingContentHandler(Graph linkSet,
+ Representation rdfXmlRepresentation) throws IOException {
+ super();
+ this.linkSet = linkSet;
+ if (rdfXmlRepresentation instanceof SaxRepresentation) {
+ this.rdfXmlRepresentation = (SaxRepresentation) rdfXmlRepresentation;
+ } else {
+ this.rdfXmlRepresentation = new SaxRepresentation(
+ rdfXmlRepresentation);
+ // Transmit the identifier used as a base for the resolution of
+ // relative URIs.
+ this.rdfXmlRepresentation.setIdentifier(rdfXmlRepresentation
+ .getIdentifier());
+ }
+
+ parse();
+ }
+
+ @Override
+ public void link(Graph source, Reference typeRef, Literal target) {
+ if (source != null && typeRef != null && target != null) {
+ this.linkSet.add(source, typeRef, target);
+ }
+ }
+
+ @Override
+ public void link(Graph source, Reference typeRef, Reference target) {
+ if (source != null && typeRef != null && target != null) {
+ this.linkSet.add(source, typeRef, target);
+ }
+ }
+
+ @Override
+ public void link(Reference source, Reference typeRef, Literal target) {
+ if (source != null && typeRef != null && target != null) {
+ this.linkSet.add(source, typeRef, target);
+ }
+ }
+
+ @Override
+ public void link(Reference source, Reference typeRef, Reference target) {
+ if (source != null && typeRef != null && target != null) {
+ this.linkSet.add(source, typeRef, target);
+ }
+ }
+
+ /**
+ * Parses the current representation.
+ *
+ * @throws IOException
+ */
+ private void parse() throws IOException {
+ this.rdfXmlRepresentation.parse(new ContentReader(this,
+ rdfXmlRepresentation));
+ }
}
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/RdfXmlWritingContentHandler.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/RdfXmlWritingContentHandler.java
index fb7cb9629a..98077b2dc1 100644
--- a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/RdfXmlWritingContentHandler.java
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/RdfXmlWritingContentHandler.java
@@ -42,11 +42,13 @@
/**
* Handler of RDF content according to the RDF XML syntax.
+ *
+ * @author Thierry Boileau
*/
public class RdfXmlWritingContentHandler extends GraphHandler {
/** Buffered writer. */
- // TODO plutôt un XMLWriter?
+ // TODO better to use a XMLWriter?
BufferedWriter bw;
/**
diff --git a/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/ScopedProperty.java b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/ScopedProperty.java
new file mode 100644
index 0000000000..c6fe2bdada
--- /dev/null
+++ b/modules/org.restlet.ext.rdf/src/org/restlet/ext/rdf/internal/xml/ScopedProperty.java
@@ -0,0 +1,123 @@
+/**
+ * Copyright 2005-2009 Noelios Technologies.
+ *
+ * The contents of this file are subject to the terms of one of the following
+ * open source licenses: LGPL 3.0 or LGPL 2.1 or CDDL 1.0 or EPL 1.0 (the
+ * "Licenses"). You can select the license that you prefer but you may not use
+ * this file except in compliance with one of these Licenses.
+ *
+ * You can obtain a copy of the LGPL 3.0 license at
+ * http://www.opensource.org/licenses/lgpl-3.0.html
+ *
+ * You can obtain a copy of the LGPL 2.1 license at
+ * http://www.opensource.org/licenses/lgpl-2.1.php
+ *
+ * You can obtain a copy of the CDDL 1.0 license at
+ * http://www.opensource.org/licenses/cddl1.php
+ *
+ * You can obtain a copy of the EPL 1.0 license at
+ * http://www.opensource.org/licenses/eclipse-1.0.php
+ *
+ * See the Licenses for the specific language governing permissions and
+ * limitations under the Licenses.
+ *
+ * Alternatively, you can obtain a royalty free commercial license with less
+ * limitations, transferable or non-transferable, directly at
+ * http://www.noelios.com/products/restlet-engine
+ *
+ * Restlet is a registered trademark of Noelios Technologies.
+ */
+
+package org.restlet.ext.rdf.internal.xml;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Used to handle properties that have a scope such as the base URI, the
+ * xml:lang property.
+ *
+ * @param <E>
+ * The type of the property.
+ * @author Thierry Boileau
+ */
+class ScopedProperty<E> {
+ private int[] depths;
+
+ private List<E> values;
+
+ private int size;
+
+ /**
+ * Constructor.
+ */
+ public ScopedProperty() {
+ super();
+ this.depths = new int[10];
+ this.values = new ArrayList<E>();
+ this.size = 0;
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param value
+ * Value.
+ */
+ public ScopedProperty(E value) {
+ this();
+ add(value);
+ incrDepth();
+ }
+
+ /**
+ * Add a new value.
+ *
+ * @param value
+ * The value to be added.
+ */
+ public void add(E value) {
+ this.values.add(value);
+ if (this.size == this.depths.length) {
+ int[] temp = new int[2 * this.depths.length];
+ System.arraycopy(this.depths, 0, temp, 0, this.depths.length);
+ this.depths = temp;
+ }
+ this.size++;
+ this.depths[size - 1] = 0;
+ }
+
+ /**
+ * Decrements the depth of the current value, and remove it if necessary.
+ */
+ public void decrDepth() {
+ if (this.size > 0) {
+ this.depths[size - 1]--;
+ if (this.depths[size - 1] < 0) {
+ this.size--;
+ this.values.remove(size);
+ }
+ }
+ }
+
+ /**
+ * Returns the current value.
+ *
+ * @return The current value.
+ */
+ public E getValue() {
+ if (this.size > 0) {
+ return this.values.get(this.size - 1);
+ }
+ return null;
+ }
+
+ /**
+ * Increments the depth of the current value.
+ */
+ public void incrDepth() {
+ if (this.size > 0) {
+ this.depths[size - 1]++;
+ }
+ }
+}
\ No newline at end of file
|
8048657e265ab4f39b8b2e42425602bf151c7b91
|
Delta Spike
|
DELTASPIKE-745 fix cdictrl-weld to be able to run on new Threads
I also improved OWB ContextControl to behave the same as in weld
|
c
|
https://github.com/apache/deltaspike
|
diff --git a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
index 80a53b78e..8ce7deadc 100644
--- a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
+++ b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/MockHttpSession.java
@@ -143,4 +143,12 @@ public int hashCode()
{
return sessionId != null ? sessionId.hashCode() : 0;
}
+
+ @Override
+ public String toString()
+ {
+ return "MockHttpSession{" +
+ "sessionId='" + sessionId + '\'' +
+ '}';
+ }
}
diff --git a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java
index c8c3671a5..8ac632686 100644
--- a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java
+++ b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContainerControl.java
@@ -89,6 +89,7 @@ public synchronized void shutdown()
// contexts likely already stopped
}
ctxCtrlBean.destroy(ctxCtrl, ctxCtrlCreationalContext);
+ ctxCtrl = null;
}
if (lifecycle != null)
diff --git a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContextControl.java b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContextControl.java
index 9e8ba98d4..a0001cb5b 100644
--- a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContextControl.java
+++ b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OpenWebBeansContextControl.java
@@ -26,6 +26,8 @@
import javax.inject.Singleton;
import java.lang.annotation.Annotation;
+import java.util.WeakHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
import org.apache.deltaspike.cdise.api.ContextControl;
import org.apache.webbeans.config.WebBeansContext;
@@ -38,6 +40,10 @@
@SuppressWarnings("UnusedDeclaration")
public class OpenWebBeansContextControl implements ContextControl
{
+
+ private static WeakHashMap<ContextsService, AtomicInteger> sessionRefCounters
+ = new WeakHashMap<ContextsService, AtomicInteger>();
+
@Override
public void startContexts()
{
@@ -149,6 +155,7 @@ private void startSessionScope()
{
mockSession = OwbHelper.getMockSession();
}
+ incrementSessionRefCount(contextsService);
contextsService.startContext(SessionScoped.class, mockSession);
}
@@ -203,7 +210,10 @@ private void stopSessionScope()
{
mockSession = OwbHelper.getMockSession();
}
- contextsService.endContext(SessionScoped.class, mockSession);
+ if (decrementSessionRefCount(contextsService))
+ {
+ contextsService.endContext(SessionScoped.class, mockSession);
+ }
}
private void stopRequestScope()
@@ -225,4 +235,34 @@ private ContextsService getContextsService()
WebBeansContext webBeansContext = WebBeansContext.currentInstance();
return webBeansContext.getContextsService();
}
+
+
+ private synchronized void incrementSessionRefCount(ContextsService contextsService)
+ {
+ AtomicInteger sessionRefCounter = sessionRefCounters.get(contextsService);
+ if (sessionRefCounter == null)
+ {
+ sessionRefCounter = new AtomicInteger(1);
+ sessionRefCounters.put(contextsService, sessionRefCounter);
+ }
+ else
+ {
+ sessionRefCounter.incrementAndGet();
+ }
+ }
+
+ /**
+ * @return true if the refCounter is back to zero
+ */
+ private synchronized boolean decrementSessionRefCount(ContextsService contextsService)
+ {
+ AtomicInteger sessionRefCounter = sessionRefCounters.get(contextsService);
+ if (sessionRefCounter == null)
+ {
+ return false;
+ }
+
+ return sessionRefCounter.decrementAndGet() <= 0;
+ }
+
}
diff --git a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OwbHelper.java b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OwbHelper.java
index b4ff77f90..f543ba75a 100644
--- a/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OwbHelper.java
+++ b/deltaspike/cdictrl/impl-owb/src/main/java/org/apache/deltaspike/cdise/owb/OwbHelper.java
@@ -45,18 +45,4 @@ public static Object getMockServletContext()
return MockServletContext.getInstance();
}
-
- public static boolean isServletApiAvailable()
- {
- try
- {
- Class servletClass = Class.forName("javax.servlet.http.HttpSession");
- return servletClass != null;
- }
- catch (ClassNotFoundException e)
- {
- return false;
- }
- }
-
}
diff --git a/deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/ContextController.java b/deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/ContextController.java
index f6c7eaf38..99a87dbc8 100644
--- a/deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/ContextController.java
+++ b/deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/ContextController.java
@@ -26,12 +26,13 @@
import org.jboss.weld.context.bound.MutableBoundRequest;
import javax.enterprise.context.RequestScoped;
-import javax.enterprise.context.SessionScoped;
+import javax.enterprise.inject.Instance;
import javax.enterprise.inject.Typed;
import javax.inject.Inject;
import javax.inject.Singleton;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
/**
* Weld specific controller for all supported context implementations
@@ -39,6 +40,8 @@
@Typed()
public class ContextController
{
+ private static ThreadLocal<RequestContextHolder> requestContexts = new ThreadLocal<RequestContextHolder>();
+
@Inject
private ApplicationContext applicationContext;
@@ -46,14 +49,13 @@ public class ContextController
private BoundSessionContext sessionContext;
@Inject
- private BoundRequestContext requestContext;
+ private Instance<BoundRequestContext> requestContextFactory;
@Inject
private BoundConversationContext conversationContext;
-
private Map<String, Object> sessionMap;
- private Map<String, Object> requestMap;
+ private AtomicInteger sessionRefCounter = new AtomicInteger(0);
private boolean singletonScopeStarted;
@@ -91,71 +93,109 @@ void stopSingletonScope()
singletonScopeStarted = false;
}
- void startSessionScope()
+ synchronized void startSessionScope()
{
if (sessionMap == null)
{
sessionMap = new HashMap<String, Object>();
}
- else
- {
- throw new IllegalStateException(SessionScoped.class.getName() + " started already");
- }
+ sessionRefCounter.incrementAndGet();
sessionContext.associate(sessionMap);
sessionContext.activate();
}
- void stopSessionScope()
+ synchronized void stopSessionScope()
{
if (sessionContext.isActive())
{
sessionContext.invalidate();
sessionContext.deactivate();
sessionContext.dissociate(sessionMap);
- sessionMap = null;
+ if (sessionRefCounter.decrementAndGet() <= 0)
+ {
+ sessionMap = null;
+ }
}
}
- void startConversationScope(String cid)
+ synchronized void startConversationScope(String cid)
{
- conversationContext.associate(new MutableBoundRequest(requestMap, sessionMap));
+ RequestContextHolder rcHolder = requestContexts.get();
+ if (rcHolder == null)
+ {
+ startRequestScope();
+ rcHolder = requestContexts.get();
+ }
+ conversationContext.associate(new MutableBoundRequest(rcHolder.requestMap, sessionMap));
conversationContext.activate(cid);
}
- void stopConversationScope()
+ synchronized void stopConversationScope()
{
+ RequestContextHolder rcHolder = requestContexts.get();
+ if (rcHolder == null)
+ {
+ startRequestScope();
+ rcHolder = requestContexts.get();
+ }
if (conversationContext.isActive())
{
conversationContext.invalidate();
conversationContext.deactivate();
- conversationContext.dissociate(new MutableBoundRequest(requestMap, sessionMap));
+ conversationContext.dissociate(new MutableBoundRequest(rcHolder.getRequestMap(), sessionMap));
}
}
- void startRequestScope()
+ synchronized void startRequestScope()
{
- if (requestMap == null)
+ RequestContextHolder rcHolder = requestContexts.get();
+ if (rcHolder == null)
{
- requestMap = new HashMap<String, Object>();
+ rcHolder = new RequestContextHolder(requestContextFactory.get(), new HashMap<String, Object>());
+ requestContexts.set(rcHolder);
}
else
{
throw new IllegalStateException(RequestScoped.class.getName() + " started already");
}
- requestContext.associate(requestMap);
- requestContext.activate();
+ rcHolder.getBoundRequestContext().associate(rcHolder.getRequestMap());
+ rcHolder.getBoundRequestContext().activate();
}
- void stopRequestScope()
+ synchronized void stopRequestScope()
{
- if (requestContext.isActive())
+ RequestContextHolder rcHolder = requestContexts.get();
+ if (rcHolder != null && rcHolder.getBoundRequestContext().isActive())
+ {
+ rcHolder.getBoundRequestContext().invalidate();
+ rcHolder.getBoundRequestContext().deactivate();
+ rcHolder.getBoundRequestContext().dissociate(rcHolder.getRequestMap());
+ requestContexts.set(null);
+ requestContexts.remove();
+ }
+ }
+
+ private static class RequestContextHolder
+ {
+ private final BoundRequestContext boundRequestContext;
+ private final Map<String, Object> requestMap;
+
+ private RequestContextHolder(BoundRequestContext boundRequestContext, Map<String, Object> requestMap)
+ {
+ this.boundRequestContext = boundRequestContext;
+ this.requestMap = requestMap;
+ }
+
+ public BoundRequestContext getBoundRequestContext()
+ {
+ return boundRequestContext;
+ }
+
+ public Map<String, Object> getRequestMap()
{
- requestContext.invalidate();
- requestContext.deactivate();
- requestContext.dissociate(requestMap);
- requestMap = null;
+ return requestMap;
}
}
}
diff --git a/deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/WeldContextControl.java b/deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/WeldContextControl.java
index 188f65104..e3aff5871 100644
--- a/deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/WeldContextControl.java
+++ b/deltaspike/cdictrl/impl-weld/src/main/java/org/apache/deltaspike/cdise/weld/WeldContextControl.java
@@ -120,50 +120,22 @@ else if (scopeClass.isAssignableFrom(Singleton.class))
*/
private void startApplicationScope()
{
- try
- {
- getContextController().startApplicationScope();
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already started...
- }
+ getContextController().startApplicationScope();
}
private void startSessionScope()
{
- try
- {
- getContextController().startSessionScope();
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already started...
- }
+ getContextController().startSessionScope();
}
private void startConversationScope()
{
- try
- {
- getContextController().startConversationScope(null);
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already started...
- }
+ getContextController().startConversationScope(null);
}
private void startRequestScope()
{
- try
- {
- getContextController().startRequestScope();
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already started...
- }
+ getContextController().startRequestScope();
}
/*
@@ -172,62 +144,27 @@ private void startRequestScope()
private void stopApplicationScope()
{
- try
- {
- getContextController().stopApplicationScope();
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already stopped...
- }
+ getContextController().stopApplicationScope();
}
private void stopSessionScope()
{
- try
- {
- getContextController().stopSessionScope();
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already stopped...
- }
+ getContextController().stopSessionScope();
}
private void stopConversationScope()
{
- try
- {
- getContextController().stopConversationScope();
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already stopped...
- }
+ getContextController().stopConversationScope();
}
private void stopRequestScope()
{
- try
- {
- getContextController().stopRequestScope();
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already stopped...
- }
+ getContextController().stopRequestScope();
}
private void stopSingletonScope()
{
- try
- {
- getContextController().stopSingletonScope();
- }
- catch (IllegalStateException ise)
- {
- // weld throws an ISE if the context was already stopped...
- }
+ getContextController().stopSingletonScope();
}
private ContextController getContextController()
diff --git a/deltaspike/cdictrl/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java b/deltaspike/cdictrl/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java
index 388ff2c9f..0edf022a8 100644
--- a/deltaspike/cdictrl/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java
+++ b/deltaspike/cdictrl/tck/src/main/java/org/apache/deltaspike/cdise/tck/ContainerCtrlTckTest.java
@@ -50,7 +50,7 @@
public class ContainerCtrlTckTest
{
private static final Logger log = Logger.getLogger(ContainerCtrlTckTest.class.getName());
- private static final int NUM_THREADS = 100;
+ private static final int NUM_THREADS = 10;
@Rule
public VersionControlRule versionControlRule = new VersionControlRule();
@@ -92,41 +92,41 @@ public void testParallelThreadExecution() throws Exception
Assert.assertNotNull(bm);
final AtomicInteger numErrors = new AtomicInteger(0);
+ final ContextControl contextControl = cc.getContextControl();
Runnable runnable = new Runnable()
{
@Override
public void run()
{
- ContextControl contextControl = cc.getContextControl();
- contextControl.startContext(SessionScoped.class);
- contextControl.startContext(RequestScoped.class);
+ try
+ {
+ contextControl.startContext(SessionScoped.class);
+ contextControl.startContext(RequestScoped.class);
- Set<Bean<?>> beans = bm.getBeans(CarRepair.class);
- Bean<?> bean = bm.resolve(beans);
+ Set<Bean<?>> beans = bm.getBeans(CarRepair.class);
+ Bean<?> bean = bm.resolve(beans);
- CarRepair carRepair = (CarRepair)
- bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));
- Assert.assertNotNull(carRepair);
+ CarRepair carRepair = (CarRepair)
+ bm.getReference(bean, CarRepair.class, bm.createCreationalContext(bean));
+ Assert.assertNotNull(carRepair);
- try
- {
for (int i = 0; i < 100000; i++)
{
// we need the threads doing something ;)
Assert.assertNotNull(carRepair.getCar());
Assert.assertNotNull(carRepair.getCar().getUser());
- Assert.assertNotNull(carRepair.getCar().getUser().getName());
+ Assert.assertNull(carRepair.getCar().getUser().getName());
}
+ contextControl.stopContext(RequestScoped.class);
+ contextControl.stopContext(SessionScoped.class);
}
- catch (Exception e)
+ catch (Throwable e)
{
log.log(Level.SEVERE, "An exception happened on a new worker thread", e);
numErrors.incrementAndGet();
}
- contextControl.stopContext(RequestScoped.class);
- contextControl.stopContext(SessionScoped.class);
}
};
|
a69be6ff2a02d1c1fb9f191c2c0dfd86dcfd3eef
|
Vala
|
zlib: add crc32 and adler32 to ZLib.Utility
Fixes bug 622200.
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/vapi/zlib.vapi b/vapi/zlib.vapi
index dcd292aae8..d27555b0ef 100644
--- a/vapi/zlib.vapi
+++ b/vapi/zlib.vapi
@@ -141,12 +141,15 @@ namespace ZLib {
public int prime (int bits, int value);
public int get_header (out GZHeader head);
}
+ [CCode (lower_case_cprefix = "")]
namespace Utility {
[CCode (cname = "compress2")]
public static int compress ([CCode (array_length_type = "gulong")] uchar[] dest, [CCode (array_length_type = "gulong")] uchar[] source, int level = Level.DEFAULT_COMPRESSION);
[CCode (cname = "compressBound")]
public static int compress_bound (ulong sourceLen);
public static int uncompress ([CCode (array_length_type = "gulong")] uchar[] dest, [CCode (array_length_type = "gulong")] uchar[] source);
+ public static ulong adler32 (ulong crc = 0, [CCode (array_length_type = "guint")] uint8[]? buf = null);
+ public static ulong crc32 (ulong crc = 0, [CCode (array_length_type = "guint")] uint8[]? buf = null);
}
[CCode (cname = "gz_header")]
public struct GZHeader {
|
a77138a065b1b594fdb7351f9503be4496995b97
|
intellij-community
|
fixed django template commenter again (PY-1949)--
|
c
|
https://github.com/JetBrains/intellij-community
|
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
index ed3c2b59d9ac9..c3c8731430c30 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/generation/CommentByLineCommentHandler.java
@@ -488,7 +488,6 @@ private void uncommentLine(int line) {
int start = startOffset + lineText.indexOf(suffix);
myDocument.deleteString(start, start + suffix.length());
}
-
}
boolean skipNewLine = false;
@@ -554,9 +553,10 @@ private void commentLine(int line, int offset, @Nullable Commenter commenter) {
endOffset = CharArrayUtil.shiftBackward(myDocument.getCharsSequence(), endOffset, " \t");
int shiftedStartOffset = CharArrayUtil.shiftForward(myDocument.getCharsSequence(), offset, " \t");
String lineSuffix = ((CommenterWithLineSuffix)commenter).getLineCommentSuffix();
- if (!CharArrayUtil.regionMatches(myDocument.getCharsSequence(), endOffset - lineSuffix.length(), lineSuffix) &&
- !CharArrayUtil.regionMatches(myDocument.getCharsSequence(), shiftedStartOffset, prefix)) {
- myDocument.insertString(endOffset, lineSuffix);
+ if (!CharArrayUtil.regionMatches(myDocument.getCharsSequence(), shiftedStartOffset, prefix)) {
+ if (!CharArrayUtil.regionMatches(myDocument.getCharsSequence(), endOffset - lineSuffix.length(), lineSuffix)) {
+ myDocument.insertString(endOffset, lineSuffix);
+ }
myDocument.insertString(offset, prefix);
}
}
|
d344d95b5c0d4a45640cd01d6d1e828b96587e6e
|
restlet-framework-java
|
Fixed bug in DomRepresentation causing the loss of- both public and system DocType. Reported by Lee Saferite.--
|
c
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/build/tmpl/text/changes.txt b/build/tmpl/text/changes.txt
index 26393df071..2f75338220 100644
--- a/build/tmpl/text/changes.txt
+++ b/build/tmpl/text/changes.txt
@@ -9,8 +9,10 @@ Changes log
- Fixed issue in the selection of connectors. The last connector in the classpath for
a given protocol was selected instead of the first one, leading to counter-intuitive
behavior when multiple connectors were present in the classpath.
-
-[Enhancements]
+- Fixed bug in DomRepresentation causing the loss of both public and system DocType.
+ Reported by Lee Saferite.
+[
+Enhancements]
- Added a getApplication() method to Context and Resource classes.
- Added a new Grizzly based connector (full NIO).
- Upgraded Apache MINA to version 1.1.0.
diff --git a/modules/org.restlet/src/org/restlet/resource/DomRepresentation.java b/modules/org.restlet/src/org/restlet/resource/DomRepresentation.java
index f869d58999..59b45caac0 100644
--- a/modules/org.restlet/src/org/restlet/resource/DomRepresentation.java
+++ b/modules/org.restlet/src/org/restlet/resource/DomRepresentation.java
@@ -154,6 +154,8 @@ public void write(OutputStream outputStream) throws IOException {
.newTransformer();
transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,
getDocument().getDoctype().getSystemId());
+ transformer.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC,
+ getDocument().getDoctype().getPublicId());
transformer.transform(new DOMSource(getDocument()),
new StreamResult(outputStream));
} catch (TransformerConfigurationException tce) {
|
0387904498d2b4508cff459e1306c2c58a1a210d
|
arquillian$arquillian-graphene
|
ARQGRA-356: extending support of body-referencing to html/body/head (document-root referencing
|
a
|
https://github.com/arquillian/arquillian-graphene
|
diff --git a/impl/src/main/java/org/jboss/arquillian/graphene/findby/ByJQueryImpl.java b/impl/src/main/java/org/jboss/arquillian/graphene/findby/ByJQueryImpl.java
index ce0f58850..07f70a5ab 100644
--- a/impl/src/main/java/org/jboss/arquillian/graphene/findby/ByJQueryImpl.java
+++ b/impl/src/main/java/org/jboss/arquillian/graphene/findby/ByJQueryImpl.java
@@ -59,9 +59,9 @@ public List<WebElement> findElements(SearchContext searchContext) {
List<WebElement> elements;
try {
// the element is referenced from parent web element
- if (searchContext instanceof WebElement && !isReferencedFromBody()) {
+ if (searchContext instanceof WebElement && !isReferencedFromRootOfDocument()) {
elements = jQuerySearchContext.findElementsInElement(selector, (WebElement) searchContext);
- } else if (searchContext instanceof WebDriver || isReferencedFromBody()) { // element is referenced from body
+ } else if (searchContext instanceof WebDriver || isReferencedFromRootOfDocument()) { // element is referenced from root of document
elements = jQuerySearchContext.findElements(selector);
} else { // other unknown case
throw new WebDriverException(
@@ -84,8 +84,12 @@ public WebElement findElement(SearchContext context) {
return elements.get(0);
}
- private boolean isReferencedFromBody() {
- return "body".equals(selector) || selector.startsWith("body ");
+ private boolean isReferencedFromRootOfDocument() {
+ return isPrefixedWith("html") || isPrefixedWith("body") || isPrefixedWith("head");
+ }
+
+ private boolean isPrefixedWith(String prefix) {
+ return selector.equals(prefix) || selector.startsWith(prefix + " ") || selector.startsWith(prefix + ".") || selector.startsWith(prefix + ":");
}
private GrapheneContext getGrapheneContext(SearchContext searchContext) {
|
5ed43d241a1786f41c97af3fc31de3a6f7d1f3ef
|
restlet-framework-java
|
- More optimizations for internal connectors.--
|
p
|
https://github.com/restlet/restlet-framework-java
|
diff --git a/modules/com.noelios.restlet/src/com/noelios/restlet/http/InputEntityStream.java b/modules/com.noelios.restlet/src/com/noelios/restlet/http/InputEntityStream.java
index 7031d94564..c524720246 100644
--- a/modules/com.noelios.restlet/src/com/noelios/restlet/http/InputEntityStream.java
+++ b/modules/com.noelios.restlet/src/com/noelios/restlet/http/InputEntityStream.java
@@ -27,7 +27,6 @@
package com.noelios.restlet.http;
-import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -51,10 +50,6 @@ public class InputEntityStream extends InputStream {
* The total size that should be read from the source stream.
*/
public InputEntityStream(InputStream source, long size) {
- if (!(source instanceof BufferedInputStream)) {
- source = new BufferedInputStream(source);
- }
-
this.source = source;
this.availableSize = size;
}
diff --git a/modules/com.noelios.restlet/src/com/noelios/restlet/http/StreamClientCall.java b/modules/com.noelios.restlet/src/com/noelios/restlet/http/StreamClientCall.java
index 1d2c538a77..48e5796745 100644
--- a/modules/com.noelios.restlet/src/com/noelios/restlet/http/StreamClientCall.java
+++ b/modules/com.noelios.restlet/src/com/noelios/restlet/http/StreamClientCall.java
@@ -27,6 +27,8 @@
package com.noelios.restlet.http;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -289,8 +291,10 @@ public Status sendRequest(Request request) {
// Create the client socket
this.socket = createSocket(hostDomain, hostPort);
- this.requestStream = this.socket.getOutputStream();
- this.responseStream = this.socket.getInputStream();
+ this.requestStream = new BufferedOutputStream(this.socket
+ .getOutputStream());
+ this.responseStream = new BufferedInputStream(this.socket
+ .getInputStream());
// Write the request line
getRequestHeadStream().write(getMethod().getBytes());
@@ -323,6 +327,7 @@ public Status sendRequest(Request request) {
// Write the end of the headers section
HttpUtils.writeCRLF(getRequestHeadStream());
+ getRequestHeadStream().flush();
// Write the request body
result = super.sendRequest(request);
diff --git a/modules/com.noelios.restlet/src/com/noelios/restlet/http/StreamServerHelper.java b/modules/com.noelios.restlet/src/com/noelios/restlet/http/StreamServerHelper.java
index 0b030a7981..735a4329c7 100644
--- a/modules/com.noelios.restlet/src/com/noelios/restlet/http/StreamServerHelper.java
+++ b/modules/com.noelios.restlet/src/com/noelios/restlet/http/StreamServerHelper.java
@@ -27,6 +27,8 @@
package com.noelios.restlet.http;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
@@ -81,9 +83,12 @@ private ConnectionHandler(StreamServerHelper helper, Socket socket) {
*/
public void run() {
try {
- this.helper.handle(new StreamServerCall(
- this.helper.getHelped(), this.socket.getInputStream(),
- this.socket.getOutputStream(), this.socket));
+ this.helper
+ .handle(new StreamServerCall(this.helper.getHelped(),
+ new BufferedInputStream(this.socket
+ .getInputStream()),
+ new BufferedOutputStream(this.socket
+ .getOutputStream()), this.socket));
} catch (final IOException ex) {
this.helper.getLogger().log(Level.WARNING,
"Unexpected error while handling a call", ex);
|
37819b1b6409eb7cbaa96366bb91f6557f821b11
|
Valadoc
|
gir-importer: docbook: resolve internal links
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/src/libvaladoc/documentation/documentationparser.vala b/src/libvaladoc/documentation/documentationparser.vala
index 4ca6aef2b6..481ba6fd4a 100644
--- a/src/libvaladoc/documentation/documentationparser.vala
+++ b/src/libvaladoc/documentation/documentationparser.vala
@@ -82,7 +82,7 @@ public class Valadoc.DocumentationParser : Object, ResourceLocator {
GirMetaData metadata = get_metadata_for_comment (gir_comment);
if (metadata.is_docbook) {
- Comment doc_comment = gtkdoc_parser.parse (element, gir_comment, metadata);
+ Comment doc_comment = gtkdoc_parser.parse (element, gir_comment, metadata, id_registrar);
return doc_comment;
} else {
Comment doc_comment = gtkdoc_markdown_parser.parse (element, gir_comment, metadata, id_registrar);
diff --git a/src/libvaladoc/documentation/gtkdoccommentparser.vala b/src/libvaladoc/documentation/gtkdoccommentparser.vala
index a9553c8cba..372b0590aa 100644
--- a/src/libvaladoc/documentation/gtkdoccommentparser.vala
+++ b/src/libvaladoc/documentation/gtkdoccommentparser.vala
@@ -49,6 +49,7 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
private Regex? is_numeric_regex = null;
private Regex? normalize_regex = null;
+ private Importer.InternalIdRegistrar id_registrar = null;
private GirMetaData? current_metadata = null;
private inline string fix_resource_path (string path) {
@@ -114,9 +115,10 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
}
}
- public Comment? parse (Api.Node element, Api.GirSourceComment gir_comment, GirMetaData gir_metadata) {
+ public Comment? parse (Api.Node element, Api.GirSourceComment gir_comment, GirMetaData gir_metadata, Importer.InternalIdRegistrar id_registrar) {
this.instance_param_name = gir_comment.instance_param_name;
this.current_metadata = gir_metadata;
+ this.id_registrar = id_registrar;
this.element = element;
Comment? comment = this.parse_main_content (gir_comment);
@@ -295,7 +297,7 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
// Rules, Ground:
//
- private Inline? parse_docbook_link_tempalte (string tagname) {
+ private Inline? parse_docbook_link_tempalte (string tagname, bool is_internal) {
if (!check_xml_open_tag (tagname)) {
this.report_unexpected_token (current, "<%s>".printf (tagname));
return null;
@@ -320,6 +322,9 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
}
var link = factory.create_link ();
+ if (is_internal) {
+ link.id_registrar = id_registrar;
+ }
link.url = url;
if (builder.len == 0) {
@@ -386,8 +391,8 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
}
string id = current.attributes.get ("id");
+ id_registrar.register_symbol (id, element);
next ();
- // TODO register xref
if (!check_xml_close_tag ("anchor")) {
this.report_unexpected_token (current, "</anchor>");
@@ -397,7 +402,7 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
next ();
}
- private Run? parse_xref () {
+ private Link? parse_xref () {
if (!check_xml_open_tag ("xref")) {
this.report_unexpected_token (current, "<xref>");
return null;
@@ -405,18 +410,19 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
string linkend = current.attributes.get ("linkend");
next ();
- // TODO register xref
- Run run = factory.create_run (Run.Style.ITALIC);
- run.content.add (factory.create_text (linkend));
+ Link link = factory.create_link ();
+ link.content.add (factory.create_text (linkend));
+ link.id_registrar = id_registrar;
+ link.url = linkend;
if (!check_xml_close_tag ("xref")) {
this.report_unexpected_token (current, "</xref>");
- return run;
+ return link;
}
next ();
- return run;
+ return link;
}
private Run? parse_highlighted_template (string tag_name, Run.Style style) {
@@ -837,8 +843,8 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
return null;
}
- // TODO: register id
string id = current.attributes.get ("id");
+ id_registrar.register_symbol (id, element);
next ();
parse_docbook_spaces ();
@@ -1111,6 +1117,7 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
}
string id = current.attributes.get ("id");
+ id_registrar.register_symbol (id, element);
next ();
LinkedList<Block> content = parse_mixed_content ();
@@ -1482,9 +1489,9 @@ public class Valadoc.Gtkdoc.Parser : Object, ResourceLocator {
} else if (current.type == TokenType.XML_OPEN && current.content == "anchor") {
parse_anchor ();
} else if (current.type == TokenType.XML_OPEN && current.content == "link") {
- append_inline_content_not_null (run, parse_docbook_link_tempalte ("link"));
+ append_inline_content_not_null (run, parse_docbook_link_tempalte ("link", true));
} else if (current.type == TokenType.XML_OPEN && current.content == "ulink") {
- append_inline_content_not_null (run, parse_docbook_link_tempalte ("ulink"));
+ append_inline_content_not_null (run, parse_docbook_link_tempalte ("ulink", false));
} else if (current.type == TokenType.XML_OPEN && current.content == "xref") {
append_inline_content_not_null (run, parse_xref ());
} else if (current.type == TokenType.XML_OPEN && current.content == "tag") {
|
e3b68ea468af79dde5cd7e27f80731ec9286a45b
|
drools
|
JBRULES-737: fixing problem when inspecting classes- with static initializers--git-svn-id: https://svn.jboss.org/repos/labs/labs/jbossrules/trunk@10190 c60d74c8-e8f6-0310-9e8f-d4a2fc68ab70-
|
c
|
https://github.com/kiegroup/drools
|
diff --git a/drools-core/src/main/java/org/drools/util/asm/ClassFieldInspector.java b/drools-core/src/main/java/org/drools/util/asm/ClassFieldInspector.java
index d4cc8b98c7f..ff1802770c9 100644
--- a/drools-core/src/main/java/org/drools/util/asm/ClassFieldInspector.java
+++ b/drools-core/src/main/java/org/drools/util/asm/ClassFieldInspector.java
@@ -128,6 +128,7 @@ private void processClassWithoutByteCode(Class clazz,
if ( (( methods[i].getModifiers() & mask ) == Modifier.PUBLIC ) &&
( methods[i].getParameterTypes().length == 0) &&
( !methods[i].getName().equals( "<init>" )) &&
+ //( !methods[i].getName().equals( "<clinit>" )) &&
(methods[i].getReturnType() != void.class) ) {
final int fieldIndex = this.methods.size();
addToMapping( methods[i],
@@ -262,7 +263,9 @@ public MethodVisitor visitMethod(final int access,
//and have no args, and return a value
final int mask = this.includeFinalMethods ? Opcodes.ACC_PUBLIC : Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL;
if ( (access & mask) == Opcodes.ACC_PUBLIC ) {
- if ( desc.startsWith( "()" ) && !(name.equals( "<init>" )) ) {// && ( name.startsWith("get") || name.startsWith("is") ) ) {
+ if ( desc.startsWith( "()" ) &&
+ ( ! name.equals( "<init>" ) ) /*&&
+ ( ! name.equals( "<clinit>" ) ) */) {// && ( name.startsWith("get") || name.startsWith("is") ) ) {
try {
final Method method = this.clazz.getMethod( name,
(Class[]) null );
diff --git a/drools-core/src/test/java/org/drools/Cheese.java b/drools-core/src/test/java/org/drools/Cheese.java
index 36ddfd7b50d..80e98335337 100644
--- a/drools-core/src/test/java/org/drools/Cheese.java
+++ b/drools-core/src/test/java/org/drools/Cheese.java
@@ -23,6 +23,14 @@
public class Cheese
implements
CheeseInterface {
+
+ public static String staticString;
+
+ static {
+ staticString = "Cheese is tasty";
+ }
+
+
private String type;
private int price;
diff --git a/drools-core/src/test/java/org/drools/util/asm/ClassFieldInspectorTest.java b/drools-core/src/test/java/org/drools/util/asm/ClassFieldInspectorTest.java
index 4803a4b90c4..e0f2c7f6986 100644
--- a/drools-core/src/test/java/org/drools/util/asm/ClassFieldInspectorTest.java
+++ b/drools-core/src/test/java/org/drools/util/asm/ClassFieldInspectorTest.java
@@ -212,10 +212,15 @@ public void bas() {
}
static class Person {
+ public static String aStaticString;
private boolean happy;
private String name;
private int age;
private String URI;
+
+ static {
+ aStaticString = "A static String";
+ }
public int getAge() {
return this.age;
|
9fcdb59352eb7bae875c460fbe6b50a4fdde3d45
|
intellij-community
|
[vcs-log] IDEA-125276 support regular- expressions in branch filter--
|
a
|
https://github.com/JetBrains/intellij-community
|
diff --git a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogBranchFilter.java b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogBranchFilter.java
index 90464d250f41d..e3c51b3dbe181 100644
--- a/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogBranchFilter.java
+++ b/platform/vcs-log/api/src/com/intellij/vcs/log/VcsLogBranchFilter.java
@@ -16,27 +16,20 @@
package com.intellij.vcs.log;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.util.Collection;
+import java.util.regex.Pattern;
/**
* Tells to filter by branches with given names.
- * <p/>
- * There are two filters possible here:<ul>
- * <li>accept only given branches: {@link #getBranchNames()};</li>
- * <li>deny the given branches: {@link #getExcludedBranchNames()}</li></ul>
- * Note though that accepted branch names have higher precedence over excluded ones:
- * only those commits are excluded, which are contained <b>only</b> in excluded branches:
- * i.e. if a commit contains in an excluded branch, and in a non-excluded branch, then it should be shown.
- * <p/>
- * That means, in particular, that a filter with one accepted branch will show all and only commits from that branch,
- * and excluded branches will have no effect.
*/
public interface VcsLogBranchFilter extends VcsLogFilter {
+ boolean isShown(@NotNull String name);
- @NotNull
- Collection<String> getBranchNames();
+ @Nullable
+ String getSingleFilteredBranch();
@NotNull
- Collection<String> getExcludedBranchNames();
+ Collection<String> getTextPresentation();
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogBranchFilterImpl.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogBranchFilterImpl.java
index d47ae38cce1ec..c7fb6e18f41f6 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogBranchFilterImpl.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VcsLogBranchFilterImpl.java
@@ -1,37 +1,153 @@
package com.intellij.vcs.log.data;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.util.Function;
+import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.VcsLogBranchFilter;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.regex.Pattern;
public class VcsLogBranchFilterImpl implements VcsLogBranchFilter {
+ @NotNull private final List<String> myBranches;
+ @NotNull private final List<Pattern> myPatterns;
- @NotNull private final Collection<String> myBranchNames;
- @NotNull private final Collection<String> myExcludedBranchNames;
+ @NotNull private final List<String> myExcludedBranches;
+ @NotNull private final List<Pattern> myExcludedPatterns;
- public VcsLogBranchFilterImpl(@NotNull final Collection<String> branchNames, @NotNull Collection<String> excludedBranchNames) {
- myBranchNames = branchNames;
- myExcludedBranchNames = excludedBranchNames;
+ private VcsLogBranchFilterImpl(@NotNull List<String> branches,
+ @NotNull List<Pattern> patterns,
+ @NotNull List<String> excludedBranches,
+ @NotNull List<Pattern> excludedPatterns) {
+ myBranches = branches;
+ myPatterns = patterns;
+ myExcludedBranches = excludedBranches;
+ myExcludedPatterns = excludedPatterns;
+ }
+
+ @Deprecated
+ public VcsLogBranchFilterImpl(@NotNull Collection<String> branches,
+ @NotNull Collection<String> excludedBranches) {
+ myBranches = new ArrayList<String>(branches);
+ myPatterns = new ArrayList<Pattern>();
+ myExcludedBranches = new ArrayList<String>(excludedBranches);
+ myExcludedPatterns = new ArrayList<Pattern>();
+ }
+
+ @Nullable
+ public static VcsLogBranchFilterImpl fromBranch(@NotNull final String branchName) {
+ return new VcsLogBranchFilterImpl(Collections.singletonList(branchName),
+ Collections.<Pattern>emptyList(),
+ Collections.<String>emptyList(),
+ Collections.<Pattern>emptyList());
+ }
+
+ @Nullable
+ public static VcsLogBranchFilterImpl fromTextPresentation(@NotNull final Collection<String> strings) {
+ if (strings.isEmpty()) return null;
+
+ List<String> branches = new ArrayList<String>();
+ List<String> excludedBranches = new ArrayList<String>();
+ List<Pattern> patterns = new ArrayList<Pattern>();
+ List<Pattern> excludedPatterns = new ArrayList<Pattern>();
+
+ for (String string : strings) {
+ boolean isRegexp = isRegexp(string);
+ boolean isExcluded = string.startsWith("-");
+ string = isExcluded ? string.substring(1) : string;
+
+ if (isRegexp) {
+ if (isExcluded) {
+ excludedPatterns.add(Pattern.compile(string));
+ }
+ else {
+ patterns.add(Pattern.compile(string));
+ }
+ }
+ else {
+ if (isExcluded) {
+ excludedBranches.add(string);
+ }
+ else {
+ branches.add(string);
+ }
+ }
+ }
+
+ return new VcsLogBranchFilterImpl(branches, patterns, excludedBranches, excludedPatterns);
+ }
+
+ @NotNull
+ @Override
+ public Collection<String> getTextPresentation() {
+ List<String> result = new ArrayList<String>();
+
+ result.addAll(myBranches);
+ result.addAll(ContainerUtil.map(myPatterns, new Function<Pattern, String>() {
+ @Override
+ public String fun(Pattern pattern) {
+ return pattern.pattern();
+ }
+ }));
+
+ result.addAll(ContainerUtil.map(myExcludedBranches, new Function<String, String>() {
+ @Override
+ public String fun(String branchName) {
+ return "-" + branchName;
+ }
+ }));
+ result.addAll(ContainerUtil.map(myExcludedPatterns, new Function<Pattern, String>() {
+ @Override
+ public String fun(Pattern pattern) {
+ return "-" + pattern.pattern();
+ }
+ }));
+
+ return result;
}
@Override
public String toString() {
- return !myBranchNames.isEmpty()
- ? "on: " + StringUtil.join(myBranchNames, ", ")
- : "not on: " + StringUtil.join(myExcludedBranchNames, ", ");
+ return "on patterns: " + StringUtil.join(myPatterns, ", ") + "; branches: " + StringUtil.join(myBranches, ", ");
}
@Override
- @NotNull
- public Collection<String> getBranchNames() {
- return myBranchNames;
+ public boolean isShown(@NotNull String name) {
+ return isIncluded(name) && !isExcluded(name);
}
- @NotNull
+ private boolean isIncluded(@NotNull String name) {
+ if (myPatterns.isEmpty() && myBranches.isEmpty()) return true;
+ if (myBranches.contains(name)) return true;
+ for (Pattern regexp : myPatterns) {
+ if (regexp.matcher(name).matches()) return true;
+ }
+ return false;
+ }
+
+ private boolean isExcluded(@NotNull String name) {
+ if (myExcludedBranches.contains(name)) return true;
+ for (Pattern regexp : myExcludedPatterns) {
+ if (regexp.matcher(name).matches()) return true;
+ }
+ return false;
+ }
+
+ @Nullable
@Override
- public Collection<String> getExcludedBranchNames() {
- return myExcludedBranchNames;
+ public String getSingleFilteredBranch() {
+ if (!myPatterns.isEmpty()) return null;
+ if (myBranches.size() != 1) return null;
+ String branch = myBranches.get(0);
+ return isExcluded(branch) ? null : branch;
+ }
+
+ private static boolean isRegexp(@NotNull String pattern) {
+ return StringUtil.containsAnyChar(pattern, "()[]{}.*?+^$\\|");
}
}
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VisiblePackBuilder.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VisiblePackBuilder.java
index 786faa8e91bcd..6de95c1da4343 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VisiblePackBuilder.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/data/VisiblePackBuilder.java
@@ -143,14 +143,11 @@ private Set<Integer> getMatchingHeads(@NotNull VcsLogRefs refs, @NotNull Set<Vir
return new HashSet<Integer>(ContainerUtil.intersection(filteredByBranch, filteredByFile));
}
- private Set<Integer> getMatchingHeads(@NotNull VcsLogRefs refs, @NotNull VcsLogBranchFilter filter) {
- final Collection<String> branchNames = new HashSet<String>(filter.getBranchNames());
- final Collection<String> excludedBranches = new HashSet<String>(filter.getExcludedBranchNames());
- final boolean filterByAcceptance = !filter.getBranchNames().isEmpty();
+ private Set<Integer> getMatchingHeads(@NotNull VcsLogRefs refs, @NotNull final VcsLogBranchFilter filter) {
return new HashSet<Integer>(ContainerUtil.mapNotNull(refs.getBranches(), new Function<VcsRef, Integer>() {
@Override
public Integer fun(@NotNull VcsRef ref) {
- boolean acceptRef = filterByAcceptance ? branchNames.contains(ref.getName()) : !excludedBranches.contains(ref.getName());
+ boolean acceptRef = filter.isShown(ref.getName());
return acceptRef ? myHashMap.getCommitIndex(ref.getCommitHash()) : null;
}
}));
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/CurrentBranchHighlighter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/CurrentBranchHighlighter.java
index 3b630295f1929..188fae696842b 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/CurrentBranchHighlighter.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/CurrentBranchHighlighter.java
@@ -17,7 +17,6 @@
import com.intellij.openapi.util.Condition;
import com.intellij.ui.JBColor;
-import com.intellij.util.containers.ContainerUtil;
import com.intellij.vcs.log.*;
import com.intellij.vcs.log.data.LoadingDetails;
import com.intellij.vcs.log.data.VcsLogDataHolder;
@@ -61,7 +60,7 @@ public VcsCommitStyle getStyle(int commitIndex, boolean isSelected) {
}
private boolean isFilteredByCurrentBranch(@NotNull String currentBranch, @NotNull VcsLogBranchFilter branchFilter) {
- return branchFilter.getBranchNames().size() == 1 && currentBranch.equals(ContainerUtil.getFirstItem(branchFilter.getBranchNames()));
+ return currentBranch.equals(branchFilter.getSingleFilteredBranch());
}
public static class Factory implements VcsLogHighlighterFactory {
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/BranchFilterPopupComponent.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/BranchFilterPopupComponent.java
index 2a85ae67add42..115bf3028d29c 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/BranchFilterPopupComponent.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/BranchFilterPopupComponent.java
@@ -42,51 +42,26 @@ public BranchFilterPopupComponent(@NotNull VcsLogUiProperties uiProperties,
@NotNull
@Override
protected String getText(@NotNull VcsLogBranchFilter filter) {
- boolean positiveMatch = !filter.getBranchNames().isEmpty();
- Collection<String> names = positiveMatch ? filter.getBranchNames() : addMinusPrefix(filter.getExcludedBranchNames());
- return displayableText(names);
+ return displayableText(getTextValues(filter));
}
@Nullable
@Override
protected String getToolTip(@NotNull VcsLogBranchFilter filter) {
- boolean positiveMatch = !filter.getBranchNames().isEmpty();
- Collection<String> names = positiveMatch ? filter.getBranchNames() : filter.getExcludedBranchNames();
- String tooltip = tooltip(names);
- return positiveMatch ? tooltip : "not in " + tooltip;
+ return tooltip(getTextValues(filter));
}
- @NotNull
+ @Nullable
@Override
protected VcsLogBranchFilter createFilter(@NotNull Collection<String> values) {
- Collection<String> acceptedBranches = ContainerUtil.newArrayList();
- Collection<String> excludedBranches = ContainerUtil.newArrayList();
- for (String value : values) {
- if (value.startsWith("-")) {
- excludedBranches.add(value.substring(1));
- }
- else {
- acceptedBranches.add(value);
- }
- }
- return new VcsLogBranchFilterImpl(acceptedBranches, excludedBranches);
+ return VcsLogBranchFilterImpl.fromTextPresentation(values);
}
@Override
@NotNull
protected Collection<String> getTextValues(@Nullable VcsLogBranchFilter filter) {
if (filter == null) return Collections.emptySet();
- return ContainerUtil.newArrayList(ContainerUtil.concat(filter.getBranchNames(), addMinusPrefix(filter.getExcludedBranchNames())));
- }
-
- @NotNull
- private static List<String> addMinusPrefix(@NotNull Collection<String> branchNames) {
- return ContainerUtil.map(branchNames, new Function<String, String>() {
- @Override
- public String fun(String branchName) {
- return "-" + branchName;
- }
- });
+ return filter.getTextPresentation();
}
@Override
diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/MultipleValueFilterPopupComponent.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/MultipleValueFilterPopupComponent.java
index 4b90f4bfbfd9a..795dd837dddb7 100644
--- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/MultipleValueFilterPopupComponent.java
+++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/filter/MultipleValueFilterPopupComponent.java
@@ -54,7 +54,7 @@ abstract class MultipleValueFilterPopupComponent<Filter extends VcsLogFilter> ex
@NotNull
protected abstract List<String> getAllValues();
- @NotNull
+ @Nullable
protected abstract Filter createFilter(@NotNull Collection<String> values);
@NotNull
diff --git a/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VisiblePackBuilderTest.kt b/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VisiblePackBuilderTest.kt
index 7cd1b8b7bb308..d2dd774aa0c62 100644
--- a/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VisiblePackBuilderTest.kt
+++ b/platform/vcs-log/impl/test/com/intellij/vcs/log/data/VisiblePackBuilderTest.kt
@@ -82,7 +82,7 @@ class VisiblePackBuilderTest {
3(4)
4()
}
- val visiblePack = graph.build(filters(VcsLogBranchFilterImpl(setOf(), setOf("master"))))
+ val visiblePack = graph.build(filters(VcsLogBranchFilterImpl.fromTextPresentation(setOf("-master"))))
val visibleGraph = visiblePack.getVisibleGraph()
assertEquals(3, visibleGraph.getVisibleCommitCount())
assertDoesNotContain(visibleGraph, 1)
@@ -109,7 +109,7 @@ class VisiblePackBuilderTest {
}
graph.providers.entrySet().iterator().next().getValue().setFilteredCommitsProvider(func)
- val visiblePack = graph.build(filters(VcsLogBranchFilterImpl(setOf(), setOf("master")), userFilter(DEFAULT_USER)))
+ val visiblePack = graph.build(filters(VcsLogBranchFilterImpl.fromTextPresentation(setOf("-master")), userFilter(DEFAULT_USER)))
val visibleGraph = visiblePack.getVisibleGraph()
assertEquals(3, visibleGraph.getVisibleCommitCount())
assertDoesNotContain(visibleGraph, 1)
@@ -181,7 +181,7 @@ class VisiblePackBuilderTest {
= VcsLogFilterCollectionImpl(branchFilter(branch), userFilter(user), null, null, null, null, null)
fun branchFilter(branch: List<String>?): VcsLogBranchFilterImpl? {
- return if (branch != null) VcsLogBranchFilterImpl(branch, setOf()) else null
+ return if (branch != null) VcsLogBranchFilterImpl.fromTextPresentation(branch) else null
}
fun userFilter(user: VcsUser?): VcsLogUserFilter? {
diff --git a/plugins/git4idea/src/git4idea/branch/DeepComparator.java b/plugins/git4idea/src/git4idea/branch/DeepComparator.java
index c1d3b31a5ec02..53a66eba96cc8 100644
--- a/plugins/git4idea/src/git4idea/branch/DeepComparator.java
+++ b/plugins/git4idea/src/git4idea/branch/DeepComparator.java
@@ -89,9 +89,7 @@ public void onChange(@NotNull VcsLogDataPack dataPack, boolean refreshHappened)
}
else {
VcsLogBranchFilter branchFilter = myUi.getFilterUi().getFilters().getBranchFilter();
- if (branchFilter == null ||
- branchFilter.getBranchNames().size() != 1 ||
- !branchFilter.getBranchNames().iterator().next().equals(myTask.myComparedBranch)) {
+ if (branchFilter == null || !myTask.myComparedBranch.equals(branchFilter.getSingleFilteredBranch())) {
stopAndUnhighlight();
}
}
diff --git a/plugins/git4idea/src/git4idea/branch/DeepCompareAction.java b/plugins/git4idea/src/git4idea/branch/DeepCompareAction.java
index 10f27c6160779..90e585f27ca00 100644
--- a/plugins/git4idea/src/git4idea/branch/DeepCompareAction.java
+++ b/plugins/git4idea/src/git4idea/branch/DeepCompareAction.java
@@ -64,18 +64,18 @@ public void setSelected(AnActionEvent e, boolean selected) {
final DeepComparator dc = DeepComparator.getInstance(project, ui);
if (selected) {
VcsLogBranchFilter branchFilter = ui.getFilterUi().getFilters().getBranchFilter();
- if (branchFilter == null || branchFilter.getBranchNames().size() != 1) {
+ String singleBranchName = branchFilter != null ? branchFilter.getSingleFilteredBranch() : null;
+ if (singleBranchName == null) {
selectBranchAndPerformAction(ui.getDataPack(), e, new Consumer<String>() {
@Override
public void consume(String selectedBranch) {
- ui.getFilterUi().setFilter(new VcsLogBranchFilterImpl(Collections.singleton(selectedBranch), Collections.<String>emptySet()));
+ ui.getFilterUi().setFilter(VcsLogBranchFilterImpl.fromBranch(selectedBranch));
dc.highlightInBackground(selectedBranch, dataProvider);
}
}, getAllVisibleRoots(ui));
return;
}
- String branchToCompare = branchFilter.getBranchNames().iterator().next();
- dc.highlightInBackground(branchToCompare, dataProvider);
+ dc.highlightInBackground(singleBranchName, dataProvider);
}
else {
dc.stopAndUnhighlight();
diff --git a/plugins/git4idea/src/git4idea/log/GitLogProvider.java b/plugins/git4idea/src/git4idea/log/GitLogProvider.java
index 16a42c505dfd8..99fa4f3f829dc 100644
--- a/plugins/git4idea/src/git4idea/log/GitLogProvider.java
+++ b/plugins/git4idea/src/git4idea/log/GitLogProvider.java
@@ -405,17 +405,37 @@ public List<TimedVcsCommit> getCommitsMatchingFilter(@NotNull final VirtualFile
List<String> filterParameters = ContainerUtil.newArrayList();
- if (filterCollection.getBranchFilter() != null && !filterCollection.getBranchFilter().getBranchNames().isEmpty()) {
+ VcsLogBranchFilter branchFilter = filterCollection.getBranchFilter();
+ if (branchFilter != null) {
GitRepository repository = getRepository(root);
assert repository != null : "repository is null for root " + root + " but was previously reported as 'ready'";
+ Collection<GitLocalBranch> localBranches = repository.getBranches().getLocalBranches();
+ Collection<String> localBranchNames = ContainerUtil.map(localBranches, new Function<GitLocalBranch, String>() {
+ @Override
+ public String fun(GitLocalBranch branch) {
+ return branch.getName();
+ }
+ });
+
+ Collection<GitRemoteBranch> remoteBranches = repository.getBranches().getRemoteBranches();
+ Collection<String> remoteBranchNames = ContainerUtil.map(remoteBranches, new Function<GitRemoteBranch, String>() {
+ @Override
+ public String fun(GitRemoteBranch branch) {
+ return branch.getNameForLocalOperations();
+ }
+ });
+
+ Collection<String> predefinedNames = ContainerUtil.list("HEAD");
+
boolean atLeastOneBranchExists = false;
- for (String branchName : filterCollection.getBranchFilter().getBranchNames()) {
- if (branchName.equals("HEAD") || repository.getBranches().findBranchByName(branchName) != null) {
+ for (String branchName: ContainerUtil.concat(localBranchNames, remoteBranchNames, predefinedNames)) {
+ if (branchFilter.isShown(branchName)) {
filterParameters.add(branchName);
atLeastOneBranchExists = true;
}
}
+
if (!atLeastOneBranchExists) { // no such branches in this repository => filter matches nothing
return Collections.emptyList();
}
diff --git a/plugins/git4idea/tests/git4idea/log/GitLogProviderTest.java b/plugins/git4idea/tests/git4idea/log/GitLogProviderTest.java
index 9501ddc03ce6e..6a2c5a8eff194 100644
--- a/plugins/git4idea/tests/git4idea/log/GitLogProviderTest.java
+++ b/plugins/git4idea/tests/git4idea/log/GitLogProviderTest.java
@@ -166,14 +166,14 @@ public boolean value(VcsRef ref) {
public void test_filter_by_branch() throws Exception {
List<String> hashes = generateHistoryForFilters(true);
- VcsLogBranchFilter branchFilter = new VcsLogBranchFilterImpl(singleton("feature"), Collections.<String>emptySet());
+ VcsLogBranchFilter branchFilter = VcsLogBranchFilterImpl.fromBranch("feature");
List<String> actualHashes = getFilteredHashes(branchFilter, null);
assertEquals(hashes, actualHashes);
}
public void test_filter_by_branch_and_user() throws Exception {
List<String> hashes = generateHistoryForFilters(false);
- VcsLogBranchFilter branchFilter = new VcsLogBranchFilterImpl(singleton("feature"), Collections.<String>emptySet());
+ VcsLogBranchFilter branchFilter = VcsLogBranchFilterImpl.fromBranch("feature");
VcsLogUserFilter userFilter = new VcsLogUserFilterImpl(singleton(GitTestUtil.USER_NAME), Collections.<VirtualFile, VcsUser>emptyMap(),
Collections.<VcsUser>emptySet());
List<String> actualHashes = getFilteredHashes(branchFilter, userFilter);
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
index ea99a67bdd194..e1738be9552ac 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/log/HgLogProvider.java
@@ -176,31 +176,38 @@ public void update(Project project, @Nullable VirtualFile root) {
@NotNull
@Override
public List<TimedVcsCommit> getCommitsMatchingFilter(@NotNull final VirtualFile root,
- @NotNull VcsLogFilterCollection filterCollection,
- int maxCount) throws VcsException {
+ @NotNull VcsLogFilterCollection filterCollection,
+ int maxCount) throws VcsException {
List<String> filterParameters = ContainerUtil.newArrayList();
// branch filter and user filter may be used several times without delimiter
- if (filterCollection.getBranchFilter() != null && !filterCollection.getBranchFilter().getBranchNames().isEmpty()) {
+ VcsLogBranchFilter branchFilter = filterCollection.getBranchFilter();
+ if (branchFilter != null) {
HgRepository repository = myRepositoryManager.getRepositoryForRoot(root);
if (repository == null) {
LOG.error("Repository not found for root " + root);
return Collections.emptyList();
}
+ Collection<String> branchNames = repository.getBranches().keySet();
+ Collection<String> bookmarkNames = HgUtil.getNamesWithoutHashes(repository.getBookmarks());
+ Collection<String> predefinedNames = ContainerUtil.list(TIP_REFERENCE);
+
boolean atLeastOneBranchExists = false;
- for (String branchName : filterCollection.getBranchFilter().getBranchNames()) {
- if (branchName.equals(TIP_REFERENCE) || branchExists(repository, branchName)) {
+ for (String branchName : ContainerUtil.concat(branchNames, bookmarkNames, predefinedNames)) {
+ if (branchFilter.isShown(branchName)) {
filterParameters.add(HgHistoryUtil.prepareParameter("branch", branchName));
atLeastOneBranchExists = true;
}
- else if (branchName.equals(HEAD_REFERENCE)) {
- filterParameters.add(HgHistoryUtil.prepareParameter("branch", "."));
- filterParameters.add("-r");
- filterParameters.add("::."); //all ancestors for current revision;
- atLeastOneBranchExists = true;
- }
}
+
+ if (branchFilter.isShown(HEAD_REFERENCE)) {
+ filterParameters.add(HgHistoryUtil.prepareParameter("branch", "."));
+ filterParameters.add("-r");
+ filterParameters.add("::."); //all ancestors for current revision;
+ atLeastOneBranchExists = true;
+ }
+
if (!atLeastOneBranchExists) { // no such branches => filter matches nothing
return Collections.emptyList();
}
@@ -287,10 +294,4 @@ public String getCurrentBranch(@NotNull VirtualFile root) {
public <T> T getPropertyValue(VcsLogProperties.VcsLogProperty<T> property) {
return null;
}
-
- private static boolean branchExists(@NotNull HgRepository repository, @NotNull String branchName) {
- return repository.getBranches().keySet().contains(branchName) ||
- HgUtil.getNamesWithoutHashes(repository.getBookmarks()).contains(branchName);
- }
-
}
|
f6892a2e31f7db9fb37caf38b66826ffb496deca
|
tapiji
|
Renames `StringLiteralAuditor` to `I18nBuilder`.
Addresses Issue 72.
|
p
|
https://github.com/tapiji/tapiji
|
diff --git a/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/quickfix/CreateResourceBundleEntry.java b/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/quickfix/CreateResourceBundleEntry.java
index 66dcb9d6..43d2a728 100644
--- a/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/quickfix/CreateResourceBundleEntry.java
+++ b/org.eclipse.babel.tapiji.tools.core.ui/src/org/eclipse/babel/tapiji/tools/core/ui/quickfix/CreateResourceBundleEntry.java
@@ -1,7 +1,7 @@
package org.eclipse.babel.tapiji.tools.core.ui.quickfix;
import org.eclipse.babel.tapiji.tools.core.Logger;
-import org.eclipse.babel.tapiji.tools.core.builder.StringLiteralAuditor;
+import org.eclipse.babel.tapiji.tools.core.builder.I18nBuilder;
import org.eclipse.babel.tapiji.tools.core.ui.dialogs.CreateResourceBundleEntryDialog;
import org.eclipse.babel.tapiji.tools.core.ui.dialogs.CreateResourceBundleEntryDialog.DialogConfiguration;
import org.eclipse.core.filebuffers.FileBuffers;
@@ -17,72 +17,73 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IMarkerResolution2;
-
public class CreateResourceBundleEntry implements IMarkerResolution2 {
- private String key;
- private String bundleId;
-
- public CreateResourceBundleEntry (String key, String bundleId) {
- this.key = key;
- this.bundleId = bundleId;
- }
-
- @Override
- public String getDescription() {
- return "Creates a new Resource-Bundle entry for the property-key '" + key + "'";
- }
+ private String key;
+ private String bundleId;
- @Override
- public Image getImage() {
- // TODO Auto-generated method stub
- return null;
- }
+ public CreateResourceBundleEntry(String key, String bundleId) {
+ this.key = key;
+ this.bundleId = bundleId;
+ }
- @Override
- public String getLabel() {
- return "Create Resource-Bundle entry for '" + key + "'";
- }
+ @Override
+ public String getDescription() {
+ return "Creates a new Resource-Bundle entry for the property-key '"
+ + key + "'";
+ }
+
+ @Override
+ public Image getImage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getLabel() {
+ return "Create Resource-Bundle entry for '" + key + "'";
+ }
- @Override
- public void run(IMarker marker) {
- int startPos = marker.getAttribute(IMarker.CHAR_START, 0);
- int endPos = marker.getAttribute(IMarker.CHAR_END, 0) - startPos;
- IResource resource = marker.getResource();
-
- ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
- IPath path = resource.getRawLocation();
- try {
- bufferManager.connect(path, null);
- ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path);
- IDocument document = textFileBuffer.getDocument();
-
- CreateResourceBundleEntryDialog dialog = new CreateResourceBundleEntryDialog(
- Display.getDefault().getActiveShell());
-
- DialogConfiguration config = dialog.new DialogConfiguration();
- config.setPreselectedKey(key != null ? key : "");
- config.setPreselectedMessage("");
- config.setPreselectedBundle(bundleId);
- config.setPreselectedLocale("");
- config.setProjectName(resource.getProject().getName());
-
- dialog.setDialogConfiguration(config);
-
-
- if (dialog.open() != InputDialog.OK)
- return;
- } catch (Exception e) {
- Logger.logError(e);
- } finally {
- try {
- (new StringLiteralAuditor()).buildResource(resource, null);
- bufferManager.disconnect(path, null);
- } catch (CoreException e) {
- Logger.logError(e);
- }
- }
-
+ @Override
+ public void run(IMarker marker) {
+ int startPos = marker.getAttribute(IMarker.CHAR_START, 0);
+ int endPos = marker.getAttribute(IMarker.CHAR_END, 0) - startPos;
+ IResource resource = marker.getResource();
+
+ ITextFileBufferManager bufferManager = FileBuffers
+ .getTextFileBufferManager();
+ IPath path = resource.getRawLocation();
+ try {
+ bufferManager.connect(path, null);
+ ITextFileBuffer textFileBuffer = bufferManager
+ .getTextFileBuffer(path);
+ IDocument document = textFileBuffer.getDocument();
+
+ CreateResourceBundleEntryDialog dialog = new CreateResourceBundleEntryDialog(
+ Display.getDefault().getActiveShell());
+
+ DialogConfiguration config = dialog.new DialogConfiguration();
+ config.setPreselectedKey(key != null ? key : "");
+ config.setPreselectedMessage("");
+ config.setPreselectedBundle(bundleId);
+ config.setPreselectedLocale("");
+ config.setProjectName(resource.getProject().getName());
+
+ dialog.setDialogConfiguration(config);
+
+ if (dialog.open() != InputDialog.OK)
+ return;
+ } catch (Exception e) {
+ Logger.logError(e);
+ } finally {
+ try {
+ (new I18nBuilder()).buildResource(resource, null);
+ bufferManager.disconnect(path, null);
+ } catch (CoreException e) {
+ Logger.logError(e);
+ }
}
+ }
+
}
diff --git a/org.eclipse.babel.tapiji.tools.core/plugin.xml b/org.eclipse.babel.tapiji.tools.core/plugin.xml
index 01d63c9d..dc6c1959 100644
--- a/org.eclipse.babel.tapiji.tools.core/plugin.xml
+++ b/org.eclipse.babel.tapiji.tools.core/plugin.xml
@@ -8,7 +8,7 @@
id="I18NBuilder"
point="org.eclipse.core.resources.builders">
<builder hasNature="true">
- <run class="org.eclipse.babel.tapiji.tools.core.builder.StringLiteralAuditor" />
+ <run class="org.eclipse.babel.tapiji.tools.core.builder.I18nBuilder" />
</builder>
</extension>
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/BuilderPropertyChangeListener.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/BuilderPropertyChangeListener.java
index 8d79d491..4dda8a44 100644
--- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/BuilderPropertyChangeListener.java
+++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/BuilderPropertyChangeListener.java
@@ -19,99 +19,106 @@
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.widgets.Display;
-
public class BuilderPropertyChangeListener implements IPropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getNewValue().equals(true) && isTapiPropertyp(event))
- rebuild();
-
- if (event.getProperty().equals(TapiJIPreferences.NON_RB_PATTERN))
- rebuild();
-
- if (event.getNewValue().equals(false)){
- if (event.getProperty().equals(TapiJIPreferences.AUDIT_RESOURCE)){
- removeProperty(EditorUtils.MARKER_ID, -1);
- }
- if (event.getProperty().equals(TapiJIPreferences.AUDIT_RB)){
- removeProperty(EditorUtils.RB_MARKER_ID, -1);
- }
- if (event.getProperty().equals(TapiJIPreferences.AUDIT_UNSPEZIFIED_KEY)){
- removeProperty(EditorUtils.RB_MARKER_ID, IMarkerConstants.CAUSE_UNSPEZIFIED_KEY);
- }
- if (event.getProperty().equals(TapiJIPreferences.AUDIT_SAME_VALUE)){
- removeProperty(EditorUtils.RB_MARKER_ID, IMarkerConstants.CAUSE_SAME_VALUE);
- }
- if (event.getProperty().equals(TapiJIPreferences.AUDIT_MISSING_LANGUAGE)){
- removeProperty(EditorUtils.RB_MARKER_ID, IMarkerConstants.CAUSE_MISSING_LANGUAGE);
- }
- }
-
- }
-
- private boolean isTapiPropertyp(PropertyChangeEvent event) {
- if (event.getProperty().equals(TapiJIPreferences.AUDIT_RESOURCE) ||
- event.getProperty().equals(TapiJIPreferences.AUDIT_RB) ||
- event.getProperty().equals(TapiJIPreferences.AUDIT_UNSPEZIFIED_KEY) ||
- event.getProperty().equals(TapiJIPreferences.AUDIT_SAME_VALUE) ||
- event.getProperty().equals(TapiJIPreferences.AUDIT_MISSING_LANGUAGE))
- return true;
- else return false;
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getNewValue().equals(true) && isTapiPropertyp(event))
+ rebuild();
+
+ if (event.getProperty().equals(TapiJIPreferences.NON_RB_PATTERN))
+ rebuild();
+
+ if (event.getNewValue().equals(false)) {
+ if (event.getProperty().equals(TapiJIPreferences.AUDIT_RESOURCE)) {
+ removeProperty(EditorUtils.MARKER_ID, -1);
+ }
+ if (event.getProperty().equals(TapiJIPreferences.AUDIT_RB)) {
+ removeProperty(EditorUtils.RB_MARKER_ID, -1);
+ }
+ if (event.getProperty().equals(
+ TapiJIPreferences.AUDIT_UNSPEZIFIED_KEY)) {
+ removeProperty(EditorUtils.RB_MARKER_ID,
+ IMarkerConstants.CAUSE_UNSPEZIFIED_KEY);
+ }
+ if (event.getProperty().equals(TapiJIPreferences.AUDIT_SAME_VALUE)) {
+ removeProperty(EditorUtils.RB_MARKER_ID,
+ IMarkerConstants.CAUSE_SAME_VALUE);
+ }
+ if (event.getProperty().equals(
+ TapiJIPreferences.AUDIT_MISSING_LANGUAGE)) {
+ removeProperty(EditorUtils.RB_MARKER_ID,
+ IMarkerConstants.CAUSE_MISSING_LANGUAGE);
+ }
}
- /*
- * cause == -1 ignores the attribute 'case'
- */
- private void removeProperty(final String markertpye, final int cause){
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- @Override
- public void run() {
- IMarker[] marker;
- try {
- marker = workspace.getRoot().findMarkers(markertpye, true, IResource.DEPTH_INFINITE);
-
- for (IMarker m : marker){
- if (m.exists()){
- if (m.getAttribute("cause", -1) == cause)
- m.delete();
- if (cause == -1)
- m.getResource().deleteMarkers(markertpye, true, IResource.DEPTH_INFINITE);
- }
- }
- } catch (CoreException e) {
- }
+ }
+
+ private boolean isTapiPropertyp(PropertyChangeEvent event) {
+ if (event.getProperty().equals(TapiJIPreferences.AUDIT_RESOURCE)
+ || event.getProperty().equals(TapiJIPreferences.AUDIT_RB)
+ || event.getProperty().equals(
+ TapiJIPreferences.AUDIT_UNSPEZIFIED_KEY)
+ || event.getProperty().equals(
+ TapiJIPreferences.AUDIT_SAME_VALUE)
+ || event.getProperty().equals(
+ TapiJIPreferences.AUDIT_MISSING_LANGUAGE))
+ return true;
+ else
+ return false;
+ }
+
+ /*
+ * cause == -1 ignores the attribute 'case'
+ */
+ private void removeProperty(final String markertpye, final int cause) {
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
+ @Override
+ public void run() {
+ IMarker[] marker;
+ try {
+ marker = workspace.getRoot().findMarkers(markertpye, true,
+ IResource.DEPTH_INFINITE);
+
+ for (IMarker m : marker) {
+ if (m.exists()) {
+ if (m.getAttribute("cause", -1) == cause)
+ m.delete();
+ if (cause == -1)
+ m.getResource().deleteMarkers(markertpye, true,
+ IResource.DEPTH_INFINITE);
}
- });
- }
-
- private void rebuild(){
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
-
- new Job ("Audit source files") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- for (IResource res : workspace.getRoot().members()){
- final IProject p = (IProject) res;
- try {
- p.build ( StringLiteralAuditor.FULL_BUILD,
- StringLiteralAuditor.BUILDER_ID,
- null,
- monitor);
- } catch (CoreException e) {
- Logger.logError(e);
- }
- }
- } catch (CoreException e) {
- Logger.logError(e);
- }
- return Status.OK_STATUS;
+ }
+ } catch (CoreException e) {
+ }
+ }
+ });
+ }
+
+ private void rebuild() {
+ final IWorkspace workspace = ResourcesPlugin.getWorkspace();
+
+ new Job("Audit source files") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ for (IResource res : workspace.getRoot().members()) {
+ final IProject p = (IProject) res;
+ try {
+ p.build(I18nBuilder.FULL_BUILD,
+ I18nBuilder.BUILDER_ID, null, monitor);
+ } catch (CoreException e) {
+ Logger.logError(e);
}
-
- }.schedule();
- }
-
+ }
+ } catch (CoreException e) {
+ Logger.logError(e);
+ }
+ return Status.OK_STATUS;
+ }
+
+ }.schedule();
+ }
+
}
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/I18nBuilder.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/I18nBuilder.java
new file mode 100644
index 00000000..8e9083c8
--- /dev/null
+++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/I18nBuilder.java
@@ -0,0 +1,451 @@
+package org.eclipse.babel.tapiji.tools.core.builder;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.babel.core.configuration.ConfigurationManager;
+import org.eclipse.babel.core.configuration.IConfiguration;
+import org.eclipse.babel.tapiji.tools.core.Activator;
+import org.eclipse.babel.tapiji.tools.core.Logger;
+import org.eclipse.babel.tapiji.tools.core.builder.analyzer.RBAuditor;
+import org.eclipse.babel.tapiji.tools.core.builder.analyzer.ResourceFinder;
+import org.eclipse.babel.tapiji.tools.core.extensions.I18nAuditor;
+import org.eclipse.babel.tapiji.tools.core.extensions.I18nRBAuditor;
+import org.eclipse.babel.tapiji.tools.core.extensions.I18nResourceAuditor;
+import org.eclipse.babel.tapiji.tools.core.extensions.ILocation;
+import org.eclipse.babel.tapiji.tools.core.extensions.IMarkerConstants;
+import org.eclipse.babel.tapiji.tools.core.model.exception.NoSuchResourceAuditorException;
+import org.eclipse.babel.tapiji.tools.core.model.manager.ResourceBundleManager;
+import org.eclipse.babel.tapiji.tools.core.model.preferences.TapiJIPreferences;
+import org.eclipse.babel.tapiji.tools.core.util.EditorUtils;
+import org.eclipse.babel.tapiji.tools.core.util.RBFileUtils;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.util.IPropertyChangeListener;
+
+public class I18nBuilder extends IncrementalProjectBuilder {
+
+ public static final String BUILDER_ID = Activator.PLUGIN_ID
+ + ".I18NBuilder";
+
+ private static I18nAuditor[] resourceAuditors;
+ private static Set<String> supportedFileEndings;
+ private static IPropertyChangeListener listner;
+
+ static {
+ List<I18nAuditor> auditors = new ArrayList<I18nAuditor>();
+ supportedFileEndings = new HashSet<String>();
+
+ // init default auditors
+ auditors.add(new RBAuditor());
+
+ // lookup registered auditor extensions
+ IConfigurationElement[] config = Platform.getExtensionRegistry()
+ .getConfigurationElementsFor(Activator.BUILDER_EXTENSION_ID);
+
+ try {
+ for (IConfigurationElement e : config) {
+ I18nAuditor a = (I18nAuditor) e
+ .createExecutableExtension("class");
+ auditors.add(a);
+ supportedFileEndings.addAll(Arrays.asList(a.getFileEndings()));
+ }
+ } catch (CoreException ex) {
+ Logger.logError(ex);
+ }
+
+ resourceAuditors = auditors.toArray(new I18nAuditor[auditors.size()]);
+
+ listner = new BuilderPropertyChangeListener();
+ TapiJIPreferences.addPropertyChangeListener(listner);
+ }
+
+ public I18nBuilder() {
+ }
+
+ public static I18nAuditor getI18nAuditorByContext(String contextId)
+ throws NoSuchResourceAuditorException {
+ for (I18nAuditor auditor : resourceAuditors) {
+ if (auditor.getContextId().equals(contextId))
+ return auditor;
+ }
+ throw new NoSuchResourceAuditorException();
+ }
+
+ private Set<String> getSupportedFileExt() {
+ return supportedFileEndings;
+ }
+
+ public static boolean isResourceAuditable(IResource resource,
+ Set<String> supportedExtensions) {
+ for (String ext : supportedExtensions) {
+ if (resource.getType() == IResource.FILE && !resource.isDerived()
+ && resource.getFileExtension() != null
+ && (resource.getFileExtension().equalsIgnoreCase(ext))) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected IProject[] build(final int kind, Map args,
+ IProgressMonitor monitor) throws CoreException {
+
+ ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
+ @Override
+ public void run(IProgressMonitor monitor) throws CoreException {
+ if (kind == FULL_BUILD) {
+ fullBuild(monitor);
+ } else {
+ // only perform audit if the resource delta is not empty
+ IResourceDelta resDelta = getDelta(getProject());
+
+ if (resDelta == null)
+ return;
+
+ if (resDelta.getAffectedChildren() == null)
+ return;
+
+ incrementalBuild(monitor, resDelta);
+ }
+ }
+ }, monitor);
+
+ return null;
+ }
+
+ private void incrementalBuild(IProgressMonitor monitor,
+ IResourceDelta resDelta) throws CoreException {
+ try {
+ // inspect resource delta
+ ResourceFinder csrav = new ResourceFinder(getSupportedFileExt());
+ resDelta.accept(csrav);
+ auditResources(csrav.getResources(), monitor, getProject());
+ } catch (CoreException e) {
+ Logger.logError(e);
+ }
+ }
+
+ public void buildResource(IResource resource, IProgressMonitor monitor) {
+ if (isResourceAuditable(resource, getSupportedFileExt())) {
+ List<IResource> resources = new ArrayList<IResource>();
+ resources.add(resource);
+ // TODO: create instance of progressmonitor and hand it over to
+ // auditResources
+ try {
+ auditResources(resources, monitor, resource.getProject());
+ } catch (Exception e) {
+ Logger.logError(e);
+ }
+ }
+ }
+
+ public void buildProject(IProgressMonitor monitor, IProject proj) {
+ try {
+ ResourceFinder csrav = new ResourceFinder(getSupportedFileExt());
+ proj.accept(csrav);
+ auditResources(csrav.getResources(), monitor, proj);
+ } catch (CoreException e) {
+ Logger.logError(e);
+ }
+ }
+
+ private void fullBuild(IProgressMonitor monitor) {
+ buildProject(monitor, getProject());
+ }
+
+ private void auditResources(List<IResource> resources,
+ IProgressMonitor monitor, IProject project) {
+ IConfiguration configuration = ConfigurationManager.getInstance()
+ .getConfiguration();
+
+ int work = resources.size();
+ int actWork = 0;
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ monitor.beginTask(
+ "Audit resource file for Internationalization problems", work);
+
+ for (IResource resource : resources) {
+ monitor.subTask("'" + resource.getFullPath().toOSString() + "'");
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+
+ if (!EditorUtils.deleteAuditMarkersForResource(resource))
+ continue;
+
+ if (ResourceBundleManager.isResourceExcluded(resource))
+ continue;
+
+ if (!resource.exists())
+ continue;
+
+ for (I18nAuditor ra : resourceAuditors) {
+ if (ra instanceof I18nResourceAuditor
+ && !(configuration.getAuditResource()))
+ continue;
+ if (ra instanceof I18nRBAuditor
+ && !(configuration.getAuditRb()))
+ continue;
+
+ try {
+ if (monitor.isCanceled()) {
+ monitor.done();
+ break;
+ }
+
+ if (ra.isResourceOfType(resource)) {
+ ra.audit(resource);
+ }
+ } catch (Exception e) {
+ Logger.logError(
+ "Error during auditing '" + resource.getFullPath()
+ + "'", e);
+ }
+ }
+
+ if (monitor != null)
+ monitor.worked(1);
+ }
+
+ for (I18nAuditor a : resourceAuditors) {
+ if (a instanceof I18nResourceAuditor) {
+ handleI18NAuditorMarkers((I18nResourceAuditor) a);
+ }
+ if (a instanceof I18nRBAuditor) {
+ handleI18NAuditorMarkers((I18nRBAuditor) a);
+ ((I18nRBAuditor) a).resetProblems();
+ }
+ }
+
+ monitor.done();
+ }
+
+ private void handleI18NAuditorMarkers(I18nResourceAuditor ra) {
+ try {
+ for (ILocation problem : ra.getConstantStringLiterals()) {
+ EditorUtils.reportToMarker(EditorUtils.getFormattedMessage(
+ EditorUtils.MESSAGE_NON_LOCALIZED_LITERAL,
+ new String[] { problem.getLiteral() }), problem,
+ IMarkerConstants.CAUSE_CONSTANT_LITERAL, "",
+ (ILocation) problem.getData(), ra.getContextId());
+ }
+
+ // Report all broken Resource-Bundle references
+ for (ILocation brokenLiteral : ra.getBrokenResourceReferences()) {
+ EditorUtils.reportToMarker(EditorUtils.getFormattedMessage(
+ EditorUtils.MESSAGE_BROKEN_RESOURCE_REFERENCE,
+ new String[] {
+ brokenLiteral.getLiteral(),
+ ((ILocation) brokenLiteral.getData())
+ .getLiteral() }), brokenLiteral,
+ IMarkerConstants.CAUSE_BROKEN_REFERENCE, brokenLiteral
+ .getLiteral(), (ILocation) brokenLiteral
+ .getData(), ra.getContextId());
+ }
+
+ // Report all broken definitions to Resource-Bundle
+ // references
+ for (ILocation brokenLiteral : ra.getBrokenBundleReferences()) {
+ EditorUtils.reportToMarker(EditorUtils.getFormattedMessage(
+ EditorUtils.MESSAGE_BROKEN_RESOURCE_BUNDLE_REFERENCE,
+ new String[] { brokenLiteral.getLiteral() }),
+ brokenLiteral,
+ IMarkerConstants.CAUSE_BROKEN_RB_REFERENCE,
+ brokenLiteral.getLiteral(), (ILocation) brokenLiteral
+ .getData(), ra.getContextId());
+ }
+ } catch (Exception e) {
+ Logger.logError(
+ "Exception during reporting of Internationalization errors",
+ e);
+ }
+ }
+
+ private void handleI18NAuditorMarkers(I18nRBAuditor ra) {
+ IConfiguration configuration = ConfigurationManager.getInstance()
+ .getConfiguration();
+ try {
+ // Report all unspecified keys
+ if (configuration.getAuditMissingValue())
+ for (ILocation problem : ra.getUnspecifiedKeyReferences()) {
+ EditorUtils.reportToRBMarker(EditorUtils
+ .getFormattedMessage(
+ EditorUtils.MESSAGE_UNSPECIFIED_KEYS,
+ new String[] { problem.getLiteral(),
+ problem.getFile().getName() }),
+ problem, IMarkerConstants.CAUSE_UNSPEZIFIED_KEY,
+ problem.getLiteral(), "", (ILocation) problem
+ .getData(), ra.getContextId());
+ }
+
+ // Report all same values
+ if (configuration.getAuditSameValue()) {
+ Map<ILocation, ILocation> sameValues = ra
+ .getSameValuesReferences();
+ for (ILocation problem : sameValues.keySet()) {
+ EditorUtils.reportToRBMarker(EditorUtils
+ .getFormattedMessage(
+ EditorUtils.MESSAGE_SAME_VALUE,
+ new String[] {
+ problem.getFile().getName(),
+ sameValues.get(problem).getFile()
+ .getName(),
+ problem.getLiteral() }), problem,
+ IMarkerConstants.CAUSE_SAME_VALUE, problem
+ .getLiteral(), sameValues.get(problem)
+ .getFile().getName(), (ILocation) problem
+ .getData(), ra.getContextId());
+ }
+ }
+ // Report all missing languages
+ if (configuration.getAuditMissingLanguage())
+ for (ILocation problem : ra.getMissingLanguageReferences()) {
+ EditorUtils
+ .reportToRBMarker(
+ EditorUtils
+ .getFormattedMessage(
+ EditorUtils.MESSAGE_MISSING_LANGUAGE,
+ new String[] {
+ RBFileUtils
+ .getCorrespondingResourceBundleId(problem
+ .getFile()),
+ problem.getLiteral() }),
+ problem,
+ IMarkerConstants.CAUSE_MISSING_LANGUAGE,
+ problem.getLiteral(), "",
+ (ILocation) problem.getData(), ra
+ .getContextId());
+ }
+ } catch (Exception e) {
+ Logger.logError(
+ "Exception during reporting of Internationalization errors",
+ e);
+ }
+ }
+
+ @SuppressWarnings("unused")
+ private void setProgress(IProgressMonitor monitor, int progress)
+ throws InterruptedException {
+ monitor.worked(progress);
+
+ if (monitor.isCanceled())
+ throw new OperationCanceledException();
+
+ if (isInterrupted())
+ throw new InterruptedException();
+ }
+
+ @Override
+ protected void clean(IProgressMonitor monitor) throws CoreException {
+ // TODO Auto-generated method stub
+ super.clean(monitor);
+ }
+
+ public static void addBuilderToProject(IProject project) {
+ Logger.logInfo("Internationalization-Builder registered for '"
+ + project.getName() + "'");
+
+ // Only for open projects
+ if (!project.isOpen())
+ return;
+
+ IProjectDescription description = null;
+ try {
+ description = project.getDescription();
+ } catch (CoreException e) {
+ Logger.logError(e);
+ return;
+ }
+
+ // Check if the builder is already associated to the specified project
+ ICommand[] commands = description.getBuildSpec();
+ for (ICommand command : commands) {
+ if (command.getBuilderName().equals(BUILDER_ID))
+ return;
+ }
+
+ // Associate the builder with the project
+ ICommand builderCmd = description.newCommand();
+ builderCmd.setBuilderName(BUILDER_ID);
+ List<ICommand> newCommands = new ArrayList<ICommand>();
+ newCommands.addAll(Arrays.asList(commands));
+ newCommands.add(builderCmd);
+ description.setBuildSpec(newCommands.toArray(new ICommand[newCommands
+ .size()]));
+
+ try {
+ project.setDescription(description, null);
+ } catch (CoreException e) {
+ Logger.logError(e);
+ }
+ }
+
+ public static void removeBuilderFromProject(IProject project) {
+ // Only for open projects
+ if (!project.isOpen())
+ return;
+
+ try {
+ project.deleteMarkers(EditorUtils.MARKER_ID, false,
+ IResource.DEPTH_INFINITE);
+ project.deleteMarkers(EditorUtils.RB_MARKER_ID, false,
+ IResource.DEPTH_INFINITE);
+ } catch (CoreException e1) {
+ Logger.logError(e1);
+ }
+
+ IProjectDescription description = null;
+ try {
+ description = project.getDescription();
+ } catch (CoreException e) {
+ Logger.logError(e);
+ return;
+ }
+
+ // remove builder from project
+ int idx = -1;
+ ICommand[] commands = description.getBuildSpec();
+ for (int i = 0; i < commands.length; i++) {
+ if (commands[i].getBuilderName().equals(BUILDER_ID)) {
+ idx = i;
+ break;
+ }
+ }
+ if (idx == -1)
+ return;
+
+ List<ICommand> newCommands = new ArrayList<ICommand>();
+ newCommands.addAll(Arrays.asList(commands));
+ newCommands.remove(idx);
+ description.setBuildSpec(newCommands.toArray(new ICommand[newCommands
+ .size()]));
+
+ try {
+ project.setDescription(description, null);
+ } catch (CoreException e) {
+ Logger.logError(e);
+ }
+
+ }
+
+}
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/InternationalizationNature.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/InternationalizationNature.java
index bcf4640d..6aaf12b0 100644
--- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/InternationalizationNature.java
+++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/InternationalizationNature.java
@@ -15,120 +15,117 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
-
public class InternationalizationNature implements IProjectNature {
- private static final String NATURE_ID = Activator.PLUGIN_ID + ".nature";
- private IProject project;
-
- @Override
- public void configure() throws CoreException {
- StringLiteralAuditor.addBuilderToProject(project);
- new Job ("Audit source files") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- project.build ( StringLiteralAuditor.FULL_BUILD,
- StringLiteralAuditor.BUILDER_ID,
- null,
- monitor);
- } catch (CoreException e) {
- Logger.logError(e);
- }
- return Status.OK_STATUS;
- }
-
- }.schedule();
- }
-
- @Override
- public void deconfigure() throws CoreException {
- StringLiteralAuditor.removeBuilderFromProject(project);
- }
-
- @Override
- public IProject getProject() {
- return project;
- }
+ private static final String NATURE_ID = Activator.PLUGIN_ID + ".nature";
+ private IProject project;
- @Override
- public void setProject(IProject project) {
- this.project = project;
- }
+ @Override
+ public void configure() throws CoreException {
+ I18nBuilder.addBuilderToProject(project);
+ new Job("Audit source files") {
- public static void addNature(IProject project) {
- if (!project.isOpen())
- return;
-
- IProjectDescription description = null;
-
- try {
- description = project.getDescription();
- } catch (CoreException e) {
- Logger.logError(e);
- return;
- }
-
- // Check if the project has already this nature
- List<String> newIds = new ArrayList<String> ();
- newIds.addAll (Arrays.asList(description.getNatureIds()));
- int index = newIds.indexOf (NATURE_ID);
- if (index != -1)
- return;
-
- // Add the nature
- newIds.add (NATURE_ID);
- description.setNatureIds (newIds.toArray (new String[newIds.size()]));
-
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
try {
- project.setDescription(description, null);
+ project.build(I18nBuilder.FULL_BUILD,
+ I18nBuilder.BUILDER_ID, null, monitor);
} catch (CoreException e) {
- Logger.logError(e);
+ Logger.logError(e);
}
+ return Status.OK_STATUS;
+ }
+
+ }.schedule();
+ }
+
+ @Override
+ public void deconfigure() throws CoreException {
+ I18nBuilder.removeBuilderFromProject(project);
+ }
+
+ @Override
+ public IProject getProject() {
+ return project;
+ }
+
+ @Override
+ public void setProject(IProject project) {
+ this.project = project;
+ }
+
+ public static void addNature(IProject project) {
+ if (!project.isOpen())
+ return;
+
+ IProjectDescription description = null;
+
+ try {
+ description = project.getDescription();
+ } catch (CoreException e) {
+ Logger.logError(e);
+ return;
}
- public static boolean supportsNature (IProject project) {
- return project.isOpen();
+ // Check if the project has already this nature
+ List<String> newIds = new ArrayList<String>();
+ newIds.addAll(Arrays.asList(description.getNatureIds()));
+ int index = newIds.indexOf(NATURE_ID);
+ if (index != -1)
+ return;
+
+ // Add the nature
+ newIds.add(NATURE_ID);
+ description.setNatureIds(newIds.toArray(new String[newIds.size()]));
+
+ try {
+ project.setDescription(description, null);
+ } catch (CoreException e) {
+ Logger.logError(e);
}
-
- public static boolean hasNature (IProject project) {
- try {
- return project.isOpen () && project.hasNature(NATURE_ID);
- } catch (CoreException e) {
- Logger.logError(e);
- return false;
- }
+ }
+
+ public static boolean supportsNature(IProject project) {
+ return project.isOpen();
+ }
+
+ public static boolean hasNature(IProject project) {
+ try {
+ return project.isOpen() && project.hasNature(NATURE_ID);
+ } catch (CoreException e) {
+ Logger.logError(e);
+ return false;
}
-
- public static void removeNature (IProject project) {
- if (!project.isOpen())
- return;
-
- IProjectDescription description = null;
-
- try {
- description = project.getDescription();
- } catch (CoreException e) {
- Logger.logError(e);
- return;
- }
-
- // Check if the project has already this nature
- List<String> newIds = new ArrayList<String> ();
- newIds.addAll (Arrays.asList(description.getNatureIds()));
- int index = newIds.indexOf (NATURE_ID);
- if (index == -1)
- return;
-
- // remove the nature
- newIds.remove (NATURE_ID);
- description.setNatureIds (newIds.toArray (new String[newIds.size()]));
-
- try {
- project.setDescription(description, null);
- } catch (CoreException e) {
- Logger.logError(e);
- }
+ }
+
+ public static void removeNature(IProject project) {
+ if (!project.isOpen())
+ return;
+
+ IProjectDescription description = null;
+
+ try {
+ description = project.getDescription();
+ } catch (CoreException e) {
+ Logger.logError(e);
+ return;
+ }
+
+ // Check if the project has already this nature
+ List<String> newIds = new ArrayList<String>();
+ newIds.addAll(Arrays.asList(description.getNatureIds()));
+ int index = newIds.indexOf(NATURE_ID);
+ if (index == -1)
+ return;
+
+ // remove the nature
+ newIds.remove(NATURE_ID);
+ description.setNatureIds(newIds.toArray(new String[newIds.size()]));
+
+ try {
+ project.setDescription(description, null);
+ } catch (CoreException e) {
+ Logger.logError(e);
}
+ }
}
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/StringLiteralAuditor.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/StringLiteralAuditor.java
deleted file mode 100644
index ab3c412f..00000000
--- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/StringLiteralAuditor.java
+++ /dev/null
@@ -1,458 +0,0 @@
-package org.eclipse.babel.tapiji.tools.core.builder;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.babel.core.configuration.ConfigurationManager;
-import org.eclipse.babel.core.configuration.IConfiguration;
-import org.eclipse.babel.tapiji.tools.core.Activator;
-import org.eclipse.babel.tapiji.tools.core.Logger;
-import org.eclipse.babel.tapiji.tools.core.builder.analyzer.RBAuditor;
-import org.eclipse.babel.tapiji.tools.core.builder.analyzer.ResourceFinder;
-import org.eclipse.babel.tapiji.tools.core.extensions.I18nAuditor;
-import org.eclipse.babel.tapiji.tools.core.extensions.I18nRBAuditor;
-import org.eclipse.babel.tapiji.tools.core.extensions.I18nResourceAuditor;
-import org.eclipse.babel.tapiji.tools.core.extensions.ILocation;
-import org.eclipse.babel.tapiji.tools.core.extensions.IMarkerConstants;
-import org.eclipse.babel.tapiji.tools.core.model.exception.NoSuchResourceAuditorException;
-import org.eclipse.babel.tapiji.tools.core.model.manager.ResourceBundleManager;
-import org.eclipse.babel.tapiji.tools.core.model.preferences.TapiJIPreferences;
-import org.eclipse.babel.tapiji.tools.core.util.EditorUtils;
-import org.eclipse.babel.tapiji.tools.core.util.RBFileUtils;
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.IPropertyChangeListener;
-
-
-public class StringLiteralAuditor extends IncrementalProjectBuilder{
-
- public static final String BUILDER_ID = Activator.PLUGIN_ID
- + ".I18NBuilder";
-
- private static I18nAuditor[] resourceAuditors;
- private static Set<String> supportedFileEndings;
- private static IPropertyChangeListener listner;
-
-
- static {
- List<I18nAuditor> auditors = new ArrayList<I18nAuditor>();
- supportedFileEndings = new HashSet<String>();
-
- // init default auditors
- auditors.add(new RBAuditor());
-
- // lookup registered auditor extensions
- IConfigurationElement[] config = Platform.getExtensionRegistry()
- .getConfigurationElementsFor(Activator.BUILDER_EXTENSION_ID);
-
- try {
- for (IConfigurationElement e : config) {
- I18nAuditor a = (I18nAuditor) e.createExecutableExtension("class");
- auditors.add(a);
- supportedFileEndings.addAll(Arrays.asList(a.getFileEndings()));
- }
- } catch (CoreException ex) {
- Logger.logError(ex);
- }
-
- resourceAuditors = auditors.toArray(new I18nAuditor[auditors.size()]);
-
- listner = new BuilderPropertyChangeListener();
- TapiJIPreferences.addPropertyChangeListener(listner);
- }
-
- public StringLiteralAuditor() {
- }
-
- public static I18nAuditor getI18nAuditorByContext(String contextId)
- throws NoSuchResourceAuditorException {
- for (I18nAuditor auditor : resourceAuditors) {
- if (auditor.getContextId().equals(contextId))
- return auditor;
- }
- throw new NoSuchResourceAuditorException();
- }
-
- private Set<String> getSupportedFileExt() {
- return supportedFileEndings;
- }
-
- public static boolean isResourceAuditable(IResource resource,
- Set<String> supportedExtensions) {
- for (String ext : supportedExtensions) {
- if (resource.getType() == IResource.FILE && !resource.isDerived() && resource.getFileExtension() != null
- && (resource.getFileExtension().equalsIgnoreCase(ext))) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- protected IProject[] build(final int kind, Map args, IProgressMonitor monitor)
- throws CoreException {
-
- ResourcesPlugin.getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- if (kind == FULL_BUILD) {
- fullBuild(monitor);
- } else {
- // only perform audit if the resource delta is not empty
- IResourceDelta resDelta = getDelta(getProject());
-
- if (resDelta == null)
- return;
-
- if (resDelta.getAffectedChildren() == null)
- return;
-
- incrementalBuild(monitor, resDelta);
- }
- }
- },
- monitor);
-
- return null;
- }
-
- private void incrementalBuild(IProgressMonitor monitor,
- IResourceDelta resDelta) throws CoreException {
- try {
- // inspect resource delta
- ResourceFinder csrav = new ResourceFinder(getSupportedFileExt());
- resDelta.accept(csrav);
- auditResources(csrav.getResources(), monitor, getProject());
- } catch (CoreException e) {
- Logger.logError(e);
- }
- }
-
- public void buildResource(IResource resource, IProgressMonitor monitor) {
- if (isResourceAuditable(resource, getSupportedFileExt())) {
- List<IResource> resources = new ArrayList<IResource>();
- resources.add(resource);
- // TODO: create instance of progressmonitor and hand it over to
- // auditResources
- try {
- auditResources(resources, monitor, resource.getProject());
- } catch (Exception e) {
- Logger.logError(e);
- }
- }
- }
-
- public void buildProject(IProgressMonitor monitor, IProject proj) {
- try {
- ResourceFinder csrav = new ResourceFinder(getSupportedFileExt());
- proj.accept(csrav);
- auditResources(csrav.getResources(), monitor, proj);
- } catch (CoreException e) {
- Logger.logError(e);
- }
- }
-
- private void fullBuild(IProgressMonitor monitor) {
- buildProject(monitor, getProject());
- }
-
- private void auditResources(List<IResource> resources,
- IProgressMonitor monitor, IProject project) {
- IConfiguration configuration = ConfigurationManager.getInstance().getConfiguration();
-
- int work = resources.size();
- int actWork = 0;
- if (monitor == null) {
- monitor = new NullProgressMonitor();
- }
-
- monitor.beginTask("Audit resource file for Internationalization problems",
- work);
-
- for (IResource resource : resources) {
- monitor.subTask("'" + resource.getFullPath().toOSString() + "'");
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- if (!EditorUtils.deleteAuditMarkersForResource(resource))
- continue;
-
- if (ResourceBundleManager.isResourceExcluded(resource))
- continue;
-
- if (!resource.exists())
- continue;
-
- for (I18nAuditor ra : resourceAuditors) {
- if (ra instanceof I18nResourceAuditor && !(configuration.getAuditResource()))
- continue;
- if (ra instanceof I18nRBAuditor && !(configuration.getAuditRb()))
- continue;
-
- try {
- if (monitor.isCanceled()) {
- monitor.done();
- break;
- }
-
- if (ra.isResourceOfType(resource)) {
- ra.audit(resource);
- }
- } catch (Exception e) {
- Logger.logError("Error during auditing '" + resource.getFullPath() + "'", e);
- }
- }
-
- if (monitor != null)
- monitor.worked(1);
- }
-
- for (I18nAuditor a : resourceAuditors) {
- if (a instanceof I18nResourceAuditor){
- handleI18NAuditorMarkers((I18nResourceAuditor)a);
- }
- if (a instanceof I18nRBAuditor){
- handleI18NAuditorMarkers((I18nRBAuditor)a);
- ((I18nRBAuditor)a).resetProblems();
- }
- }
-
- monitor.done();
- }
-
- private void handleI18NAuditorMarkers(I18nResourceAuditor ra){
- try {
- for (ILocation problem : ra.getConstantStringLiterals()) {
- EditorUtils
- .reportToMarker(
- EditorUtils
- .getFormattedMessage(
- EditorUtils.MESSAGE_NON_LOCALIZED_LITERAL,
- new String[] { problem
- .getLiteral() }),
- problem,
- IMarkerConstants.CAUSE_CONSTANT_LITERAL,
- "", (ILocation) problem.getData(),
- ra.getContextId());
- }
-
- // Report all broken Resource-Bundle references
- for (ILocation brokenLiteral : ra
- .getBrokenResourceReferences()) {
- EditorUtils
- .reportToMarker(
- EditorUtils
- .getFormattedMessage(
- EditorUtils.MESSAGE_BROKEN_RESOURCE_REFERENCE,
- new String[] {
- brokenLiteral
- .getLiteral(),
- ((ILocation) brokenLiteral
- .getData())
- .getLiteral() }),
- brokenLiteral,
- IMarkerConstants.CAUSE_BROKEN_REFERENCE,
- brokenLiteral.getLiteral(),
- (ILocation) brokenLiteral.getData(),
- ra.getContextId());
- }
-
- // Report all broken definitions to Resource-Bundle
- // references
- for (ILocation brokenLiteral : ra
- .getBrokenBundleReferences()) {
- EditorUtils
- .reportToMarker(
- EditorUtils
- .getFormattedMessage(
- EditorUtils.MESSAGE_BROKEN_RESOURCE_BUNDLE_REFERENCE,
- new String[] { brokenLiteral
- .getLiteral() }),
- brokenLiteral,
- IMarkerConstants.CAUSE_BROKEN_RB_REFERENCE,
- brokenLiteral.getLiteral(),
- (ILocation) brokenLiteral.getData(),
- ra.getContextId());
- }
- } catch (Exception e) {
- Logger.logError("Exception during reporting of Internationalization errors", e);
- }
- }
-
- private void handleI18NAuditorMarkers(I18nRBAuditor ra){
- IConfiguration configuration = ConfigurationManager.getInstance().getConfiguration();
- try {
- //Report all unspecified keys
- if (configuration.getAuditMissingValue())
- for (ILocation problem : ra.getUnspecifiedKeyReferences()) {
- EditorUtils.reportToRBMarker(
- EditorUtils.getFormattedMessage(
- EditorUtils.MESSAGE_UNSPECIFIED_KEYS,
- new String[] {problem.getLiteral(), problem.getFile().getName()}),
- problem,
- IMarkerConstants.CAUSE_UNSPEZIFIED_KEY,
- problem.getLiteral(),"",
- (ILocation) problem.getData(),
- ra.getContextId());
- }
-
- //Report all same values
- if(configuration.getAuditSameValue()){
- Map<ILocation,ILocation> sameValues = ra.getSameValuesReferences();
- for (ILocation problem : sameValues.keySet()) {
- EditorUtils.reportToRBMarker(
- EditorUtils.getFormattedMessage(
- EditorUtils.MESSAGE_SAME_VALUE,
- new String[] {problem.getFile().getName(),
- sameValues.get(problem).getFile().getName(),
- problem.getLiteral()}),
- problem,
- IMarkerConstants.CAUSE_SAME_VALUE,
- problem.getLiteral(),
- sameValues.get(problem).getFile().getName(),
- (ILocation) problem.getData(),
- ra.getContextId());
- }
- }
- // Report all missing languages
- if (configuration.getAuditMissingLanguage())
- for (ILocation problem : ra.getMissingLanguageReferences()) {
- EditorUtils.reportToRBMarker(
- EditorUtils.getFormattedMessage(
- EditorUtils.MESSAGE_MISSING_LANGUAGE,
- new String[] {RBFileUtils.getCorrespondingResourceBundleId(problem.getFile()),
- problem.getLiteral()}),
- problem,
- IMarkerConstants.CAUSE_MISSING_LANGUAGE,
- problem.getLiteral(),"",
- (ILocation) problem.getData(),
- ra.getContextId());
- }
- } catch (Exception e) {
- Logger.logError("Exception during reporting of Internationalization errors", e);
- }
- }
-
-
-
- @SuppressWarnings("unused")
- private void setProgress(IProgressMonitor monitor, int progress)
- throws InterruptedException {
- monitor.worked(progress);
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- if (isInterrupted())
- throw new InterruptedException();
- }
-
- @Override
- protected void clean(IProgressMonitor monitor) throws CoreException {
- // TODO Auto-generated method stub
- super.clean(monitor);
- }
-
- public static void addBuilderToProject(IProject project) {
- Logger.logInfo("Internationalization-Builder registered for '" + project.getName() + "'");
-
- // Only for open projects
- if (!project.isOpen())
- return;
-
- IProjectDescription description = null;
- try {
- description = project.getDescription();
- } catch (CoreException e) {
- Logger.logError(e);
- return;
- }
-
- // Check if the builder is already associated to the specified project
- ICommand[] commands = description.getBuildSpec();
- for (ICommand command : commands) {
- if (command.getBuilderName().equals(BUILDER_ID))
- return;
- }
-
- // Associate the builder with the project
- ICommand builderCmd = description.newCommand();
- builderCmd.setBuilderName(BUILDER_ID);
- List<ICommand> newCommands = new ArrayList<ICommand>();
- newCommands.addAll(Arrays.asList(commands));
- newCommands.add(builderCmd);
- description.setBuildSpec((ICommand[]) newCommands
- .toArray(new ICommand[newCommands.size()]));
-
- try {
- project.setDescription(description, null);
- } catch (CoreException e) {
- Logger.logError(e);
- }
- }
-
- public static void removeBuilderFromProject(IProject project) {
- // Only for open projects
- if (!project.isOpen())
- return;
-
- try {
- project.deleteMarkers(EditorUtils.MARKER_ID, false,
- IResource.DEPTH_INFINITE);
- project.deleteMarkers(EditorUtils.RB_MARKER_ID, false,
- IResource.DEPTH_INFINITE);
- } catch (CoreException e1) {
- Logger.logError(e1);
- }
-
- IProjectDescription description = null;
- try {
- description = project.getDescription();
- } catch (CoreException e) {
- Logger.logError(e);
- return;
- }
-
- // remove builder from project
- int idx = -1;
- ICommand[] commands = description.getBuildSpec();
- for (int i = 0; i < commands.length; i++) {
- if (commands[i].getBuilderName().equals(BUILDER_ID)) {
- idx = i;
- break;
- }
- }
- if (idx == -1)
- return;
-
- List<ICommand> newCommands = new ArrayList<ICommand>();
- newCommands.addAll(Arrays.asList(commands));
- newCommands.remove(idx);
- description.setBuildSpec((ICommand[]) newCommands
- .toArray(new ICommand[newCommands.size()]));
-
- try {
- project.setDescription(description, null);
- } catch (CoreException e) {
- Logger.logError(e);
- }
-
- }
-
-}
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/ViolationResolutionGenerator.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/ViolationResolutionGenerator.java
index 7669649e..f4437bad 100644
--- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/ViolationResolutionGenerator.java
+++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/ViolationResolutionGenerator.java
@@ -14,28 +14,28 @@ public class ViolationResolutionGenerator implements
@Override
public boolean hasResolutions(IMarker marker) {
- return true;
+ return true;
}
@Override
public IMarkerResolution[] getResolutions(IMarker marker) {
-
- EditorUtils.updateMarker(marker);
-
- String contextId = marker.getAttribute("context", "");
-
- // find resolution generator for the given context
- try {
- I18nAuditor auditor = StringLiteralAuditor
- .getI18nAuditorByContext(contextId);
- List<IMarkerResolution> resolutions = auditor
- .getMarkerResolutions(marker);
- return resolutions
- .toArray(new IMarkerResolution[resolutions.size()]);
- } catch (NoSuchResourceAuditorException e) {
- }
-
- return new IMarkerResolution[0];
+
+ EditorUtils.updateMarker(marker);
+
+ String contextId = marker.getAttribute("context", "");
+
+ // find resolution generator for the given context
+ try {
+ I18nAuditor auditor = I18nBuilder
+ .getI18nAuditorByContext(contextId);
+ List<IMarkerResolution> resolutions = auditor
+ .getMarkerResolutions(marker);
+ return resolutions
+ .toArray(new IMarkerResolution[resolutions.size()]);
+ } catch (NoSuchResourceAuditorException e) {
+ }
+
+ return new IMarkerResolution[0];
}
}
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/analyzer/ResourceFinder.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/analyzer/ResourceFinder.java
index 45ea762b..903b932a 100644
--- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/analyzer/ResourceFinder.java
+++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/analyzer/ResourceFinder.java
@@ -5,43 +5,42 @@
import java.util.Set;
import org.eclipse.babel.tapiji.tools.core.Logger;
-import org.eclipse.babel.tapiji.tools.core.builder.StringLiteralAuditor;
+import org.eclipse.babel.tapiji.tools.core.builder.I18nBuilder;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IResourceDeltaVisitor;
import org.eclipse.core.resources.IResourceVisitor;
import org.eclipse.core.runtime.CoreException;
-
-public class ResourceFinder implements IResourceVisitor,
- IResourceDeltaVisitor {
-
- List<IResource> javaResources = null;
- Set<String> supportedExtensions = null;
-
- public ResourceFinder(Set<String> ext) {
- javaResources = new ArrayList<IResource>();
- supportedExtensions = ext;
- }
-
- @Override
- public boolean visit(IResource resource) throws CoreException {
- if (StringLiteralAuditor.isResourceAuditable(resource, supportedExtensions)) {
- Logger.logInfo("Audit necessary for resource '" + resource.getFullPath().toOSString() + "'");
- javaResources.add(resource);
- return false;
- } else
- return true;
- }
-
- public List<IResource> getResources() {
- return javaResources;
- }
-
- @Override
- public boolean visit(IResourceDelta delta) throws CoreException {
- visit (delta.getResource());
- return true;
- }
+public class ResourceFinder implements IResourceVisitor, IResourceDeltaVisitor {
+
+ List<IResource> javaResources = null;
+ Set<String> supportedExtensions = null;
+
+ public ResourceFinder(Set<String> ext) {
+ javaResources = new ArrayList<IResource>();
+ supportedExtensions = ext;
+ }
+
+ @Override
+ public boolean visit(IResource resource) throws CoreException {
+ if (I18nBuilder.isResourceAuditable(resource, supportedExtensions)) {
+ Logger.logInfo("Audit necessary for resource '"
+ + resource.getFullPath().toOSString() + "'");
+ javaResources.add(resource);
+ return false;
+ } else
+ return true;
+ }
+
+ public List<IResource> getResources() {
+ return javaResources;
+ }
+
+ @Override
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ visit(delta.getResource());
+ return true;
+ }
}
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/quickfix/CreateResourceBundle.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/quickfix/CreateResourceBundle.java
index c3c972ab..5f9d027e 100644
--- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/quickfix/CreateResourceBundle.java
+++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/builder/quickfix/CreateResourceBundle.java
@@ -1,7 +1,7 @@
package org.eclipse.babel.tapiji.tools.core.builder.quickfix;
import org.eclipse.babel.tapiji.tools.core.Logger;
-import org.eclipse.babel.tapiji.tools.core.builder.StringLiteralAuditor;
+import org.eclipse.babel.tapiji.tools.core.builder.I18nBuilder;
import org.eclipse.babel.tapiji.tools.core.model.manager.ResourceBundleManager;
import org.eclipse.babel.tapiji.tools.core.util.ResourceUtils;
import org.eclipse.babel.tapiji.translator.rbe.ui.wizards.IResourceBundleWizard;
@@ -27,146 +27,158 @@
public class CreateResourceBundle implements IMarkerResolution2 {
- private IResource resource;
- private int start;
- private int end;
- private String key;
- private boolean jsfContext;
- private final String newBunldeWizard = "org.eclipse.babel.editor.wizards.ResourceBundleWizard";
-
- public CreateResourceBundle(String key, IResource resource, int start, int end) {
- this.key = ResourceUtils.deriveNonExistingRBName(key, ResourceBundleManager.getManager( resource.getProject() ));
- this.resource = resource;
- this.start = start;
- this.end = end;
- this.jsfContext = jsfContext;
- }
+ private IResource resource;
+ private int start;
+ private int end;
+ private String key;
+ private boolean jsfContext;
+ private final String newBunldeWizard = "org.eclipse.babel.editor.wizards.ResourceBundleWizard";
- @Override
- public String getDescription() {
- return "Creates a new Resource-Bundle with the id '" + key + "'";
- }
+ public CreateResourceBundle(String key, IResource resource, int start,
+ int end) {
+ this.key = ResourceUtils.deriveNonExistingRBName(key,
+ ResourceBundleManager.getManager(resource.getProject()));
+ this.resource = resource;
+ this.start = start;
+ this.end = end;
+ this.jsfContext = jsfContext;
+ }
- @Override
- public Image getImage() {
- // TODO Auto-generated method stub
- return null;
- }
+ @Override
+ public String getDescription() {
+ return "Creates a new Resource-Bundle with the id '" + key + "'";
+ }
- @Override
- public String getLabel() {
- return "Create Resource-Bundle '" + key + "'";
- }
+ @Override
+ public Image getImage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getLabel() {
+ return "Create Resource-Bundle '" + key + "'";
+ }
+
+ @Override
+ public void run(IMarker marker) {
+ runAction();
+ }
- @Override
- public void run(IMarker marker) {
- runAction();
+ protected void runAction() {
+ // First see if this is a "new wizard".
+ IWizardDescriptor descriptor = PlatformUI.getWorkbench()
+ .getNewWizardRegistry().findWizard(newBunldeWizard);
+ // If not check if it is an "import wizard".
+ if (descriptor == null) {
+ descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
+ .findWizard(newBunldeWizard);
}
+ // Or maybe an export wizard
+ if (descriptor == null) {
+ descriptor = PlatformUI.getWorkbench().getExportWizardRegistry()
+ .findWizard(newBunldeWizard);
+ }
+ try {
+ // Then if we have a wizard, open it.
+ if (descriptor != null) {
+ IWizard wizard = descriptor.createWizard();
+ if (!(wizard instanceof IResourceBundleWizard))
+ return;
- protected void runAction () {
- // First see if this is a "new wizard".
- IWizardDescriptor descriptor = PlatformUI.getWorkbench()
- .getNewWizardRegistry().findWizard(newBunldeWizard);
- // If not check if it is an "import wizard".
- if (descriptor == null) {
- descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
- .findWizard(newBunldeWizard);
- }
- // Or maybe an export wizard
- if (descriptor == null) {
- descriptor = PlatformUI.getWorkbench().getExportWizardRegistry()
- .findWizard(newBunldeWizard);
+ IResourceBundleWizard rbw = (IResourceBundleWizard) wizard;
+ String[] keySilbings = key.split("\\.");
+ String rbName = keySilbings[keySilbings.length - 1];
+ String packageName = "";
+
+ rbw.setBundleId(rbName);
+
+ // Set the default path according to the specified package name
+ String pathName = "";
+ if (keySilbings.length > 1) {
+ try {
+ IJavaProject jp = JavaCore
+ .create(resource.getProject());
+ packageName = key.substring(0, key.lastIndexOf("."));
+
+ for (IPackageFragmentRoot fr : jp
+ .getAllPackageFragmentRoots()) {
+ IPackageFragment pf = fr
+ .getPackageFragment(packageName);
+ if (pf.exists()) {
+ pathName = pf.getResource().getFullPath()
+ .removeFirstSegments(0).toOSString();
+ break;
+ }
+ }
+ } catch (Exception e) {
+ pathName = "";
+ }
}
+
try {
- // Then if we have a wizard, open it.
- if (descriptor != null) {
- IWizard wizard = descriptor.createWizard();
- if (!(wizard instanceof IResourceBundleWizard))
- return;
-
- IResourceBundleWizard rbw = (IResourceBundleWizard) wizard;
- String[] keySilbings = key.split("\\.");
- String rbName = keySilbings[keySilbings.length-1];
- String packageName = "";
-
- rbw.setBundleId(rbName);
-
- // Set the default path according to the specified package name
- String pathName = "";
- if (keySilbings.length > 1) {
- try {
- IJavaProject jp = JavaCore.create(resource.getProject());
- packageName = key.substring(0, key.lastIndexOf("."));
-
- for (IPackageFragmentRoot fr : jp.getAllPackageFragmentRoots()) {
- IPackageFragment pf = fr.getPackageFragment(packageName);
- if (pf.exists()) {
- pathName = pf.getResource().getFullPath().removeFirstSegments(0).toOSString();
- break;
- }
- }
- } catch (Exception e) {
- pathName = "";
- }
- }
-
- try {
- IJavaProject jp = JavaCore.create(resource.getProject());
- if (pathName.trim().equals("")) {
- for (IPackageFragmentRoot fr : jp.getAllPackageFragmentRoots()) {
- if (!fr.isReadOnly()) {
- pathName = fr.getResource().getFullPath().removeFirstSegments(0).toOSString();
- break;
- }
- }
- }
- } catch (Exception e) {
- pathName = "";
- }
-
- rbw.setDefaultPath (pathName);
-
- WizardDialog wd = new WizardDialog(Display.getDefault()
- .getActiveShell(), wizard);
- wd.setTitle(wizard.getWindowTitle());
- if (wd.open() == WizardDialog.OK) {
- (new StringLiteralAuditor()).buildProject(null, resource.getProject());
- (new StringLiteralAuditor()).buildResource(resource, null);
-
- ITextFileBufferManager bufferManager = FileBuffers.getTextFileBufferManager();
- IPath path = resource.getRawLocation();
- try {
- bufferManager.connect(path, null);
- ITextFileBuffer textFileBuffer = bufferManager.getTextFileBuffer(path);
- IDocument document = textFileBuffer.getDocument();
-
- if (document.get().charAt(start-1) == '"' && document.get().charAt(start) != '"') {
- start --;
- end ++;
- }
- if (document.get().charAt(end+1) == '"' && document.get().charAt(end) != '"')
- end ++;
-
- document.replace(start, end-start,
- "\"" +
- (packageName.equals("") ? "" : packageName + ".") + rbName +
- "\"");
-
- textFileBuffer.commit(null, false);
- } catch (Exception e) {
- Logger.logError(e);
- } finally {
- try {
- bufferManager.disconnect(path, null);
- } catch (CoreException e) {
- Logger.logError(e);
- }
- }
- }
+ IJavaProject jp = JavaCore.create(resource.getProject());
+ if (pathName.trim().equals("")) {
+ for (IPackageFragmentRoot fr : jp
+ .getAllPackageFragmentRoots()) {
+ if (!fr.isReadOnly()) {
+ pathName = fr.getResource().getFullPath()
+ .removeFirstSegments(0).toOSString();
+ break;
+ }
}
- } catch (CoreException e) {
+ }
+ } catch (Exception e) {
+ pathName = "";
+ }
+
+ rbw.setDefaultPath(pathName);
+
+ WizardDialog wd = new WizardDialog(Display.getDefault()
+ .getActiveShell(), wizard);
+ wd.setTitle(wizard.getWindowTitle());
+ if (wd.open() == WizardDialog.OK) {
+ (new I18nBuilder()).buildProject(null,
+ resource.getProject());
+ (new I18nBuilder()).buildResource(resource, null);
+
+ ITextFileBufferManager bufferManager = FileBuffers
+ .getTextFileBufferManager();
+ IPath path = resource.getRawLocation();
+ try {
+ bufferManager.connect(path, null);
+ ITextFileBuffer textFileBuffer = bufferManager
+ .getTextFileBuffer(path);
+ IDocument document = textFileBuffer.getDocument();
+
+ if (document.get().charAt(start - 1) == '"'
+ && document.get().charAt(start) != '"') {
+ start--;
+ end++;
+ }
+ if (document.get().charAt(end + 1) == '"'
+ && document.get().charAt(end) != '"')
+ end++;
+
+ document.replace(start, end - start, "\""
+ + (packageName.equals("") ? "" : packageName
+ + ".") + rbName + "\"");
+
+ textFileBuffer.commit(null, false);
+ } catch (Exception e) {
Logger.logError(e);
+ } finally {
+ try {
+ bufferManager.disconnect(path, null);
+ } catch (CoreException e) {
+ Logger.logError(e);
+ }
+ }
}
+ }
+ } catch (CoreException e) {
+ Logger.logError(e);
}
+ }
}
diff --git a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleManager.java b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleManager.java
index 8371527e..538a801d 100644
--- a/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleManager.java
+++ b/org.eclipse.babel.tapiji.tools.core/src/org/eclipse/babel/tapiji/tools/core/model/manager/ResourceBundleManager.java
@@ -16,8 +16,8 @@
import org.eclipse.babel.core.message.manager.RBManager;
import org.eclipse.babel.editor.api.MessageFactory;
import org.eclipse.babel.tapiji.tools.core.Logger;
+import org.eclipse.babel.tapiji.tools.core.builder.I18nBuilder;
import org.eclipse.babel.tapiji.tools.core.builder.InternationalizationNature;
-import org.eclipse.babel.tapiji.tools.core.builder.StringLiteralAuditor;
import org.eclipse.babel.tapiji.tools.core.builder.analyzer.ResourceBundleDetectionVisitor;
import org.eclipse.babel.tapiji.tools.core.model.IResourceBundleChangedListener;
import org.eclipse.babel.tapiji.tools.core.model.IResourceDescriptor;
@@ -48,726 +48,755 @@
import org.eclipse.ui.IMemento;
import org.eclipse.ui.XMLMemento;
-
public class ResourceBundleManager {
public static String defaultLocaleTag = "[default]"; // TODO externalize
-
- /*** CONFIG SECTION ***/
- private static boolean checkResourceExclusionRoot = false;
-
- /*** MEMBER SECTION ***/
- private static Map<IProject, ResourceBundleManager> rbmanager = new HashMap<IProject, ResourceBundleManager>();
-
- public static final String RESOURCE_BUNDLE_EXTENSION = ".properties";
-
- //project-specific
- private Map<String, Set<IResource>> resources =
- new HashMap<String, Set<IResource>> ();
-
- private Map<String, String> bundleNames = new HashMap<String, String> ();
-
- private Map<String, List<IResourceBundleChangedListener>> listeners =
- new HashMap<String, List<IResourceBundleChangedListener>> ();
-
- private List<IResourceExclusionListener> exclusionListeners =
- new ArrayList<IResourceExclusionListener> ();
-
- //global
- private static Set<IResourceDescriptor> excludedResources = new HashSet<IResourceDescriptor> ();
-
- private static Map<String, Set<IResource>> allBundles =
- new HashMap<String, Set<IResource>> ();
-
- private static IResourceChangeListener changelistener;
-
- /*Host project*/
- private IProject project = null;
-
- /** State-Serialization Information **/
- private static boolean state_loaded = false;
- private static final String TAG_INTERNATIONALIZATION = "Internationalization";
- private static final String TAG_EXCLUDED = "Excluded";
- private static final String TAG_RES_DESC = "ResourceDescription";
- private static final String TAG_RES_DESC_ABS = "AbsolutePath";
- private static final String TAG_RES_DESC_REL = "RelativePath";
- private static final String TAB_RES_DESC_PRO = "ProjectName";
- private static final String TAB_RES_DESC_BID = "BundleId";
-
- // Define private constructor
- private ResourceBundleManager () {
- }
-
- public static ResourceBundleManager getManager (IProject project) {
- // check if persistant state has been loaded
- if (!state_loaded)
- loadManagerState();
-
- // set host-project
- if (FragmentProjectUtils.isFragment(project))
- project = FragmentProjectUtils.getFragmentHost(project);
-
-
- ResourceBundleManager manager = rbmanager.get(project);
- if (manager == null) {
- manager = new ResourceBundleManager();
- manager.project = project;
- rbmanager.put(project, manager);
- manager.detectResourceBundles();
-
- }
- return manager;
+
+ /*** CONFIG SECTION ***/
+ private static boolean checkResourceExclusionRoot = false;
+
+ /*** MEMBER SECTION ***/
+ private static Map<IProject, ResourceBundleManager> rbmanager = new HashMap<IProject, ResourceBundleManager>();
+
+ public static final String RESOURCE_BUNDLE_EXTENSION = ".properties";
+
+ // project-specific
+ private Map<String, Set<IResource>> resources = new HashMap<String, Set<IResource>>();
+
+ private Map<String, String> bundleNames = new HashMap<String, String>();
+
+ private Map<String, List<IResourceBundleChangedListener>> listeners = new HashMap<String, List<IResourceBundleChangedListener>>();
+
+ private List<IResourceExclusionListener> exclusionListeners = new ArrayList<IResourceExclusionListener>();
+
+ // global
+ private static Set<IResourceDescriptor> excludedResources = new HashSet<IResourceDescriptor>();
+
+ private static Map<String, Set<IResource>> allBundles = new HashMap<String, Set<IResource>>();
+
+ private static IResourceChangeListener changelistener;
+
+ /* Host project */
+ private IProject project = null;
+
+ /** State-Serialization Information **/
+ private static boolean state_loaded = false;
+ private static final String TAG_INTERNATIONALIZATION = "Internationalization";
+ private static final String TAG_EXCLUDED = "Excluded";
+ private static final String TAG_RES_DESC = "ResourceDescription";
+ private static final String TAG_RES_DESC_ABS = "AbsolutePath";
+ private static final String TAG_RES_DESC_REL = "RelativePath";
+ private static final String TAB_RES_DESC_PRO = "ProjectName";
+ private static final String TAB_RES_DESC_BID = "BundleId";
+
+ // Define private constructor
+ private ResourceBundleManager() {
+ }
+
+ public static ResourceBundleManager getManager(IProject project) {
+ // check if persistant state has been loaded
+ if (!state_loaded)
+ loadManagerState();
+
+ // set host-project
+ if (FragmentProjectUtils.isFragment(project))
+ project = FragmentProjectUtils.getFragmentHost(project);
+
+ ResourceBundleManager manager = rbmanager.get(project);
+ if (manager == null) {
+ manager = new ResourceBundleManager();
+ manager.project = project;
+ rbmanager.put(project, manager);
+ manager.detectResourceBundles();
+
}
-
- public Set<Locale> getProvidedLocales (String bundleName) {
- RBManager instance = RBManager.getInstance(project);
-
- Set<Locale> locales = new HashSet<Locale>();
- IMessagesBundleGroup group = instance.getMessagesBundleGroup(bundleName);
- if (group == null)
- return locales;
-
- for (IMessagesBundle bundle : group.getMessagesBundles()) {
- locales.add(bundle.getLocale());
- }
- return locales;
+ return manager;
+ }
+
+ public Set<Locale> getProvidedLocales(String bundleName) {
+ RBManager instance = RBManager.getInstance(project);
+
+ Set<Locale> locales = new HashSet<Locale>();
+ IMessagesBundleGroup group = instance
+ .getMessagesBundleGroup(bundleName);
+ if (group == null)
+ return locales;
+
+ for (IMessagesBundle bundle : group.getMessagesBundles()) {
+ locales.add(bundle.getLocale());
}
-
+ return locales;
+ }
+
public static String getResourceBundleName(IResource res) {
- String name = res.getName();
- String regex = "^(.*?)" //$NON-NLS-1$
- + "((_[a-z]{2,3})|(_[a-z]{2,3}_[A-Z]{2})" //$NON-NLS-1$
- + "|(_[a-z]{2,3}_[A-Z]{2}_\\w*))?(\\." //$NON-NLS-1$
- + res.getFileExtension() + ")$"; //$NON-NLS-1$
- return name.replaceFirst(regex, "$1"); //$NON-NLS-1$
- }
-
- protected boolean isResourceBundleLoaded (String bundleName) {
- return RBManager.getInstance(project).containsMessagesBundleGroup(bundleName);
- }
-
- protected Locale getLocaleByName (String bundleName, String localeID) {
- // Check locale
- Locale locale = null;
- bundleName = bundleNames.get(bundleName);
- localeID = localeID.substring(0, localeID.length() - "properties".length() - 1);
- if (localeID.length() == bundleName.length()) {
- // default locale
- return null;
- } else {
- localeID = localeID.substring(bundleName.length() + 1);
- String[] localeTokens = localeID.split("_");
-
- switch (localeTokens.length) {
- case 1:
- locale = new Locale(localeTokens[0]);
- break;
- case 2:
- locale = new Locale(localeTokens[0], localeTokens[1]);
- break;
- case 3:
- locale = new Locale(localeTokens[0], localeTokens[1], localeTokens[2]);
- break;
- default:
- locale = null;
- break;
- }
- }
-
- return locale;
- }
-
- protected void unloadResource (String bundleName, IResource resource) {
- // TODO implement more efficient
- unloadResourceBundle(bundleName);
-// loadResourceBundle(bundleName);
- }
-
- public static String getResourceBundleId (IResource resource) {
- String packageFragment = "";
-
- IJavaElement propertyFile = JavaCore.create(resource.getParent());
- if (propertyFile != null && propertyFile instanceof IPackageFragment)
- packageFragment = ((IPackageFragment) propertyFile).getElementName();
-
- return (packageFragment.length() > 0 ? packageFragment + "." : "") +
- getResourceBundleName(resource);
- }
-
- public void addBundleResource (IResource resource) {
- if (resource.isDerived())
- return;
-
- String bundleName = getResourceBundleId(resource);
- Set<IResource> res;
-
- if (!resources.containsKey(bundleName))
- res = new HashSet<IResource> ();
- else
- res = resources.get(bundleName);
-
- res.add(resource);
- resources.put(bundleName, res);
- allBundles.put(bundleName, new HashSet<IResource>(res));
- bundleNames.put(bundleName, getResourceBundleName(resource));
-
- // Fire resource changed event
- ResourceBundleChangedEvent event = new ResourceBundleChangedEvent(
- ResourceBundleChangedEvent.ADDED,
- bundleName,
- resource.getProject());
- this.fireResourceBundleChangedEvent(bundleName, event);
- }
-
- protected void removeAllBundleResources(String bundleName) {
- unloadResourceBundle(bundleName);
- resources.remove(bundleName);
- //allBundles.remove(bundleName);
- listeners.remove(bundleName);
- }
-
- public void unloadResourceBundle (String name) {
- RBManager instance = RBManager.getInstance(project);
- instance.deleteMessagesBundleGroup(name);
- }
-
- public IMessagesBundleGroup getResourceBundle (String name) {
- RBManager instance = RBManager.getInstance(project);
- return instance.getMessagesBundleGroup(name);
- }
-
- public Collection<IResource> getResourceBundles (String bundleName) {
- return resources.get(bundleName);
- }
-
- public List<String> getResourceBundleNames () {
- List<String> returnList = new ArrayList<String>();
-
- Iterator<String> it = resources.keySet().iterator();
- while (it.hasNext()) {
- returnList.add(it.next());
- }
- return returnList;
- }
-
- public IResource getResourceFile (String file) {
- String regex = "^(.*?)"
- + "((_[a-z]{2,3})|(_[a-z]{2,3}_[A-Z]{2})"
- + "|(_[a-z]{2,3}_[A-Z]{2}_\\w*))?(\\."
- + "properties" + ")$";
- String bundleName = file.replaceFirst(regex, "$1");
- IResource resource = null;
-
- for (IResource res : resources.get(bundleName)) {
- if (res.getName().equalsIgnoreCase(file)) {
- resource = res;
- break;
- }
- }
-
- return resource;
+ String name = res.getName();
+ String regex = "^(.*?)" //$NON-NLS-1$
+ + "((_[a-z]{2,3})|(_[a-z]{2,3}_[A-Z]{2})" //$NON-NLS-1$
+ + "|(_[a-z]{2,3}_[A-Z]{2}_\\w*))?(\\." //$NON-NLS-1$
+ + res.getFileExtension() + ")$"; //$NON-NLS-1$
+ return name.replaceFirst(regex, "$1"); //$NON-NLS-1$
+ }
+
+ protected boolean isResourceBundleLoaded(String bundleName) {
+ return RBManager.getInstance(project).containsMessagesBundleGroup(
+ bundleName);
+ }
+
+ protected Locale getLocaleByName(String bundleName, String localeID) {
+ // Check locale
+ Locale locale = null;
+ bundleName = bundleNames.get(bundleName);
+ localeID = localeID.substring(0,
+ localeID.length() - "properties".length() - 1);
+ if (localeID.length() == bundleName.length()) {
+ // default locale
+ return null;
+ } else {
+ localeID = localeID.substring(bundleName.length() + 1);
+ String[] localeTokens = localeID.split("_");
+
+ switch (localeTokens.length) {
+ case 1:
+ locale = new Locale(localeTokens[0]);
+ break;
+ case 2:
+ locale = new Locale(localeTokens[0], localeTokens[1]);
+ break;
+ case 3:
+ locale = new Locale(localeTokens[0], localeTokens[1],
+ localeTokens[2]);
+ break;
+ default:
+ locale = null;
+ break;
+ }
}
-
- public void fireResourceBundleChangedEvent (String bundleName, ResourceBundleChangedEvent event) {
- List<IResourceBundleChangedListener> l = listeners.get(bundleName);
-
- if (l == null)
- return;
-
- for (IResourceBundleChangedListener listener : l) {
- listener.resourceBundleChanged(event);
- }
+
+ return locale;
+ }
+
+ protected void unloadResource(String bundleName, IResource resource) {
+ // TODO implement more efficient
+ unloadResourceBundle(bundleName);
+ // loadResourceBundle(bundleName);
+ }
+
+ public static String getResourceBundleId(IResource resource) {
+ String packageFragment = "";
+
+ IJavaElement propertyFile = JavaCore.create(resource.getParent());
+ if (propertyFile != null && propertyFile instanceof IPackageFragment)
+ packageFragment = ((IPackageFragment) propertyFile)
+ .getElementName();
+
+ return (packageFragment.length() > 0 ? packageFragment + "." : "")
+ + getResourceBundleName(resource);
+ }
+
+ public void addBundleResource(IResource resource) {
+ if (resource.isDerived())
+ return;
+
+ String bundleName = getResourceBundleId(resource);
+ Set<IResource> res;
+
+ if (!resources.containsKey(bundleName))
+ res = new HashSet<IResource>();
+ else
+ res = resources.get(bundleName);
+
+ res.add(resource);
+ resources.put(bundleName, res);
+ allBundles.put(bundleName, new HashSet<IResource>(res));
+ bundleNames.put(bundleName, getResourceBundleName(resource));
+
+ // Fire resource changed event
+ ResourceBundleChangedEvent event = new ResourceBundleChangedEvent(
+ ResourceBundleChangedEvent.ADDED, bundleName,
+ resource.getProject());
+ this.fireResourceBundleChangedEvent(bundleName, event);
+ }
+
+ protected void removeAllBundleResources(String bundleName) {
+ unloadResourceBundle(bundleName);
+ resources.remove(bundleName);
+ // allBundles.remove(bundleName);
+ listeners.remove(bundleName);
+ }
+
+ public void unloadResourceBundle(String name) {
+ RBManager instance = RBManager.getInstance(project);
+ instance.deleteMessagesBundleGroup(name);
+ }
+
+ public IMessagesBundleGroup getResourceBundle(String name) {
+ RBManager instance = RBManager.getInstance(project);
+ return instance.getMessagesBundleGroup(name);
+ }
+
+ public Collection<IResource> getResourceBundles(String bundleName) {
+ return resources.get(bundleName);
+ }
+
+ public List<String> getResourceBundleNames() {
+ List<String> returnList = new ArrayList<String>();
+
+ Iterator<String> it = resources.keySet().iterator();
+ while (it.hasNext()) {
+ returnList.add(it.next());
}
-
- public void registerResourceBundleChangeListener (String bundleName, IResourceBundleChangedListener listener) {
- List<IResourceBundleChangedListener> l = listeners.get(bundleName);
- if (l == null)
- l = new ArrayList<IResourceBundleChangedListener>();
- l.add(listener);
- listeners.put(bundleName, l);
+ return returnList;
+ }
+
+ public IResource getResourceFile(String file) {
+ String regex = "^(.*?)" + "((_[a-z]{2,3})|(_[a-z]{2,3}_[A-Z]{2})"
+ + "|(_[a-z]{2,3}_[A-Z]{2}_\\w*))?(\\." + "properties" + ")$";
+ String bundleName = file.replaceFirst(regex, "$1");
+ IResource resource = null;
+
+ for (IResource res : resources.get(bundleName)) {
+ if (res.getName().equalsIgnoreCase(file)) {
+ resource = res;
+ break;
+ }
}
-
- public void unregisterResourceBundleChangeListener (String bundleName, IResourceBundleChangedListener listener) {
- List<IResourceBundleChangedListener> l = listeners.get(bundleName);
- if (l == null)
- return;
- l.remove(listener);
- listeners.put(bundleName, l);
+
+ return resource;
+ }
+
+ public void fireResourceBundleChangedEvent(String bundleName,
+ ResourceBundleChangedEvent event) {
+ List<IResourceBundleChangedListener> l = listeners.get(bundleName);
+
+ if (l == null)
+ return;
+
+ for (IResourceBundleChangedListener listener : l) {
+ listener.resourceBundleChanged(event);
}
-
- protected void detectResourceBundles () {
- try {
- project.accept(new ResourceBundleDetectionVisitor(getProject()));
-
- IProject[] fragments = FragmentProjectUtils.lookupFragment(project);
- if (fragments != null){
- for (IProject p : fragments){
- p.accept(new ResourceBundleDetectionVisitor(getProject()));
- }
- }
- } catch (CoreException e) {
+ }
+
+ public void registerResourceBundleChangeListener(String bundleName,
+ IResourceBundleChangedListener listener) {
+ List<IResourceBundleChangedListener> l = listeners.get(bundleName);
+ if (l == null)
+ l = new ArrayList<IResourceBundleChangedListener>();
+ l.add(listener);
+ listeners.put(bundleName, l);
+ }
+
+ public void unregisterResourceBundleChangeListener(String bundleName,
+ IResourceBundleChangedListener listener) {
+ List<IResourceBundleChangedListener> l = listeners.get(bundleName);
+ if (l == null)
+ return;
+ l.remove(listener);
+ listeners.put(bundleName, l);
+ }
+
+ protected void detectResourceBundles() {
+ try {
+ project.accept(new ResourceBundleDetectionVisitor(getProject()));
+
+ IProject[] fragments = FragmentProjectUtils.lookupFragment(project);
+ if (fragments != null) {
+ for (IProject p : fragments) {
+ p.accept(new ResourceBundleDetectionVisitor(getProject()));
}
+ }
+ } catch (CoreException e) {
}
-
- public IProject getProject () {
- return project;
+ }
+
+ public IProject getProject() {
+ return project;
+ }
+
+ public List<String> getResourceBundleIdentifiers() {
+ List<String> returnList = new ArrayList<String>();
+
+ // TODO check other resource bundles that are available on the curren
+ // class path
+ Iterator<String> it = this.resources.keySet().iterator();
+ while (it.hasNext()) {
+ returnList.add(it.next());
}
- public List<String> getResourceBundleIdentifiers () {
- List<String> returnList = new ArrayList<String>();
-
- // TODO check other resource bundles that are available on the curren class path
- Iterator<String> it = this.resources.keySet().iterator();
+ return returnList;
+ }
+
+ public static List<String> getAllResourceBundleNames() {
+ List<String> returnList = new ArrayList<String>();
+
+ for (IProject p : getAllSupportedProjects()) {
+ if (!FragmentProjectUtils.isFragment(p)) {
+ Iterator<String> it = getManager(p).resources.keySet()
+ .iterator();
while (it.hasNext()) {
- returnList.add(it.next());
+ returnList.add(p.getName() + "/" + it.next());
}
-
- return returnList;
+ }
}
-
- public static List<String> getAllResourceBundleNames() {
- List<String> returnList = new ArrayList<String>();
-
- for (IProject p : getAllSupportedProjects()) {
- if (!FragmentProjectUtils.isFragment(p)){
- Iterator<String> it = getManager(p).resources.keySet().iterator();
- while (it.hasNext()) {
- returnList.add(p.getName() + "/" + it.next());
- }
- }
- }
- return returnList;
+ return returnList;
+ }
+
+ public static Set<IProject> getAllSupportedProjects() {
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot()
+ .getProjects();
+ Set<IProject> projs = new HashSet<IProject>();
+
+ for (IProject p : projects) {
+ if (InternationalizationNature.hasNature(p))
+ projs.add(p);
}
-
- public static Set<IProject> getAllSupportedProjects () {
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- Set<IProject> projs = new HashSet<IProject>();
-
- for (IProject p : projects) {
- if (InternationalizationNature.hasNature(p))
- projs.add(p);
- }
- return projs;
+ return projs;
+ }
+
+ public String getKeyHoverString(String rbName, String key) {
+ try {
+ RBManager instance = RBManager.getInstance(project);
+ IMessagesBundleGroup bundleGroup = instance
+ .getMessagesBundleGroup(rbName);
+ if (!bundleGroup.containsKey(key))
+ return null;
+
+ String hoverText = "<html><head></head><body>";
+
+ for (IMessage message : bundleGroup.getMessages(key)) {
+ String displayName = message.getLocale() == null ? "Default"
+ : message.getLocale().getDisplayName();
+ String value = message.getValue();
+ hoverText += "<b><i>" + displayName + "</i></b><br/>"
+ + value.replace("\n", "<br/>") + "<br/><br/>";
+ }
+ return hoverText + "</body></html>";
+ } catch (Exception e) {
+ // silent catch
+ return "";
}
+ }
- public String getKeyHoverString(String rbName, String key) {
- try {
- RBManager instance = RBManager.getInstance(project);
- IMessagesBundleGroup bundleGroup = instance
- .getMessagesBundleGroup(rbName);
- if (!bundleGroup.containsKey(key))
- return null;
-
- String hoverText = "<html><head></head><body>";
-
- for (IMessage message : bundleGroup.getMessages(key)) {
- String displayName = message.getLocale() == null ? "Default"
- : message.getLocale().getDisplayName();
- String value = message.getValue();
- hoverText += "<b><i>" + displayName + "</i></b><br/>"
- + value.replace("\n", "<br/>") + "<br/><br/>";
- }
- return hoverText + "</body></html>";
- } catch (Exception e) {
- // silent catch
- return "";
- }
+ public boolean isKeyBroken(String rbName, String key) {
+ IMessagesBundleGroup messagesBundleGroup = RBManager.getInstance(
+ project).getMessagesBundleGroup(rbName);
+ if (messagesBundleGroup == null) {
+ return true;
+ } else {
+ return !messagesBundleGroup.containsKey(key);
}
-
- public boolean isKeyBroken (String rbName, String key) {
- IMessagesBundleGroup messagesBundleGroup = RBManager.getInstance(project).getMessagesBundleGroup(rbName);
- if (messagesBundleGroup == null) {
- return true;
+
+ // if (!resourceBundles.containsKey(rbName))
+ // return true;
+ // return !this.isResourceExisting(rbName, key);
+ }
+
+ protected void excludeSingleResource(IResource res) {
+ IResourceDescriptor rd = new ResourceDescriptor(res);
+ EditorUtils.deleteAuditMarkersForResource(res);
+
+ // exclude resource
+ excludedResources.add(rd);
+ Collection<Object> changedExclusoins = new HashSet<Object>();
+ changedExclusoins.add(res);
+ fireResourceExclusionEvent(new ResourceExclusionEvent(changedExclusoins));
+
+ // Check if the excluded resource represents a resource-bundle
+ if (RBFileUtils.isResourceBundleFile(res)) {
+ String bundleName = getResourceBundleId(res);
+ Set<IResource> resSet = resources.remove(bundleName);
+ if (resSet != null) {
+ resSet.remove(res);
+
+ if (!resSet.isEmpty()) {
+ resources.put(bundleName, resSet);
+ unloadResource(bundleName, res);
} else {
- return !messagesBundleGroup.containsKey(key);
- }
-
-// if (!resourceBundles.containsKey(rbName))
-// return true;
-// return !this.isResourceExisting(rbName, key);
- }
-
- protected void excludeSingleResource (IResource res) {
- IResourceDescriptor rd = new ResourceDescriptor(res);
- EditorUtils.deleteAuditMarkersForResource(res);
-
- // exclude resource
- excludedResources.add(rd);
- Collection<Object> changedExclusoins = new HashSet<Object>();
- changedExclusoins.add(res);
- fireResourceExclusionEvent(new ResourceExclusionEvent(changedExclusoins));
-
- // Check if the excluded resource represents a resource-bundle
- if (RBFileUtils.isResourceBundleFile(res)) {
- String bundleName = getResourceBundleId(res);
- Set<IResource> resSet = resources.remove(bundleName);
- if (resSet != null) {
- resSet.remove(res);
-
- if (!resSet.isEmpty()) {
- resources.put(bundleName, resSet);
- unloadResource(bundleName, res);
- } else {
- rd.setBundleId(bundleName);
- unloadResourceBundle(bundleName);
- (new StringLiteralAuditor()).buildProject(null, res.getProject());
- }
-
- fireResourceBundleChangedEvent(getResourceBundleId(res),
- new ResourceBundleChangedEvent(ResourceBundleChangedEvent.EXCLUDED, bundleName,
- res.getProject()));
- }
+ rd.setBundleId(bundleName);
+ unloadResourceBundle(bundleName);
+ (new I18nBuilder()).buildProject(null, res.getProject());
}
- }
-
- public void excludeResource (IResource res, IProgressMonitor monitor) {
- try {
- if (monitor == null)
- monitor = new NullProgressMonitor();
-
- final List<IResource> resourceSubTree = new ArrayList<IResource> ();
- res.accept(new IResourceVisitor () {
-
- @Override
- public boolean visit(IResource resource) throws CoreException {
- Logger.logInfo("Excluding resource '" + resource.getFullPath().toOSString() + "'");
- resourceSubTree.add(resource);
- return true;
- }
-
- });
-
- // Iterate previously retrieved resource and exclude them from Internationalization
- monitor.beginTask("Exclude resources from Internationalization context", resourceSubTree.size());
- try {
- for (IResource resource : resourceSubTree) {
- excludeSingleResource (resource);
- EditorUtils.deleteAuditMarkersForResource(resource);
- monitor.worked(1);
- }
- } catch (Exception e) {
- Logger.logError(e);
- } finally {
- monitor.done();
- }
- } catch (CoreException e) {
- Logger.logError(e);
- }
- }
- public void includeResource (IResource res, IProgressMonitor monitor) {
- if (monitor == null)
- monitor = new NullProgressMonitor();
-
- final Collection<Object> changedResources = new HashSet<Object>();
- IResource resource = res;
-
- if (!excludedResources.contains(new ResourceDescriptor(res))) {
- while (!(resource instanceof IProject ||
- resource instanceof IWorkspaceRoot)) {
- if (excludedResources.contains(new ResourceDescriptor(resource))) {
- excludeResource(resource, monitor);
- changedResources.add(resource);
- break;
- } else
- resource = resource.getParent();
- }
- }
-
- try {
- res.accept(new IResourceVisitor() {
-
- @Override
- public boolean visit(IResource resource) throws CoreException {
- changedResources.add(resource);
- return true;
- }
- });
-
- monitor.beginTask("Add resources to Internationalization context", changedResources.size());
- try {
- for (Object r : changedResources) {
- excludedResources.remove(new ResourceDescriptor((IResource)r));
- monitor.worked(1);
- }
-
- } catch (Exception e) {
- Logger.logError(e);
- } finally {
- monitor.done();
- }
- } catch (Exception e) {
- Logger.logError(e);
- }
-
- (new StringLiteralAuditor()).buildResource(res, null);
-
- // Check if the included resource represents a resource-bundle
- if (RBFileUtils.isResourceBundleFile(res)) {
- String bundleName = getResourceBundleId(res);
- boolean newRB = resources.containsKey(bundleName);
-
- this.addBundleResource(res);
- this.unloadResourceBundle(bundleName);
-// this.loadResourceBundle(bundleName);
-
- if (newRB)
- (new StringLiteralAuditor()).buildProject(null, res.getProject());
- fireResourceBundleChangedEvent(getResourceBundleId(res),
- new ResourceBundleChangedEvent(ResourceBundleChangedEvent.INCLUDED, bundleName,
- res.getProject()));
- }
-
- fireResourceExclusionEvent (new ResourceExclusionEvent(changedResources));
- }
-
- protected void fireResourceExclusionEvent (ResourceExclusionEvent event) {
- for (IResourceExclusionListener listener : exclusionListeners)
- listener.exclusionChanged (event);
+ fireResourceBundleChangedEvent(getResourceBundleId(res),
+ new ResourceBundleChangedEvent(
+ ResourceBundleChangedEvent.EXCLUDED,
+ bundleName, res.getProject()));
+ }
}
-
- public static boolean isResourceExcluded (IResource res) {
- IResource resource = res;
-
- if (!state_loaded)
- loadManagerState();
-
- boolean isExcluded = false;
-
- do {
- if (excludedResources.contains(new ResourceDescriptor(resource))) {
- if (RBFileUtils.isResourceBundleFile(resource)) {
- Set<IResource> resources = allBundles.remove(getResourceBundleName(resource));
- if (resources == null)
- resources = new HashSet<IResource> ();
- resources.add(resource);
- allBundles.put(getResourceBundleName(resource), resources);
- }
-
- isExcluded = true;
- break;
- }
- resource = resource.getParent();
- } while (resource != null &&
- !(resource instanceof IProject ||
- resource instanceof IWorkspaceRoot) &&
- checkResourceExclusionRoot);
-
- return isExcluded; //excludedResources.contains(new ResourceDescriptor(res));
- }
-
- public IFile getRandomFile(String bundleName) {
- try {
- IResource res = (resources.get(bundleName)).iterator().next();
- return res.getProject().getFile(res.getProjectRelativePath());
- } catch (Exception e) {
- e.printStackTrace();
+ }
+
+ public void excludeResource(IResource res, IProgressMonitor monitor) {
+ try {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ final List<IResource> resourceSubTree = new ArrayList<IResource>();
+ res.accept(new IResourceVisitor() {
+
+ @Override
+ public boolean visit(IResource resource) throws CoreException {
+ Logger.logInfo("Excluding resource '"
+ + resource.getFullPath().toOSString() + "'");
+ resourceSubTree.add(resource);
+ return true;
}
- return null;
- }
-
- private static void loadManagerState () {
- excludedResources = new HashSet<IResourceDescriptor>();
- FileReader reader = null;
- try {
- reader = new FileReader (FileUtils.getRBManagerStateFile());
- loadManagerState (XMLMemento.createReadRoot(reader));
- state_loaded = true;
- } catch (Exception e) {
- // do nothing
+
+ });
+
+ // Iterate previously retrieved resource and exclude them from
+ // Internationalization
+ monitor.beginTask(
+ "Exclude resources from Internationalization context",
+ resourceSubTree.size());
+ try {
+ for (IResource resource : resourceSubTree) {
+ excludeSingleResource(resource);
+ EditorUtils.deleteAuditMarkersForResource(resource);
+ monitor.worked(1);
}
-
- changelistener = new RBChangeListner();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(changelistener, IResourceChangeEvent.PRE_DELETE | IResourceChangeEvent.POST_CHANGE);
+ } catch (Exception e) {
+ Logger.logError(e);
+ } finally {
+ monitor.done();
+ }
+ } catch (CoreException e) {
+ Logger.logError(e);
}
+ }
- private static void loadManagerState(XMLMemento memento) {
- IMemento excludedChild = memento.getChild(TAG_EXCLUDED);
- for (IMemento excluded : excludedChild.getChildren(TAG_RES_DESC)) {
- IResourceDescriptor descriptor = new ResourceDescriptor();
- descriptor.setAbsolutePath(excluded.getString(TAG_RES_DESC_ABS));
- descriptor.setRelativePath(excluded.getString(TAG_RES_DESC_REL));
- descriptor.setProjectName(excluded.getString(TAB_RES_DESC_PRO));
- descriptor.setBundleId(excluded.getString(TAB_RES_DESC_BID));
- excludedResources.add(descriptor);
- }
+ public void includeResource(IResource res, IProgressMonitor monitor) {
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+
+ final Collection<Object> changedResources = new HashSet<Object>();
+ IResource resource = res;
+
+ if (!excludedResources.contains(new ResourceDescriptor(res))) {
+ while (!(resource instanceof IProject || resource instanceof IWorkspaceRoot)) {
+ if (excludedResources
+ .contains(new ResourceDescriptor(resource))) {
+ excludeResource(resource, monitor);
+ changedResources.add(resource);
+ break;
+ } else
+ resource = resource.getParent();
+ }
}
-
- public static void saveManagerState () {
- if (excludedResources == null)
- return;
- XMLMemento memento = XMLMemento.createWriteRoot(TAG_INTERNATIONALIZATION);
- IMemento exclChild = memento.createChild(TAG_EXCLUDED);
-
- Iterator<IResourceDescriptor> itExcl = excludedResources.iterator();
- while (itExcl.hasNext()) {
- IResourceDescriptor desc = itExcl.next();
- IMemento resDesc = exclChild.createChild(TAG_RES_DESC);
- resDesc.putString(TAB_RES_DESC_PRO, desc.getProjectName());
- resDesc.putString(TAG_RES_DESC_ABS, desc.getAbsolutePath());
- resDesc.putString(TAG_RES_DESC_REL, desc.getRelativePath());
- resDesc.putString(TAB_RES_DESC_BID, desc.getBundleId());
- }
- FileWriter writer = null;
- try {
- writer = new FileWriter(FileUtils.getRBManagerStateFile());
- memento.save(writer);
- } catch (Exception e) {
- // do nothing
- } finally {
- try {
- if (writer != null)
- writer.close();
- } catch (Exception e) {
- // do nothing
- }
+
+ try {
+ res.accept(new IResourceVisitor() {
+
+ @Override
+ public boolean visit(IResource resource) throws CoreException {
+ changedResources.add(resource);
+ return true;
}
- }
+ });
- @Deprecated
- protected static boolean isResourceExcluded(IProject project, String bname) {
- Iterator<IResourceDescriptor> itExcl = excludedResources.iterator();
- while (itExcl.hasNext()) {
- IResourceDescriptor rd = itExcl.next();
- if (project.getName().equals(rd.getProjectName()) && bname.equals(rd.getBundleId()))
- return true;
+ monitor.beginTask("Add resources to Internationalization context",
+ changedResources.size());
+ try {
+ for (Object r : changedResources) {
+ excludedResources.remove(new ResourceDescriptor(
+ (IResource) r));
+ monitor.worked(1);
}
- return false;
+
+ } catch (Exception e) {
+ Logger.logError(e);
+ } finally {
+ monitor.done();
+ }
+ } catch (Exception e) {
+ Logger.logError(e);
}
- public static ResourceBundleManager getManager(String projectName) {
- for (IProject p : getAllSupportedProjects()) {
- if (p.getName().equalsIgnoreCase(projectName)){
- //check if the projectName is a fragment and return the manager for the host
- if(FragmentProjectUtils.isFragment(p))
- return getManager(FragmentProjectUtils.getFragmentHost(p));
- else return getManager(p);
- }
- }
- return null;
+ (new I18nBuilder()).buildResource(res, null);
+
+ // Check if the included resource represents a resource-bundle
+ if (RBFileUtils.isResourceBundleFile(res)) {
+ String bundleName = getResourceBundleId(res);
+ boolean newRB = resources.containsKey(bundleName);
+
+ this.addBundleResource(res);
+ this.unloadResourceBundle(bundleName);
+ // this.loadResourceBundle(bundleName);
+
+ if (newRB)
+ (new I18nBuilder()).buildProject(null, res.getProject());
+ fireResourceBundleChangedEvent(getResourceBundleId(res),
+ new ResourceBundleChangedEvent(
+ ResourceBundleChangedEvent.INCLUDED, bundleName,
+ res.getProject()));
}
- public IFile getResourceBundleFile(String resourceBundle, Locale l) {
- IFile res = null;
- Set<IResource> resSet = resources.get(resourceBundle);
-
- if ( resSet != null ) {
- for (IResource resource : resSet) {
- Locale refLoc = getLocaleByName(resourceBundle, resource.getName());
- if (refLoc == null && l == null || (refLoc != null && refLoc.equals(l) || l != null && l.equals(refLoc))) {
- res = resource.getProject().getFile(resource.getProjectRelativePath());
- break;
- }
- }
+ fireResourceExclusionEvent(new ResourceExclusionEvent(changedResources));
+ }
+
+ protected void fireResourceExclusionEvent(ResourceExclusionEvent event) {
+ for (IResourceExclusionListener listener : exclusionListeners)
+ listener.exclusionChanged(event);
+ }
+
+ public static boolean isResourceExcluded(IResource res) {
+ IResource resource = res;
+
+ if (!state_loaded)
+ loadManagerState();
+
+ boolean isExcluded = false;
+
+ do {
+ if (excludedResources.contains(new ResourceDescriptor(resource))) {
+ if (RBFileUtils.isResourceBundleFile(resource)) {
+ Set<IResource> resources = allBundles
+ .remove(getResourceBundleName(resource));
+ if (resources == null)
+ resources = new HashSet<IResource>();
+ resources.add(resource);
+ allBundles.put(getResourceBundleName(resource), resources);
}
-
- return res;
- }
-
- public Set<IResource> getAllResourceBundleResources(String resourceBundle) {
- return allBundles.get(resourceBundle);
- }
-
- public void registerResourceExclusionListener (IResourceExclusionListener listener) {
- exclusionListeners.add(listener);
+
+ isExcluded = true;
+ break;
+ }
+ resource = resource.getParent();
+ } while (resource != null
+ && !(resource instanceof IProject || resource instanceof IWorkspaceRoot)
+ && checkResourceExclusionRoot);
+
+ return isExcluded; // excludedResources.contains(new
+ // ResourceDescriptor(res));
+ }
+
+ public IFile getRandomFile(String bundleName) {
+ try {
+ IResource res = (resources.get(bundleName)).iterator().next();
+ return res.getProject().getFile(res.getProjectRelativePath());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ private static void loadManagerState() {
+ excludedResources = new HashSet<IResourceDescriptor>();
+ FileReader reader = null;
+ try {
+ reader = new FileReader(FileUtils.getRBManagerStateFile());
+ loadManagerState(XMLMemento.createReadRoot(reader));
+ state_loaded = true;
+ } catch (Exception e) {
+ // do nothing
}
-
- public void unregisterResourceExclusionListener (IResourceExclusionListener listener) {
- exclusionListeners.remove(listener);
+
+ changelistener = new RBChangeListner();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(
+ changelistener,
+ IResourceChangeEvent.PRE_DELETE
+ | IResourceChangeEvent.POST_CHANGE);
+ }
+
+ private static void loadManagerState(XMLMemento memento) {
+ IMemento excludedChild = memento.getChild(TAG_EXCLUDED);
+ for (IMemento excluded : excludedChild.getChildren(TAG_RES_DESC)) {
+ IResourceDescriptor descriptor = new ResourceDescriptor();
+ descriptor.setAbsolutePath(excluded.getString(TAG_RES_DESC_ABS));
+ descriptor.setRelativePath(excluded.getString(TAG_RES_DESC_REL));
+ descriptor.setProjectName(excluded.getString(TAB_RES_DESC_PRO));
+ descriptor.setBundleId(excluded.getString(TAB_RES_DESC_BID));
+ excludedResources.add(descriptor);
}
-
- public boolean isResourceExclusionListenerRegistered (IResourceExclusionListener listener) {
- return exclusionListeners.contains(listener);
+ }
+
+ public static void saveManagerState() {
+ if (excludedResources == null)
+ return;
+ XMLMemento memento = XMLMemento
+ .createWriteRoot(TAG_INTERNATIONALIZATION);
+ IMemento exclChild = memento.createChild(TAG_EXCLUDED);
+
+ Iterator<IResourceDescriptor> itExcl = excludedResources.iterator();
+ while (itExcl.hasNext()) {
+ IResourceDescriptor desc = itExcl.next();
+ IMemento resDesc = exclChild.createChild(TAG_RES_DESC);
+ resDesc.putString(TAB_RES_DESC_PRO, desc.getProjectName());
+ resDesc.putString(TAG_RES_DESC_ABS, desc.getAbsolutePath());
+ resDesc.putString(TAG_RES_DESC_REL, desc.getRelativePath());
+ resDesc.putString(TAB_RES_DESC_BID, desc.getBundleId());
+ }
+ FileWriter writer = null;
+ try {
+ writer = new FileWriter(FileUtils.getRBManagerStateFile());
+ memento.save(writer);
+ } catch (Exception e) {
+ // do nothing
+ } finally {
+ try {
+ if (writer != null)
+ writer.close();
+ } catch (Exception e) {
+ // do nothing
+ }
}
+ }
- public static void unregisterResourceExclusionListenerFromAllManagers(
- IResourceExclusionListener excludedResource) {
- for (ResourceBundleManager mgr : rbmanager.values()) {
- mgr.unregisterResourceExclusionListener(excludedResource);
- }
+ @Deprecated
+ protected static boolean isResourceExcluded(IProject project, String bname) {
+ Iterator<IResourceDescriptor> itExcl = excludedResources.iterator();
+ while (itExcl.hasNext()) {
+ IResourceDescriptor rd = itExcl.next();
+ if (project.getName().equals(rd.getProjectName())
+ && bname.equals(rd.getBundleId()))
+ return true;
+ }
+ return false;
+ }
+
+ public static ResourceBundleManager getManager(String projectName) {
+ for (IProject p : getAllSupportedProjects()) {
+ if (p.getName().equalsIgnoreCase(projectName)) {
+ // check if the projectName is a fragment and return the manager
+ // for the host
+ if (FragmentProjectUtils.isFragment(p))
+ return getManager(FragmentProjectUtils.getFragmentHost(p));
+ else
+ return getManager(p);
+ }
}
+ return null;
+ }
+
+ public IFile getResourceBundleFile(String resourceBundle, Locale l) {
+ IFile res = null;
+ Set<IResource> resSet = resources.get(resourceBundle);
- public void addResourceBundleEntry(String resourceBundleId, String key,
- Locale locale, String message) throws ResourceBundleException {
-
- RBManager instance = RBManager.getInstance(project);
- IMessagesBundleGroup bundleGroup = instance.getMessagesBundleGroup(resourceBundleId);
- IMessage entry = bundleGroup.getMessage(key, locale);
-
-
- if (entry == null) {
- DirtyHack.setFireEnabled(false);
-
- IMessagesBundle messagesBundle = bundleGroup.getMessagesBundle(locale);
- IMessage m = MessageFactory.createMessage(key, locale);
- m.setText(message);
- messagesBundle.addMessage(m);
-
- instance.writeToFile(messagesBundle);
-
- DirtyHack.setFireEnabled(true);
-
- // notify the PropertyKeySelectionTree
- instance.fireEditorChanged();
+ if (resSet != null) {
+ for (IResource resource : resSet) {
+ Locale refLoc = getLocaleByName(resourceBundle,
+ resource.getName());
+ if (refLoc == null
+ && l == null
+ || (refLoc != null && refLoc.equals(l) || l != null
+ && l.equals(refLoc))) {
+ res = resource.getProject().getFile(
+ resource.getProjectRelativePath());
+ break;
}
+ }
}
-
- public void saveResourceBundle(String resourceBundleId,
- IMessagesBundleGroup newBundleGroup) throws ResourceBundleException {
-// RBManager.getInstance().
+ return res;
+ }
+
+ public Set<IResource> getAllResourceBundleResources(String resourceBundle) {
+ return allBundles.get(resourceBundle);
+ }
+
+ public void registerResourceExclusionListener(
+ IResourceExclusionListener listener) {
+ exclusionListeners.add(listener);
+ }
+
+ public void unregisterResourceExclusionListener(
+ IResourceExclusionListener listener) {
+ exclusionListeners.remove(listener);
+ }
+
+ public boolean isResourceExclusionListenerRegistered(
+ IResourceExclusionListener listener) {
+ return exclusionListeners.contains(listener);
+ }
+
+ public static void unregisterResourceExclusionListenerFromAllManagers(
+ IResourceExclusionListener excludedResource) {
+ for (ResourceBundleManager mgr : rbmanager.values()) {
+ mgr.unregisterResourceExclusionListener(excludedResource);
}
-
- public void removeResourceBundleEntry(String resourceBundleId,
- List<String> keys) throws ResourceBundleException {
-
- RBManager instance = RBManager.getInstance(project);
- IMessagesBundleGroup messagesBundleGroup = instance.getMessagesBundleGroup(resourceBundleId);
-
- DirtyHack.setFireEnabled(false);
-
- for (String key : keys) {
- messagesBundleGroup.removeMessages(key);
- }
-
- instance.writeToFile(messagesBundleGroup);
-
- DirtyHack.setFireEnabled(true);
-
- // notify the PropertyKeySelectionTree
- instance.fireEditorChanged();
+ }
+
+ public void addResourceBundleEntry(String resourceBundleId, String key,
+ Locale locale, String message) throws ResourceBundleException {
+
+ RBManager instance = RBManager.getInstance(project);
+ IMessagesBundleGroup bundleGroup = instance
+ .getMessagesBundleGroup(resourceBundleId);
+ IMessage entry = bundleGroup.getMessage(key, locale);
+
+ if (entry == null) {
+ DirtyHack.setFireEnabled(false);
+
+ IMessagesBundle messagesBundle = bundleGroup
+ .getMessagesBundle(locale);
+ IMessage m = MessageFactory.createMessage(key, locale);
+ m.setText(message);
+ messagesBundle.addMessage(m);
+
+ instance.writeToFile(messagesBundle);
+
+ DirtyHack.setFireEnabled(true);
+
+ // notify the PropertyKeySelectionTree
+ instance.fireEditorChanged();
}
-
- public boolean isResourceExisting (String bundleId, String key) {
- boolean keyExists = false;
- IMessagesBundleGroup bGroup = getResourceBundle(bundleId);
-
- if (bGroup != null) {
- keyExists = bGroup.isKey(key);
- }
-
- return keyExists;
+ }
+
+ public void saveResourceBundle(String resourceBundleId,
+ IMessagesBundleGroup newBundleGroup) throws ResourceBundleException {
+
+ // RBManager.getInstance().
+ }
+
+ public void removeResourceBundleEntry(String resourceBundleId,
+ List<String> keys) throws ResourceBundleException {
+
+ RBManager instance = RBManager.getInstance(project);
+ IMessagesBundleGroup messagesBundleGroup = instance
+ .getMessagesBundleGroup(resourceBundleId);
+
+ DirtyHack.setFireEnabled(false);
+
+ for (String key : keys) {
+ messagesBundleGroup.removeMessages(key);
}
-
- public static void refreshResource(IResource resource) {
- (new StringLiteralAuditor()).buildProject(null, resource.getProject());
- (new StringLiteralAuditor()).buildResource(resource, null);
+
+ instance.writeToFile(messagesBundleGroup);
+
+ DirtyHack.setFireEnabled(true);
+
+ // notify the PropertyKeySelectionTree
+ instance.fireEditorChanged();
+ }
+
+ public boolean isResourceExisting(String bundleId, String key) {
+ boolean keyExists = false;
+ IMessagesBundleGroup bGroup = getResourceBundle(bundleId);
+
+ if (bGroup != null) {
+ keyExists = bGroup.isKey(key);
}
- public Set<Locale> getProjectProvidedLocales() {
- Set<Locale> locales = new HashSet<Locale>();
-
- for (String bundleId : getResourceBundleNames()) {
- Set<Locale> rb_l = getProvidedLocales(bundleId);
- if (!rb_l.isEmpty()){
- Object[] bundlelocales = rb_l.toArray();
- for (Object l : bundlelocales) {
- /* TODO check if useful to add the default */
- if (!locales.contains(l))
- locales.add((Locale) l);
- }
- }
+ return keyExists;
+ }
+
+ public static void refreshResource(IResource resource) {
+ (new I18nBuilder()).buildProject(null, resource.getProject());
+ (new I18nBuilder()).buildResource(resource, null);
+ }
+
+ public Set<Locale> getProjectProvidedLocales() {
+ Set<Locale> locales = new HashSet<Locale>();
+
+ for (String bundleId : getResourceBundleNames()) {
+ Set<Locale> rb_l = getProvidedLocales(bundleId);
+ if (!rb_l.isEmpty()) {
+ Object[] bundlelocales = rb_l.toArray();
+ for (Object l : bundlelocales) {
+ /* TODO check if useful to add the default */
+ if (!locales.contains(l))
+ locales.add((Locale) l);
}
- return locales;
+ }
}
+ return locales;
+ }
}
diff --git a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/autocompletion/CreateResourceBundleProposal.java b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/autocompletion/CreateResourceBundleProposal.java
index bca9ad0c..301aac8a 100644
--- a/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/autocompletion/CreateResourceBundleProposal.java
+++ b/org.eclipse.babel.tapiji.tools.java/src/org/eclipse/babel/tapiji/tools/java/ui/autocompletion/CreateResourceBundleProposal.java
@@ -1,6 +1,6 @@
package org.eclipse.babel.tapiji.tools.java.ui.autocompletion;
-import org.eclipse.babel.tapiji.tools.core.builder.StringLiteralAuditor;
+import org.eclipse.babel.tapiji.tools.core.builder.I18nBuilder;
import org.eclipse.babel.tapiji.tools.core.model.manager.ResourceBundleManager;
import org.eclipse.babel.tapiji.tools.core.util.ResourceUtils;
import org.eclipse.babel.tapiji.translator.rbe.ui.wizards.IResourceBundleWizard;
@@ -127,9 +127,9 @@ protected void runAction() {
wd.setTitle(wizard.getWindowTitle());
if (wd.open() == WizardDialog.OK) {
- (new StringLiteralAuditor()).buildProject(null,
+ (new I18nBuilder()).buildProject(null,
resource.getProject());
- (new StringLiteralAuditor()).buildResource(resource, null);
+ (new I18nBuilder()).buildResource(resource, null);
ITextFileBufferManager bufferManager = FileBuffers
.getTextFileBufferManager();
|
b40e657180d21655dc6d1ceed6c7726fe7c78071
|
kotlin
|
Create from usage: Create constructor parameter- by reference in delegation specifier -KT-6601 Fixed--
|
a
|
https://github.com/JetBrains/kotlin
|
diff --git a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createVariable/CreateParameterActionFactory.kt b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createVariable/CreateParameterActionFactory.kt
index 03f976e86a38a..471c74f00035a 100644
--- a/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createVariable/CreateParameterActionFactory.kt
+++ b/idea/src/org/jetbrains/kotlin/idea/quickfix/createFromUsage/createVariable/CreateParameterActionFactory.kt
@@ -50,6 +50,8 @@ import org.jetbrains.kotlin.psi.psiUtil.getAssignmentByLHS
import org.jetbrains.kotlin.idea.quickfix.createFromUsage.callableBuilder.getExpressionForTypeGuess
import org.jetbrains.kotlin.idea.caches.resolve.analyzeFullyAndGetResult
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
+import org.jetbrains.kotlin.psi.JetDelegationSpecifier
+import org.jetbrains.kotlin.psi.psiUtil.getStrictParentOfType
object CreateParameterActionFactory: JetSingleIntentionActionFactory() {
override fun createAction(diagnostic: Diagnostic): IntentionAction? {
@@ -78,13 +80,20 @@ object CreateParameterActionFactory: JetSingleIntentionActionFactory() {
// todo: skip lambdas for now because Change Signature doesn't apply to them yet
val container = refExpr.parents(false)
- .filter { it is JetNamedFunction || it is JetPropertyAccessor || it is JetClassBody || it is JetClassInitializer }
+ .filter {
+ it is JetNamedFunction || it is JetPropertyAccessor || it is JetClassBody || it is JetClassInitializer ||
+ it is JetDelegationSpecifier
+ }
.firstOrNull()
?.let {
when {
it is JetNamedFunction && varExpected,
it is JetPropertyAccessor -> chooseContainingClass(it)
it is JetClassInitializer -> it.getParent()?.getParent() as? JetClass
+ it is JetDelegationSpecifier -> {
+ val klass = it.getStrictParentOfType<JetClass>()
+ if (klass != null && !klass.isTrait() && klass !is JetEnumEntry) klass else null
+ }
it is JetClassBody -> {
val klass = it.getParent() as? JetClass
when {
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterParameterFromClassDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterParameterFromClassDelegationSpecifier.kt
new file mode 100644
index 0000000000000..a5d9c99160b84
--- /dev/null
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/afterParameterFromClassDelegationSpecifier.kt
@@ -0,0 +1,9 @@
+// "Create parameter 'b'" "true"
+
+open class A(val a: Int) {
+
+}
+
+class B(b: Int) : A(b) {
+
+}
\ No newline at end of file
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromClassDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromClassDelegationSpecifier.kt
new file mode 100644
index 0000000000000..5cd39985fc62b
--- /dev/null
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromClassDelegationSpecifier.kt
@@ -0,0 +1,9 @@
+// "Create parameter 'b'" "true"
+
+open class A(val a: Int) {
+
+}
+
+class B: A(<caret>b) {
+
+}
\ No newline at end of file
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromEnumEntryDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromEnumEntryDelegationSpecifier.kt
new file mode 100644
index 0000000000000..36abff1bfd5e8
--- /dev/null
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromEnumEntryDelegationSpecifier.kt
@@ -0,0 +1,7 @@
+// "Create parameter 'x'" "false"
+// ERROR: Unresolved reference: x
+// ACTION: Create property 'x'
+
+enum class E(n: Int) {
+ X: E(<caret>x)
+}
\ No newline at end of file
diff --git a/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromObjectDelegationSpecifier.kt b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromObjectDelegationSpecifier.kt
new file mode 100644
index 0000000000000..12a7e5e340aac
--- /dev/null
+++ b/idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromObjectDelegationSpecifier.kt
@@ -0,0 +1,11 @@
+// "Create parameter 'b'" "false"
+// ERROR: Unresolved reference: b
+// ACTION: Create property 'b'
+
+open class A(val a: Int) {
+
+}
+
+object B: A(<caret>b) {
+
+}
\ No newline at end of file
diff --git a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java
index ec87dab8b44e6..ef74610d1e872 100644
--- a/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java
+++ b/idea/tests/org/jetbrains/kotlin/idea/quickfix/QuickFixTestGenerated.java
@@ -2417,6 +2417,24 @@ public void testNullableType() throws Exception {
doTest(fileName);
}
+ @TestMetadata("beforeParameterFromClassDelegationSpecifier.kt")
+ public void testParameterFromClassDelegationSpecifier() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromClassDelegationSpecifier.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("beforeParameterFromEnumEntryDelegationSpecifier.kt")
+ public void testParameterFromEnumEntryDelegationSpecifier() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromEnumEntryDelegationSpecifier.kt");
+ doTest(fileName);
+ }
+
+ @TestMetadata("beforeParameterFromObjectDelegationSpecifier.kt")
+ public void testParameterFromObjectDelegationSpecifier() throws Exception {
+ String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeParameterFromObjectDelegationSpecifier.kt");
+ doTest(fileName);
+ }
+
@TestMetadata("beforeQualifiedInFun.kt")
public void testQualifiedInFun() throws Exception {
String fileName = JetTestUtils.navigationMetadata("idea/testData/quickfix/createFromUsage/createVariable/parameter/beforeQualifiedInFun.kt");
|
5148146dafe9a89c5d21af420a179603399e9c40
|
hbase
|
HBASE-1938 Make in-memory table scanning faster ;- reverted 20110726_1938_MemStore.patch till we figure why it seems to slow- tests--git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1151653 13f79535-47bb-0310-9956-ffa450edef68-
|
p
|
https://github.com/apache/hbase
|
diff --git a/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java b/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
index 49faa92d94aa..1cf46fccf5f3 100644
--- a/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
+++ b/src/main/java/org/apache/hadoop/hbase/regionserver/MemStore.java
@@ -646,15 +646,11 @@ protected class MemStoreScanner implements KeyValueScanner {
private KeyValue snapshotNextRow = null;
// iterator based scanning.
- private Iterator<KeyValue> kvsetIt;
- private Iterator<KeyValue> snapshotIt;
+ Iterator<KeyValue> kvsetIt;
+ Iterator<KeyValue> snapshotIt;
// number of iterations in this reseek operation
- private int numIterReseek;
-
-
- // the pre-calculated KeyValue to be returned by peek() or next()
- private KeyValue theNext;
+ int numIterReseek;
/*
Some notes...
@@ -680,9 +676,9 @@ protected class MemStoreScanner implements KeyValueScanner {
//DebugPrint.println(" MS new@" + hashCode());
}
- protected KeyValue getNext(Iterator<KeyValue> it, long readPoint) {
+ protected KeyValue getNext(Iterator<KeyValue> it) {
KeyValue ret = null;
- //long readPoint = ReadWriteConsistencyControl.getThreadReadPoint();
+ long readPoint = ReadWriteConsistencyControl.getThreadReadPoint();
//DebugPrint.println( " MS@" + hashCode() + ": threadpoint = " + readPoint);
while (ret == null && it.hasNext()) {
@@ -714,11 +710,9 @@ public synchronized boolean seek(KeyValue key) {
kvsetIt = kvTail.iterator();
snapshotIt = snapshotTail.iterator();
- long readPoint = ReadWriteConsistencyControl.getThreadReadPoint();
- kvsetNextRow = getNext(kvsetIt, readPoint);
- snapshotNextRow = getNext(snapshotIt, readPoint);
+ kvsetNextRow = getNext(kvsetIt);
+ snapshotNextRow = getNext(snapshotIt);
- theNext = getLowest();
//long readPoint = ReadWriteConsistencyControl.getThreadReadPoint();
//DebugPrint.println( " MS@" + hashCode() + " kvset seek: " + kvsetNextRow + " with size = " +
@@ -726,18 +720,19 @@ public synchronized boolean seek(KeyValue key) {
//DebugPrint.println( " MS@" + hashCode() + " snapshot seek: " + snapshotNextRow + " with size = " +
// snapshot.size() + " threadread = " + readPoint);
- // has data
- return (theNext != null);
+
+ KeyValue lowest = getLowest();
+
+ // has data := (lowest != null)
+ return lowest != null;
}
@Override
- public synchronized boolean reseek(KeyValue key) {
-
+ public boolean reseek(KeyValue key) {
numIterReseek = reseekNumKeys;
while (kvsetNextRow != null &&
comparator.compare(kvsetNextRow, key) < 0) {
- kvsetNextRow = getNext(kvsetIt,
- ReadWriteConsistencyControl.getThreadReadPoint());
+ kvsetNextRow = getNext(kvsetIt);
// if we scanned enough entries but still not able to find the
// kv we are looking for, better cut our costs and do a tree
// scan using seek.
@@ -748,8 +743,7 @@ public synchronized boolean reseek(KeyValue key) {
while (snapshotNextRow != null &&
comparator.compare(snapshotNextRow, key) < 0) {
- snapshotNextRow = getNext(snapshotIt,
- ReadWriteConsistencyControl.getThreadReadPoint());
+ snapshotNextRow = getNext(snapshotIt);
// if we scanned enough entries but still not able to find the
// kv we are looking for, better cut our costs and do a tree
// scan using seek.
@@ -757,48 +751,38 @@ public synchronized boolean reseek(KeyValue key) {
return seek(key);
}
}
-
- // Calculate the next value
- theNext = getLowest();
-
- return (theNext != null);
+ return (kvsetNextRow != null || snapshotNextRow != null);
}
- @Override
public synchronized KeyValue peek() {
//DebugPrint.println(" MS@" + hashCode() + " peek = " + getLowest());
- return theNext;
+ return getLowest();
}
- @Override
public synchronized KeyValue next() {
+ KeyValue theNext = getLowest();
if (theNext == null) {
return null;
}
- KeyValue ret = theNext;
-
// Advance one of the iterators
- long readPoint = ReadWriteConsistencyControl.getThreadReadPoint();
if (theNext == kvsetNextRow) {
- kvsetNextRow = getNext(kvsetIt, readPoint);
+ kvsetNextRow = getNext(kvsetIt);
} else {
- snapshotNextRow = getNext(snapshotIt, readPoint);
+ snapshotNextRow = getNext(snapshotIt);
}
- // Calculate the next value
- theNext = getLowest();
-
- //readpoint = ReadWriteConsistencyControl.getThreadReadPoint();
- //DebugPrint.println(" MS@" + hashCode() + " next: " + theNext +
- // " next_next: " + getLowest() + " threadpoint=" + readpoint);
- return ret;
+ //long readpoint = ReadWriteConsistencyControl.getThreadReadPoint();
+ //DebugPrint.println(" MS@" + hashCode() + " next: " + theNext + " next_next: " +
+ // getLowest() + " threadpoint=" + readpoint);
+ return theNext;
}
protected KeyValue getLowest() {
- return getLower(kvsetNextRow, snapshotNextRow);
+ return getLower(kvsetNextRow,
+ snapshotNextRow);
}
/*
@@ -807,15 +791,14 @@ protected KeyValue getLowest() {
* comparator.
*/
protected KeyValue getLower(KeyValue first, KeyValue second) {
- if (first == null) {
- return second;
+ if (first == null && second == null) {
+ return null;
}
- if (second == null) {
- return first;
+ if (first != null && second != null) {
+ int compare = comparator.compare(first, second);
+ return (compare <= 0 ? first : second);
}
-
- int compare = comparator.compare(first, second);
- return (compare <= 0 ? first : second);
+ return (first != null ? first : second);
}
public synchronized void close() {
|
1acdbae0b3796b43f5348ae826fd2ff1f36bc973
|
Vala
|
gtk+-2.0: Make Gtk.Window's arg default value Gtk.WindowType.TOPLEVEL
|
a
|
https://github.com/GNOME/vala/
|
diff --git a/vapi/gtk+-2.0.vapi b/vapi/gtk+-2.0.vapi
index 1c7cebcb44..df059f22d8 100644
--- a/vapi/gtk+-2.0.vapi
+++ b/vapi/gtk+-2.0.vapi
@@ -5512,7 +5512,7 @@ namespace Gtk {
public weak string wmclass_class;
public weak string wmclass_name;
[CCode (type = "GtkWidget*", has_construct_function = false)]
- public Window (Gtk.WindowType type);
+ public Window (Gtk.WindowType type = Gtk.WindowType.TOPLEVEL);
public bool activate_default ();
public bool activate_focus ();
public bool activate_key (Gdk.EventKey event);
diff --git a/vapi/packages/gtk+-2.0/gtk+-2.0.metadata b/vapi/packages/gtk+-2.0/gtk+-2.0.metadata
index aa81923e08..1ccbbf7761 100644
--- a/vapi/packages/gtk+-2.0/gtk+-2.0.metadata
+++ b/vapi/packages/gtk+-2.0/gtk+-2.0.metadata
@@ -798,6 +798,7 @@ gtk_window_is_active hidden="1" experimental="1"
gtk_window_list_toplevels transfer_ownership="1" type_arguments="unowned Window"
gtk_window_set_default_icon_list.list type_arguments="Gdk.Pixbuf"
gtk_window_set_icon_list.list type_arguments="Gdk.Pixbuf"
+gtk_window_new.type default_value="Gtk.WindowType.TOPLEVEL"
gtk_widget_new hidden="1"
GtkWindow::activate_default name="default_activated" experimental="1"
GtkWindow::activate_focus name="focus_activated" experimental="1"
|
8d07116266f2a2cb19dc303e5937bb6f248b81fb
|
hadoop
|
YARN-2331. Distinguish shutdown during supervision- vs. shutdown for rolling upgrade. Contributed by Jason Lowe--(cherry picked from commit 088156de43abb07bec590a3fcd1a5af2feb02cd2)-
|
p
|
https://github.com/apache/hadoop
|
diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt
index 02f61fb3a0049..4e577e989e302 100644
--- a/hadoop-yarn-project/CHANGES.txt
+++ b/hadoop-yarn-project/CHANGES.txt
@@ -161,6 +161,9 @@ Release 2.8.0 - UNRELEASED
yarn.scheduler.capacity.node-locality-delay in code and default xml file.
(Nijel SF via vinodkv)
+ YARN-2331. Distinguish shutdown during supervision vs. shutdown for
+ rolling upgrade. (Jason Lowe via xgong)
+
OPTIMIZATIONS
YARN-3339. TestDockerContainerExecutor should pull a single image and not
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
index 9c1db1744f788..315903dcbf2f5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
@@ -1158,6 +1158,10 @@ private static void addDeprecatedKeys() {
public static final String NM_RECOVERY_DIR = NM_RECOVERY_PREFIX + "dir";
+ public static final String NM_RECOVERY_SUPERVISED =
+ NM_RECOVERY_PREFIX + "supervised";
+ public static final boolean DEFAULT_NM_RECOVERY_SUPERVISED = false;
+
////////////////////////////////
// Web Proxy Configs
////////////////////////////////
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
index e1e0ebd3d777b..4d74f7622f89e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
@@ -1192,6 +1192,15 @@
<value>${hadoop.tmp.dir}/yarn-nm-recovery</value>
</property>
+ <property>
+ <description>Whether the nodemanager is running under supervision. A
+ nodemanager that supports recovery and is running under supervision
+ will not try to cleanup containers as it exits with the assumption
+ it will be immediately be restarted and recover containers.</description>
+ <name>yarn.nodemanager.recovery.supervised</name>
+ <value>false</value>
+ </property>
+
<!--Docker configuration-->
<property>
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
index c48df64bd9f46..494fa8fbd88a6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
@@ -530,8 +530,11 @@ public void cleanUpApplicationsOnNMShutDown() {
if (this.context.getNMStateStore().canRecover()
&& !this.context.getDecommissioned()) {
- // do not cleanup apps as they can be recovered on restart
- return;
+ if (getConfig().getBoolean(YarnConfiguration.NM_RECOVERY_SUPERVISED,
+ YarnConfiguration.DEFAULT_NM_RECOVERY_SUPERVISED)) {
+ // do not cleanup apps as they can be recovered on restart
+ return;
+ }
}
List<ApplicationId> appIds =
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java
index 0018d56421470..dbbfcd5deb21d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java
@@ -145,10 +145,13 @@ protected void serviceStop() throws Exception {
private void stopAggregators() {
threadPool.shutdown();
+ boolean supervised = getConfig().getBoolean(
+ YarnConfiguration.NM_RECOVERY_SUPERVISED,
+ YarnConfiguration.DEFAULT_NM_RECOVERY_SUPERVISED);
// if recovery on restart is supported then leave outstanding aggregations
// to the next restart
boolean shouldAbort = context.getNMStateStore().canRecover()
- && !context.getDecommissioned();
+ && !context.getDecommissioned() && supervised;
// politely ask to finish
for (AppLogAggregator aggregator : appLogAggregators.values()) {
if (shouldAbort) {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManagerRecovery.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManagerRecovery.java
index c45ffbb93ddef..781950e08d27f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManagerRecovery.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManagerRecovery.java
@@ -22,7 +22,11 @@
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.isA;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.verify;
import java.nio.ByteBuffer;
import java.security.PrivilegedExceptionAction;
@@ -68,6 +72,7 @@
import org.apache.hadoop.yarn.server.nodemanager.containermanager.loghandler.LogHandler;
import org.apache.hadoop.yarn.server.nodemanager.metrics.NodeManagerMetrics;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMMemoryStateStoreService;
+import org.apache.hadoop.yarn.server.nodemanager.recovery.NMNullStateStoreService;
import org.apache.hadoop.yarn.server.nodemanager.recovery.NMStateStoreService;
import org.apache.hadoop.yarn.server.nodemanager.security.NMContainerTokenSecretManager;
import org.apache.hadoop.yarn.server.nodemanager.security.NMTokenSecretManagerInNM;
@@ -82,27 +87,18 @@ public class TestContainerManagerRecovery {
public void testApplicationRecovery() throws Exception {
YarnConfiguration conf = new YarnConfiguration();
conf.setBoolean(YarnConfiguration.NM_RECOVERY_ENABLED, true);
+ conf.setBoolean(YarnConfiguration.NM_RECOVERY_SUPERVISED, true);
conf.set(YarnConfiguration.NM_ADDRESS, "localhost:1234");
conf.setBoolean(YarnConfiguration.YARN_ACL_ENABLE, true);
conf.set(YarnConfiguration.YARN_ADMIN_ACL, "yarn_admin_user");
NMStateStoreService stateStore = new NMMemoryStateStoreService();
stateStore.init(conf);
stateStore.start();
- Context context = new NMContext(new NMContainerTokenSecretManager(
- conf), new NMTokenSecretManagerInNM(), null,
- new ApplicationACLsManager(conf), stateStore);
+ Context context = createContext(conf, stateStore);
ContainerManagerImpl cm = createContainerManager(context);
cm.init(conf);
cm.start();
- // simulate registration with RM
- MasterKey masterKey = new MasterKeyPBImpl();
- masterKey.setKeyId(123);
- masterKey.setBytes(ByteBuffer.wrap(new byte[] { new Integer(123)
- .byteValue() }));
- context.getContainerTokenSecretManager().setMasterKey(masterKey);
- context.getNMTokenSecretManager().setMasterKey(masterKey);
-
// add an application by starting a container
String appUser = "app_user1";
String modUser = "modify_user1";
@@ -155,9 +151,7 @@ public void testApplicationRecovery() throws Exception {
// reset container manager and verify app recovered with proper acls
cm.stop();
- context = new NMContext(new NMContainerTokenSecretManager(
- conf), new NMTokenSecretManagerInNM(), null,
- new ApplicationACLsManager(conf), stateStore);
+ context = createContext(conf, stateStore);
cm = createContainerManager(context);
cm.init(conf);
cm.start();
@@ -201,9 +195,7 @@ public void testApplicationRecovery() throws Exception {
// restart and verify app is marked for finishing
cm.stop();
- context = new NMContext(new NMContainerTokenSecretManager(
- conf), new NMTokenSecretManagerInNM(), null,
- new ApplicationACLsManager(conf), stateStore);
+ context = createContext(conf, stateStore);
cm = createContainerManager(context);
cm.init(conf);
cm.start();
@@ -233,9 +225,7 @@ public void testApplicationRecovery() throws Exception {
// restart and verify app is no longer present after recovery
cm.stop();
- context = new NMContext(new NMContainerTokenSecretManager(
- conf), new NMTokenSecretManagerInNM(), null,
- new ApplicationACLsManager(conf), stateStore);
+ context = createContext(conf, stateStore);
cm = createContainerManager(context);
cm.init(conf);
cm.start();
@@ -243,6 +233,95 @@ public void testApplicationRecovery() throws Exception {
cm.stop();
}
+ @Test
+ public void testContainerCleanupOnShutdown() throws Exception {
+ ApplicationId appId = ApplicationId.newInstance(0, 1);
+ ApplicationAttemptId attemptId =
+ ApplicationAttemptId.newInstance(appId, 1);
+ ContainerId cid = ContainerId.newContainerId(attemptId, 1);
+ Map<String, LocalResource> localResources = Collections.emptyMap();
+ Map<String, String> containerEnv = Collections.emptyMap();
+ List<String> containerCmds = Collections.emptyList();
+ Map<String, ByteBuffer> serviceData = Collections.emptyMap();
+ Credentials containerCreds = new Credentials();
+ DataOutputBuffer dob = new DataOutputBuffer();
+ containerCreds.writeTokenStorageToStream(dob);
+ ByteBuffer containerTokens = ByteBuffer.wrap(dob.getData(), 0,
+ dob.getLength());
+ Map<ApplicationAccessType, String> acls = Collections.emptyMap();
+ ContainerLaunchContext clc = ContainerLaunchContext.newInstance(
+ localResources, containerEnv, containerCmds, serviceData,
+ containerTokens, acls);
+ // create the logAggregationContext
+ LogAggregationContext logAggregationContext =
+ LogAggregationContext.newInstance("includePattern", "excludePattern");
+
+ // verify containers are stopped on shutdown without recovery
+ YarnConfiguration conf = new YarnConfiguration();
+ conf.setBoolean(YarnConfiguration.NM_RECOVERY_ENABLED, false);
+ conf.setBoolean(YarnConfiguration.NM_RECOVERY_SUPERVISED, false);
+ conf.set(YarnConfiguration.NM_ADDRESS, "localhost:1234");
+ Context context = createContext(conf, new NMNullStateStoreService());
+ ContainerManagerImpl cm = spy(createContainerManager(context));
+ cm.init(conf);
+ cm.start();
+ StartContainersResponse startResponse = startContainer(context, cm, cid,
+ clc, logAggregationContext);
+ assertEquals(1, startResponse.getSuccessfullyStartedContainers().size());
+ cm.stop();
+ verify(cm).handle(isA(CMgrCompletedAppsEvent.class));
+
+ // verify containers are stopped on shutdown with unsupervised recovery
+ conf.setBoolean(YarnConfiguration.NM_RECOVERY_ENABLED, true);
+ conf.setBoolean(YarnConfiguration.NM_RECOVERY_SUPERVISED, false);
+ NMMemoryStateStoreService memStore = new NMMemoryStateStoreService();
+ memStore.init(conf);
+ memStore.start();
+ context = createContext(conf, memStore);
+ cm = spy(createContainerManager(context));
+ cm.init(conf);
+ cm.start();
+ startResponse = startContainer(context, cm, cid,
+ clc, logAggregationContext);
+ assertEquals(1, startResponse.getSuccessfullyStartedContainers().size());
+ cm.stop();
+ memStore.close();
+ verify(cm).handle(isA(CMgrCompletedAppsEvent.class));
+
+ // verify containers are not stopped on shutdown with supervised recovery
+ conf.setBoolean(YarnConfiguration.NM_RECOVERY_ENABLED, true);
+ conf.setBoolean(YarnConfiguration.NM_RECOVERY_SUPERVISED, true);
+ memStore = new NMMemoryStateStoreService();
+ memStore.init(conf);
+ memStore.start();
+ context = createContext(conf, memStore);
+ cm = spy(createContainerManager(context));
+ cm.init(conf);
+ cm.start();
+ startResponse = startContainer(context, cm, cid,
+ clc, logAggregationContext);
+ assertEquals(1, startResponse.getSuccessfullyStartedContainers().size());
+ cm.stop();
+ memStore.close();
+ verify(cm, never()).handle(isA(CMgrCompletedAppsEvent.class));
+ }
+
+ private NMContext createContext(YarnConfiguration conf,
+ NMStateStoreService stateStore) {
+ NMContext context = new NMContext(new NMContainerTokenSecretManager(
+ conf), new NMTokenSecretManagerInNM(), null,
+ new ApplicationACLsManager(conf), stateStore);
+
+ // simulate registration with RM
+ MasterKey masterKey = new MasterKeyPBImpl();
+ masterKey.setKeyId(123);
+ masterKey.setBytes(ByteBuffer.wrap(new byte[] { new Integer(123)
+ .byteValue() }));
+ context.getContainerTokenSecretManager().setMasterKey(masterKey);
+ context.getNMTokenSecretManager().setMasterKey(masterKey);
+ return context;
+ }
+
private StartContainersResponse startContainer(Context context,
final ContainerManagerImpl cm, ContainerId cid,
ContainerLaunchContext clc, LogAggregationContext logAggregationContext)
|
de286e000716ec9057dfdaefeeda91d34be22d64
|
Delta Spike
|
DELTASPIKE-277 add first API draft
|
a
|
https://github.com/apache/deltaspike
|
diff --git a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/message/JsfMessage.java b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/message/JsfMessage.java
index 01bbdd70d..0637c0c85 100644
--- a/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/message/JsfMessage.java
+++ b/deltaspike/modules/jsf/api/src/main/java/org/apache/deltaspike/jsf/message/JsfMessage.java
@@ -28,7 +28,7 @@
* @Inject
* JsfMessage<MyMessages> msg;
* ...
- * msg.addError().userNotLoggedIn();
+ * msg.addError().userNotLoggedIn(user);
* </pre>
* <p>MessageBundle methods which are used as JsfMessage can return a
* {@link org.apache.deltaspike.core.api.message.Message} or a String.
@@ -41,8 +41,28 @@
*/
public interface JsfMessage<T>
{
+ /**
+ * @return the underlying Message which will automatically add a FacesMessage with SEVERITY_ERROR
+ */
T addError();
+
+ /**
+ * @return the underlying Message which will automatically add a FacesMessage with SEVERITY_FATAL
+ */
T addFatal();
+
+ /**
+ * @return the underlying Message which will automatically add a FacesMessage with SEVERITY_INFO
+ */
T addInfo();
+
+ /**
+ * @return the underlying Message which will automatically add a FacesMessage with SEVERITY_WARN
+ */
T addWarn();
+
+ /**
+ * @return the underlying Message implementation without adding any FacesMessage
+ */
+ T get();
}
diff --git a/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/DefaultJsfMessage.java b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/DefaultJsfMessage.java
new file mode 100644
index 000000000..e8e9e9255
--- /dev/null
+++ b/deltaspike/modules/jsf/impl/src/main/java/org/apache/deltaspike/jsf/impl/message/DefaultJsfMessage.java
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.deltaspike.jsf.impl.message;
+
+import org.apache.deltaspike.jsf.message.JsfMessage;
+
+/**
+ * Default implementation of JsfMessage.
+ */
+public class DefaultJsfMessage<T> implements JsfMessage<T>
+{
+ @Override
+ public T addError()
+ {
+ //X TODO
+ return null;
+ }
+
+ @Override
+ public T addFatal()
+ {
+ //X TODO
+ return null;
+ }
+
+ @Override
+ public T addInfo()
+ {
+ //X TODO
+ return null;
+ }
+
+ @Override
+ public T addWarn()
+ {
+ //X TODO
+ return null;
+ }
+
+ @Override
+ public T get()
+ {
+ //X TODO
+ return null;
+ }
+}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.