openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From curti...@apache.org
Subject svn commit: r1030479 - in /openjpa/trunk: openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/ openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/ openjpa-persistence-jdbc/src/...
Date Wed, 03 Nov 2010 14:51:28 GMT
Author: curtisr7
Date: Wed Nov  3 14:51:28 2010
New Revision: 1030479

URL: http://svn.apache.org/viewvc?rev=1030479&view=rev
Log:
OPENJPA-1851: Backing changes out of trunk while we continue to develop this feature in a
sandbox.

Modified:
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
    openjpa/trunk/openjpa-persistence-jdbc/src/main/resources/META-INF/jest-instance.xsd 
 (contents, props changed)
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jest/
  (props changed)
    openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jest/TestRequestParsing.java
    openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/ 
 (props changed)
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/JESTRequest.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/MetamodelHelper.java
    openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/Server.java

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/kernel/PreparedQueryImpl.java
Wed Nov  3 14:51:28 2010
@@ -216,7 +216,7 @@ public class PreparedQueryImpl implement
         _exps = ((StoreQuery.Executor)executor).getQueryExpressions();
         for (int i = 0; i < _exps.length; i++) {
             QueryExpressions exp = _exps[i];
-            if (exp.hasParameterizedInExpression)
+            if (exp.hasInExpression)
                 return new Object[]{null, _loc.get("exclude-in-expression", _id)};
             if (isUsingExternalizedParameter(exp)) {
                 return new Object[]{null, _loc.get("exclude-externalized-param", _id)};

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/exps/QueryExpressions.java
Wed Nov  3 14:51:28 2010
@@ -78,7 +78,7 @@ public class QueryExpressions
     private Stack<Context> _contexts = null;
     public Object state;
     public ResultShape<?> shape;
-    public boolean hasParameterizedInExpression;
+    public boolean hasInExpression;
     
     /**
      * Set reference to the JPQL query contexts.

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/jpql/JPQLExpressionBuilder.java
Wed Nov  3 14:51:28 2010
@@ -310,7 +310,7 @@ public class JPQLExpressionBuilder
             exps.parameterTypes = parameterTypes;
 
         exps.accessPath = getAccessPath();
-        exps.hasParameterizedInExpression = this.hasParameterizedInExpression;
+        exps.hasInExpression = this.hasParameterizedInExpression;
         
         return exps;
     }

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/main/resources/META-INF/jest-instance.xsd
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/main/resources/META-INF/jest-instance.xsd?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/main/resources/META-INF/jest-instance.xsd (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/main/resources/META-INF/jest-instance.xsd Wed
Nov  3 14:51:28 2010
@@ -31,7 +31,7 @@
          The related instances are resolved within the document root.
          Document root represents zero or more instances. 
           
-         The file must be named "jest-instance.xsd".
+         The file must be named "META-INF/jest-instance.xsd".
          ]]>
 		</xsd:documentation>
 	</xsd:annotation>

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/main/resources/META-INF/jest-instance.xsd
------------------------------------------------------------------------------
    svn:mergeinfo = 

Propchange: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jest/
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jest/TestRequestParsing.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jest/TestRequestParsing.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jest/TestRequestParsing.java
(original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/jest/TestRequestParsing.java
Wed Nov  3 14:51:28 2010
@@ -34,7 +34,7 @@ public class TestRequestParsing extends 
     
     public void testRequestFindImplicitParam() throws IOException {
         GETRequest req = new GETRequest();
-        req.read(Arrays.asList("/find?Person&1234"));
+        req.read(Arrays.asList("/find?Person;1234"));
         
         assertEquals("find", req.getAction());
         assertTrue(req.hasParameter("Person"));
@@ -49,7 +49,7 @@ public class TestRequestParsing extends 
     
     public void testRequestFindExplicitParam() throws IOException {
         GETRequest req = new GETRequest();
-        req.read(Arrays.asList("/find?Person&ssn=1234"));
+        req.read(Arrays.asList("/find?Person;ssn=1234"));
         
         assertEquals("find", req.getAction());
         assertTrue(req.hasParameter("Person"));
@@ -64,7 +64,7 @@ public class TestRequestParsing extends 
     
     public void testRequestQueryWithParameters() throws IOException {
         GETRequest req = new GETRequest();
-        req.read(Arrays.asList("/query?select p from Person p where p.name=:name&name=xyz&age=20"));
+        req.read(Arrays.asList("/query?select p from Person p where p.name=:name;name=xyz;age=20"));
         
         assertEquals("query", req.getAction());
         assertEquals("select p from Person p where p.name=:name", req.getParameter(0).getKey());

Modified: openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml (original)
+++ openjpa/trunk/openjpa-persistence-jdbc/src/test/resources/META-INF/persistence.xml Wed
Nov  3 14:51:28 2010
@@ -379,13 +379,4 @@
                 value="buildSchema"/>
         </properties>
     </persistence-unit>
-    
-    <persistence-unit name="jest">
-    	<provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
-        <class>org.apache.openjpa.persistence.jest.JObject</class>
-        <properties>
-        <property name="openjpa.Log" value="Tool=Trace,SQL=WARN,Remote=TRACE"/>
-        <property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema(ForeignKeys=true)"/>
-        </properties>
-    </persistence-unit>
 </persistence>

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/EntityManagerFactoryImpl.java
Wed Nov  3 14:51:28 2010
@@ -45,10 +45,10 @@ import org.apache.openjpa.lib.util.Close
 import org.apache.openjpa.lib.util.Localizer;
 import org.apache.openjpa.persistence.criteria.CriteriaBuilderImpl;
 import org.apache.openjpa.persistence.criteria.OpenJPACriteriaBuilder;
-import org.apache.openjpa.persistence.jest.Server;
 import org.apache.openjpa.persistence.meta.MetamodelImpl;
 import org.apache.openjpa.persistence.query.OpenJPAQueryBuilder;
 import org.apache.openjpa.persistence.query.QueryBuilderImpl;
+import org.apache.openjpa.util.UserException;
 
 /**
  * Implementation of {@link EntityManagerFactory} that acts as a
@@ -70,8 +70,7 @@ public class EntityManagerFactoryImpl
     private transient StoreCache _cache = null;
     private transient QueryResultCache _queryCache = null;
     private transient MetamodelImpl _metaModel;
-    private transient Server _remoteAccess = null;
-
+    
     /**
      * Default constructor provided for auto-instantiation.
      */
@@ -94,11 +93,10 @@ public class EntityManagerFactoryImpl
 
     /**
      * Delegate must be provided before use.
-     * Configures for Remote Access, if appropriate. 
      */
     public void setBrokerFactory(BrokerFactory factory) {
-        _factory = new DelegatingBrokerFactory(factory, PersistenceExceptions.TRANSLATOR);
-        configureRemoteAccess(getConfiguration());
+        _factory = new DelegatingBrokerFactory(factory,
+            PersistenceExceptions.TRANSLATOR);
     }
 
     public OpenJPAConfiguration getConfiguration() {
@@ -274,10 +272,6 @@ public class EntityManagerFactoryImpl
         if (log.isTraceEnabled()) {
             log.trace(this + ".close() invoked.");
         }
-        if (_remoteAccess != null) {
-            _remoteAccess.stop();
-            _remoteAccess = null;
-        }
         _factory.close();
     }
 
@@ -403,40 +397,4 @@ public class EntityManagerFactoryImpl
             }
         }
     }
-    
-    /**
-     * Configures this unit for remote access.
-     */
-    protected void configureRemoteAccess(OpenJPAConfiguration conf) {
-        Value value = conf.getValue("RemoteAccess");
-        if (value == null) {
-            return;
-        }
-        String props = value.getString();
-        if (props == null)
-            return;
-        try {
-            _remoteAccess = new Server();
-            _remoteAccess.setContext(this);
-            Configurations.configureInstance(_remoteAccess, conf, props);
-            conf.removeValue(value);
-            if (!_remoteAccess.start()) {
-                _remoteAccess = null;
-            }
-        } catch (Exception ex) {
-            Log log = _factory.getConfiguration().getLog(OpenJPAConfiguration.LOG_RUNTIME);
-            if (log != null) {
-                log.error(_loc.get("remote-start-error"), ex);
-            }
-        }
-    }
-    
-    /**
-     * Affirms if this unit is accessible remotely.
-     */
-    public boolean allowsRemoteAccess() {
-        return _remoteAccess != null;
-    }
-    
-
 }

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/PersistenceProductDerivation.java
Wed Nov  3 14:51:28 2010
@@ -188,7 +188,6 @@ public class PersistenceProductDerivatio
         conf.metaFactoryPlugin.setAlias(SPEC_JPA.getName(),  PersistenceMetaDataFactory.class.getName());
         
         conf.addValue(new EntityManagerFactoryValue());
-        conf.addString("RemoteAccess");
         
         conf.readLockLevel.setAlias("optimistic", String.valueOf(MixedLockLevels.LOCK_OPTIMISTIC));
         conf.readLockLevel.setAlias("optimistic-force-increment", String

Propchange: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/
------------------------------------------------------------------------------
    svn:mergeinfo = 

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/JESTRequest.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/JESTRequest.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/JESTRequest.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/JESTRequest.java
Wed Nov  3 14:51:28 2010
@@ -277,22 +277,22 @@ public abstract class JESTRequest implem
                                 buf.append(ch);
                             else
                                 transit(ParseState.PARAM_VALUE);
-                        } else if (ch == '&') {
+                        } else if (ch == ';') {
                             transit(ParseState.PARAM_KEY);
                         } else if (isQueryKey() && isQueryChar(ch)) {
                             buf.append(ch);
                         } else {
-                            parseError(ch, i, s, true, '&', '=');
+                            parseError(ch, i, s, true, ';', '=');
                         }
                         break;
 
                     case PARAM_VALUE:
                         if (Character.isJavaIdentifierPart(ch)) {
                             buf.append(ch);
-                        } else if (ch == '&') {
+                        } else if (ch == ';') {
                             transit(ParseState.PARAM_KEY);
                         } else {
-                            parseError(ch, i, s, true, '&');
+                            parseError(ch, i, s, true, ';');
                         }
                         break;
                     default:

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/MetamodelHelper.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/MetamodelHelper.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/MetamodelHelper.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/MetamodelHelper.java
Wed Nov  3 14:51:28 2010
@@ -113,7 +113,7 @@ public class MetamodelHelper {
      *
      */
     public static class AttributeComparator implements Comparator<Attribute<?,?>>
{
-//        @Override
+        @Override
         public int compare(Attribute<?, ?> a1, Attribute<?, ?> a2) {
             Integer t1 = getAttributeTypeCode(a1);
             Integer t2 = getAttributeTypeCode(a2);

Modified: openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/Server.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/Server.java?rev=1030479&r1=1030478&r2=1030479&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/Server.java
(original)
+++ openjpa/trunk/openjpa-persistence/src/main/java/org/apache/openjpa/persistence/jest/Server.java
Wed Nov  3 14:51:28 2010
@@ -20,11 +20,8 @@
 package org.apache.openjpa.persistence.jest;
 
 import java.io.IOException;
-import java.net.InetAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
-import java.net.URI;
-import java.net.URISyntaxException;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -50,7 +47,6 @@ public class Server implements ServerCon
     private ServerSocket _listenSocket;
     protected ExecutorService _executors;
     public final static int DEFAULT_PORT = 6789;
-    protected String _host = "127.0.0.1";
     protected int _port = DEFAULT_PORT;
     protected int _range = 1;
     protected String _format = "xml";
@@ -59,14 +55,6 @@ public class Server implements ServerCon
     private EntityManagerFactoryImpl _ctx;
     private static Localizer _loc = Localizer.forPackage(Server.class);
     
-    public Server() {
-        try {
-            _host = InetAddress.getLocalHost().getHostAddress();
-        } catch (Exception ex) {
-            
-        }
-
-    }
     /**
      * Sets the persistence unit context in which this server will serve requests.
      * The context must be set before operation.
@@ -103,7 +91,7 @@ public class Server implements ServerCon
             if (_thread != null)
                 return true;
             if (createServerSocket()) {
-                _thread = new Thread(this, "JEST-"+_port);
+                _thread = new Thread(this);
                 _thread.setDaemon(true);
                 _thread.start();
                 return true;
@@ -124,18 +112,6 @@ public class Server implements ServerCon
         _executors.shutdownNow();
     }
     
-    public String getHost() {
-        return _host;
-    }
-    
-    public URI getURI() {
-        try {
-            return new URI("http://"+_host+":"+_port);
-        } catch (URISyntaxException e) {
-            return null;
-        }
-    }
-    
     /**
      * Sets the port in which the server will listen.
      * 
@@ -188,7 +164,7 @@ public class Server implements ServerCon
             try {
                 Socket socket = _listenSocket.accept();
                 if (_log.isTraceEnabled())
-                    _log.trace(_loc.get("server-request", socket.getInetAddress()+":"+socket.getPort()));
+                    _log.trace(_loc.get("server-request", socket));
                 RequestHandler request = new RequestHandler(socket, this); 
                 _executors.submit(request);
             } catch (IOException e) {
@@ -248,7 +224,7 @@ public class Server implements ServerCon
     
     public String toString() {
         if (_listenSocket == null) return "JEST Server [not strated]";
-        return "JEST Server " + getURI().toString();
+        return "JEST Server " + _listenSocket.getInetAddress()+":"+_listenSocket.getLocalPort();
     }
 
 }



Mime
View raw message