Strip out the GWT dependencies
We are never going to get around to supporting GWT client side
execution of a database using HTML 5's offline SQLLite based
store. So just rip this code out altogether.
Change-Id: I74795fc77afe088f7a020bcf261816976945c0d4
Signed-off-by: Shawn O. Pearce <sop@google.com>
diff --git a/pom.xml b/pom.xml
index b47e45b..5ecd61d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -23,7 +23,7 @@
<packaging>jar</packaging>
<version>1.1.3-SNAPSHOT</version>
<name>gwtorm</name>
- <description>Tiny ORM for GWT, JDBC</description>
+ <description>Tiny ORM</description>
<url>http://android.git.kernel.org/?p=tools/gwtorm.git</url>
<mailingLists>
@@ -252,10 +252,6 @@
</license>
</licenses>
- <properties>
- <gwtVersion>1.6.4</gwtVersion>
- </properties>
-
<build>
<plugins>
<plugin>
@@ -307,35 +303,6 @@
<scope>compile</scope>
</dependency>
- <!-- GWT -->
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-servlet</artifactId>
- <version>${gwtVersion}</version>
- <scope>runtime</scope>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- <version>${gwtVersion}</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-dev</artifactId>
- <version>${gwtVersion}</version>
- <classifier>${platform}-libs</classifier>
- <type>zip</type>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-dev</artifactId>
- <version>${gwtVersion}</version>
- <classifier>${platform}</classifier>
- <scope>provided</scope>
- </dependency>
-
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
@@ -365,45 +332,6 @@
</dependency>
</dependencies>
- <profiles>
- <profile>
- <id>gwt-dev-windows</id>
- <properties>
- <platform>windows</platform>
- </properties>
- <activation>
- <activeByDefault>true</activeByDefault>
- <os>
- <family>windows</family>
- </os>
- </activation>
- </profile>
- <profile>
- <id>gwt-dev-mac</id>
- <properties>
- <platform>mac</platform>
- </properties>
- <activation>
- <activeByDefault>false</activeByDefault>
- <os>
- <family>mac</family>
- </os>
- </activation>
- </profile>
- <profile>
- <id>gwt-dev-linux</id>
- <properties>
- <platform>linux</platform>
- </properties>
- <activation>
- <activeByDefault>false</activeByDefault>
- <os>
- <name>linux</name>
- </os>
- </activation>
- </profile>
- </profiles>
-
<repositories>
<repository>
<id>objectweb-repository</id>
diff --git a/src/main/java/com/google/gwtorm/GWTORM.gwt.xml b/src/main/java/com/google/gwtorm/GWTORM.gwt.xml
index a90a699..1d85a7c 100644
--- a/src/main/java/com/google/gwtorm/GWTORM.gwt.xml
+++ b/src/main/java/com/google/gwtorm/GWTORM.gwt.xml
@@ -14,11 +14,4 @@
limitations under the License.
-->
<module>
- <inherits name="com.google.gwt.core.Core"/>
-
-<!--
- <generate-with class="com.google.gwtorm.rebind.DataAccessGenerator">
- <when-type-assignable class="com.google.gwtorm.client.DataAccess" />
- </generate-with>
--->
</module>
diff --git a/src/main/java/com/google/gwtorm/client/KeyUtil.java b/src/main/java/com/google/gwtorm/client/KeyUtil.java
index 938dac6..9341b5f 100644
--- a/src/main/java/com/google/gwtorm/client/KeyUtil.java
+++ b/src/main/java/com/google/gwtorm/client/KeyUtil.java
@@ -14,8 +14,6 @@
package com.google.gwtorm.client;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.http.client.URL;
import com.google.gwtorm.server.StandardKeyEncoder;
@@ -23,12 +21,6 @@
public class KeyUtil {
private static Encoder ENCODER_IMPL;
- static {
- if (GWT.isClient()) {
- ENCODER_IMPL = new GwtEncoder();
- }
- }
-
/**
* Set the encoder implementation to a valid implementation.
* <p>
@@ -109,20 +101,6 @@
public abstract String decode(String e);
}
- private static class GwtEncoder extends Encoder {
- @Override
- public String encode(final String e) {
- return fixPathImpl(URL.encodeComponent(e));
- }
-
- @Override
- public String decode(final String e) {
- return URL.decodeComponent(e);
- }
-
- private static native String fixPathImpl(String path) /*-{ return path.replace(/%2F/g, "/"); }-*/;
- }
-
private KeyUtil() {
}
}
diff --git a/src/main/java/com/google/gwtorm/rebind/AccessCreator.java b/src/main/java/com/google/gwtorm/rebind/AccessCreator.java
deleted file mode 100644
index 240d748..0000000
--- a/src/main/java/com/google/gwtorm/rebind/AccessCreator.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2008 Google Inc.
-//
-// 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 com.google.gwtorm.rebind;
-
-import com.google.gwt.core.ext.GeneratorContext;
-import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.core.ext.UnableToCompleteException;
-import com.google.gwt.core.ext.typeinfo.JArrayType;
-import com.google.gwt.core.ext.typeinfo.JClassType;
-import com.google.gwt.core.ext.typeinfo.JPackage;
-import com.google.gwt.core.ext.typeinfo.JType;
-import com.google.gwt.core.ext.typeinfo.TypeOracle;
-import com.google.gwt.user.rebind.ClassSourceFileComposerFactory;
-import com.google.gwt.user.rebind.SourceWriter;
-
-import java.io.PrintWriter;
-
-class AccessCreator {
- private static final String ACCESS_SUFFIX = "_DataAccess";
- private JClassType svcInf;
-
- AccessCreator(final JClassType remoteService) {
- svcInf = remoteService;
- }
-
- String create(final TreeLogger logger, final GeneratorContext context)
- throws UnableToCompleteException {
- final TypeOracle typeOracle = context.getTypeOracle();
-
- final SourceWriter srcWriter = getSourceWriter(logger, context);
- if (srcWriter == null) {
- return getProxyQualifiedName();
- }
-
- srcWriter.commit(logger);
-
- return getProxyQualifiedName();
- }
-
- private SourceWriter getSourceWriter(final TreeLogger logger,
- final GeneratorContext ctx) {
- final JPackage servicePkg = svcInf.getPackage();
- final String pkgName = servicePkg == null ? "" : servicePkg.getName();
- final PrintWriter pw;
- final ClassSourceFileComposerFactory cf;
-
- pw = ctx.tryCreate(logger, pkgName, getProxySimpleName());
- if (pw == null) {
- return null;
- }
-
- cf = new ClassSourceFileComposerFactory(pkgName, getProxySimpleName());
- cf.addImplementedInterface(svcInf.getErasedType().getQualifiedSourceName());
- return cf.createSourceWriter(ctx, pw);
- }
-
- private String getProxyQualifiedName() {
- final String[] name = synthesizeTopLevelClassName(svcInf, ACCESS_SUFFIX);
- return name[0].length() == 0 ? name[1] : name[0] + "." + name[1];
- }
-
- private String getProxySimpleName() {
- return synthesizeTopLevelClassName(svcInf, ACCESS_SUFFIX)[1];
- }
-
- static String[] synthesizeTopLevelClassName(JClassType type, String suffix) {
- // Gets the basic name of the type. If it's a nested type, the type name
- // will contains dots.
- //
- String className;
- String packageName;
-
- JType leafType = type.getLeafType();
- if (leafType.isPrimitive() != null) {
- className = leafType.getSimpleSourceName();
- packageName = "";
- } else {
- JClassType classOrInterface = leafType.isClassOrInterface();
- assert (classOrInterface != null);
- className = classOrInterface.getName();
- packageName = classOrInterface.getPackage().getName();
- }
-
- JArrayType isArray = type.isArray();
- if (isArray != null) {
- className += "_Array_Rank_" + isArray.getRank();
- }
-
- // Add the meaningful suffix.
- //
- className += suffix;
-
- // Make it a top-level name.
- //
- className = className.replace('.', '_');
-
- return new String[] {packageName, className};
- }
-}
diff --git a/src/main/java/com/google/gwtorm/rebind/DataAccessGenerator.java b/src/main/java/com/google/gwtorm/rebind/DataAccessGenerator.java
deleted file mode 100644
index 31a9547..0000000
--- a/src/main/java/com/google/gwtorm/rebind/DataAccessGenerator.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2008 Google Inc.
-//
-// 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 com.google.gwtorm.rebind;
-
-import com.google.gwt.core.ext.Generator;
-import com.google.gwt.core.ext.GeneratorContext;
-import com.google.gwt.core.ext.TreeLogger;
-import com.google.gwt.core.ext.UnableToCompleteException;
-import com.google.gwt.core.ext.typeinfo.JClassType;
-import com.google.gwt.core.ext.typeinfo.TypeOracle;
-
-public class DataAccessGenerator extends Generator {
- @Override
- public String generate(final TreeLogger logger, final GeneratorContext ctx,
- final String requestedClass) throws UnableToCompleteException {
-
- final TypeOracle typeOracle = ctx.getTypeOracle();
- assert (typeOracle != null);
-
- final JClassType remoteService = typeOracle.findType(requestedClass);
- if (remoteService == null) {
- logger.log(TreeLogger.ERROR, "Unable to find metadata for type '"
- + requestedClass + "'", null);
- throw new UnableToCompleteException();
- }
-
- if (remoteService.isInterface() == null) {
- logger.log(TreeLogger.ERROR, remoteService.getQualifiedSourceName()
- + " is not an interface", null);
- throw new UnableToCompleteException();
- }
-
- AccessCreator proxyCreator = new AccessCreator(remoteService);
-
- TreeLogger proxyLogger =
- logger.branch(TreeLogger.DEBUG, "Generating data access for '"
- + remoteService.getQualifiedSourceName() + "'", null);
-
- return proxyCreator.create(proxyLogger, ctx);
- }
-}
diff --git a/src/main/java/com/google/gwtorm/schema/gwt/GwtColumnModel.java b/src/main/java/com/google/gwtorm/schema/gwt/GwtColumnModel.java
deleted file mode 100644
index e2c2605..0000000
--- a/src/main/java/com/google/gwtorm/schema/gwt/GwtColumnModel.java
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2008 Google Inc.
-//
-// 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 com.google.gwtorm.schema.gwt;
-
-import com.google.gwt.core.ext.typeinfo.JClassType;
-import com.google.gwt.core.ext.typeinfo.JField;
-import com.google.gwt.core.ext.typeinfo.JPrimitiveType;
-import com.google.gwt.core.ext.typeinfo.JType;
-import com.google.gwtorm.client.Column;
-import com.google.gwtorm.client.OrmException;
-import com.google.gwtorm.client.RowVersion;
-import com.google.gwtorm.schema.ColumnModel;
-
-import java.util.ArrayList;
-import java.util.List;
-
-
-class GwtColumnModel extends ColumnModel {
- static Class<?> toClass(final JType type) {
- if (type.isPrimitive() == JPrimitiveType.BOOLEAN) {
- return Boolean.TYPE;
- }
-
- if (type.isPrimitive() == JPrimitiveType.BYTE) {
- return Byte.TYPE;
- }
-
- if (type.isPrimitive() == JPrimitiveType.SHORT) {
- return Short.TYPE;
- }
-
- if (type.isPrimitive() == JPrimitiveType.CHAR) {
- return Character.TYPE;
- }
-
- if (type.isPrimitive() == JPrimitiveType.INT) {
- return Integer.TYPE;
- }
-
- if (type.isPrimitive() == JPrimitiveType.LONG) {
- return Long.TYPE;
- }
-
- if (type.isPrimitive() == JPrimitiveType.FLOAT) {
- return Float.TYPE;
- }
-
- if (type.isPrimitive() == JPrimitiveType.DOUBLE) {
- return Double.TYPE;
- }
-
- if (type.isArray() != null && type.isArray().getRank() == 1
- && type.isArray().getComponentType() == JPrimitiveType.BYTE) {
- return byte[].class;
- }
-
- if (type.isClass() != null
- && type.getQualifiedSourceName().startsWith("java.")) {
- try {
- return Class.forName(type.getQualifiedSourceName());
- } catch (ClassNotFoundException err) {
- // Never happen, but fall through anyway
- }
- }
-
- return null;
- }
-
- private final JField field;
- private final Class<?> primitiveType;
-
- GwtColumnModel(final JField columnField) throws OrmException {
- field = columnField;
- initName(field.getName(), field.getAnnotation(Column.class));
-
- if (field.isPrivate()) {
- throw new OrmException("Field " + getFieldName() + " of "
- + field.getEnclosingType().getQualifiedSourceName()
- + " must not be private");
- }
- if (field.isFinal()) {
- throw new OrmException("Field " + getFieldName() + " of "
- + field.getEnclosingType().getQualifiedSourceName()
- + " must not be final");
- }
-
- primitiveType = toClass(field.getType());
- rowVersion = field.getAnnotation(RowVersion.class) != null;
- if (rowVersion && primitiveType != Integer.TYPE) {
- throw new OrmException("Field " + field.getName() + " of "
- + field.getEnclosingType().getQualifiedSourceName()
- + " must have type 'int'");
- }
-
- if (isNested()) {
- final List<GwtColumnModel> col = new ArrayList<GwtColumnModel>();
- JClassType in = field.getType().isClass();
- while (in != null) {
- for (final JField f : in.getFields()) {
- if (f.getAnnotation(Column.class) != null) {
- col.add(new GwtColumnModel(f));
- }
- }
- in = in.getSuperclass();
- }
- initNestedColumns(col);
- }
- }
-
- @Override
- public String getFieldName() {
- return field.getName();
- }
-
- @Override
- public Class<?> getPrimitiveType() {
- return primitiveType;
- }
-
- @Override
- public String getNestedClassName() {
- if (primitiveType == null) {
- return field.getType().getQualifiedSourceName();
- }
- return null;
- }
-}
diff --git a/src/main/java/com/google/gwtorm/schema/gwt/GwtRelationModel.java b/src/main/java/com/google/gwtorm/schema/gwt/GwtRelationModel.java
deleted file mode 100644
index f0bdae8..0000000
--- a/src/main/java/com/google/gwtorm/schema/gwt/GwtRelationModel.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2008 Google Inc.
-//
-// 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 com.google.gwtorm.schema.gwt;
-
-import com.google.gwt.core.ext.typeinfo.JClassType;
-import com.google.gwt.core.ext.typeinfo.JField;
-import com.google.gwt.core.ext.typeinfo.JGenericType;
-import com.google.gwt.core.ext.typeinfo.JMethod;
-import com.google.gwtorm.client.Access;
-import com.google.gwtorm.client.Column;
-import com.google.gwtorm.client.OrmException;
-import com.google.gwtorm.client.PrimaryKey;
-import com.google.gwtorm.client.Query;
-import com.google.gwtorm.client.Relation;
-import com.google.gwtorm.client.SecondaryKey;
-import com.google.gwtorm.schema.QueryModel;
-import com.google.gwtorm.schema.RelationModel;
-
-import java.util.ArrayList;
-import java.util.List;
-
-class GwtRelationModel extends RelationModel {
- private final JMethod method;
- private final JClassType accessType;
- private final JClassType entityType;
-
- GwtRelationModel(final JMethod m) throws OrmException {
- method = m;
- initName(method.getName(), m.getAnnotation(Relation.class));
-
- accessType = method.getReturnType().isInterface();
- if (accessType == null) {
- throw new OrmException("Method " + method.getName() + " in "
- + method.getEnclosingType().getQualifiedSourceName()
- + " must return an extension of " + Access.class);
- }
-
- if (accessType.getImplementedInterfaces().length != 1
- || !accessType.getImplementedInterfaces()[0].getQualifiedSourceName()
- .equals(Access.class.getName())) {
- throw new OrmException("Method " + method.getName() + " in "
- + method.getEnclosingType().getQualifiedSourceName()
- + " must return a direct extension of " + Access.class);
- }
-
- final JGenericType gt =
- accessType.getImplementedInterfaces()[0].isGenericType();
- if (gt == null) {
- throw new OrmException(accessType.getQualifiedSourceName()
- + " must specify entity type parameter for " + Access.class);
- }
- entityType = gt.getTypeParameters()[0];
-
- initColumns();
- initQueriesAndKeys();
- }
-
- private void initColumns() throws OrmException {
- final List<GwtColumnModel> col = new ArrayList<GwtColumnModel>();
- JClassType in = entityType;
- while (in != null) {
- for (final JField f : in.getFields()) {
- if (f.getAnnotation(Column.class) != null) {
- col.add(new GwtColumnModel(f));
- }
- }
- in = in.getSuperclass();
- }
- initColumns(col);
- }
-
- private void initQueriesAndKeys() throws OrmException {
- for (final JMethod m : accessType.getMethods()) {
- if (m.getAnnotation(PrimaryKey.class) != null) {
- if (!m.getReturnType().getQualifiedSourceName().equals(
- entityType.getQualifiedSourceName())) {
- throw new OrmException("PrimaryKey " + m.getName() + " must return "
- + entityType.getName());
- }
- initPrimaryKey(m.getName(), m.getAnnotation(PrimaryKey.class));
- } else if (m.getAnnotation(SecondaryKey.class) != null) {
- if (!m.getReturnType().getQualifiedSourceName().equals(
- entityType.getQualifiedSourceName())) {
- throw new OrmException("SecondaryKey " + m.getName() + " must return "
- + entityType.getName());
- }
- addSecondaryKey(m.getName(), m.getAnnotation(SecondaryKey.class));
-
- } else if (m.getAnnotation(Query.class) != null) {
- addQuery(new QueryModel(this, m.getName(), m.getAnnotation(Query.class)));
- }
- }
- }
-
- @Override
- public String getAccessInterfaceName() {
- return accessType.getQualifiedSourceName();
- }
-
- @Override
- public String getEntityTypeClassName() {
- return entityType.getQualifiedSourceName();
- }
-}
diff --git a/src/main/java/com/google/gwtorm/schema/gwt/GwtSchemaModel.java b/src/main/java/com/google/gwtorm/schema/gwt/GwtSchemaModel.java
deleted file mode 100644
index e804083..0000000
--- a/src/main/java/com/google/gwtorm/schema/gwt/GwtSchemaModel.java
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2008 Google Inc.
-//
-// 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 com.google.gwtorm.schema.gwt;
-
-import com.google.gwt.core.ext.typeinfo.JClassType;
-import com.google.gwt.core.ext.typeinfo.JMethod;
-import com.google.gwt.core.ext.typeinfo.JPrimitiveType;
-import com.google.gwt.core.ext.typeinfo.JType;
-import com.google.gwtorm.client.OrmException;
-import com.google.gwtorm.client.Relation;
-import com.google.gwtorm.client.Schema;
-import com.google.gwtorm.client.Sequence;
-import com.google.gwtorm.schema.SchemaModel;
-import com.google.gwtorm.schema.SequenceModel;
-
-public class GwtSchemaModel extends SchemaModel {
- private final JClassType schema;
-
- public GwtSchemaModel(final JClassType schemaInterface) throws OrmException {
- schema = schemaInterface;
-
- if (schema.isInterface() == null) {
- throw new OrmException("Schema " + schema.getName()
- + " must be an interface");
- }
-
- if (schema.getImplementedInterfaces().length != 1
- || !schema.getImplementedInterfaces()[0].getQualifiedSourceName()
- .equals(Schema.class.getName())) {
- throw new OrmException("Schema " + schema.getName()
- + " must only extend " + Schema.class.getName());
- }
-
- for (final JMethod m : schema.getMethods()) {
- if (m.getAnnotation(Relation.class) != null) {
- add(new GwtRelationModel(m));
- continue;
- }
-
- final Sequence seq = m.getAnnotation(Sequence.class);
- if (seq != null) {
- final JType returnType = m.getReturnType();
- final Class<?> r;
- if (returnType == JPrimitiveType.INT) {
- r = Integer.TYPE;
- } else if (returnType == JPrimitiveType.LONG) {
- r = Long.TYPE;
- } else {
- r = Object.class;
- }
- add(new SequenceModel(m.getName(), seq, r));
- continue;
- }
- }
- }
-
- @Override
- public String getSchemaClassName() {
- return schema.getQualifiedSourceName();
- }
-}