Author: michiel Date: 2010-07-15 19:01:52 +0200 (Thu, 15 Jul 2010) New Revision: 42917
Modified: mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/CloudContext.java mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/implementation/BasicQuery.java mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/mock/MockCloudContext.java Log: added CloudContext#getSearchyQueryHandler Modified: mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/CloudContext.java =================================================================== --- mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/CloudContext.java 2010-07-15 16:54:59 UTC (rev 42916) +++ mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/CloudContext.java 2010-07-15 17:01:52 UTC (rev 42917) @@ -10,6 +10,7 @@ package org.mmbase.bridge; import java.util.Map; +import org.mmbase.storage.search.SearchQueryHandler; import org.mmbase.security.AuthenticationData; import org.mmbase.security.ActionRepository; @@ -34,7 +35,7 @@ * * @return all available modules */ - public ModuleList getModules(); + ModuleList getModules(); /** * Returns the module with the specified name. @@ -43,7 +44,7 @@ * @return the requested module * @throws NotFoundException if the specified module could not be found */ - public Module getModule(String name) throws NotFoundException; + Module getModule(String name) throws NotFoundException; /** * Returns whether the module with the specified name is available. @@ -51,7 +52,7 @@ * @param name the name of the module * @return <code>true</code> if the module is available */ - public boolean hasModule(String name); + boolean hasModule(String name); /** * @@ -62,7 +63,7 @@ * @throws NotFoundException if the specified cloud could not be found * @throws SecurityException if no anonymous user can be created */ - public Cloud getCloud(String name); + Cloud getCloud(String name); /** * Returns the cloud with the specified name, with authentication @@ -109,7 +110,7 @@ * @throws NotFoundException thrown when cloud not found * @since MMBase-1.8 */ - public Cloud getCloud(String name, org.mmbase.security.UserContext user) throws NotFoundException; + Cloud getCloud(String name, org.mmbase.security.UserContext user) throws NotFoundException; /** * Returns the names of all the clouds known to the system. Most bridge implementations return a @@ -117,7 +118,7 @@ * * @return A StringList of all clouds names known to our Context */ - public StringList getCloudNames(); + StringList getCloudNames(); /** * Returns the default character encoding, which can be used as a default. E.g. 'UTF-8'. @@ -128,7 +129,7 @@ * @since MMBase-1.6 * */ - public String getDefaultCharacterEncoding(); + String getDefaultCharacterEncoding(); /** @@ -139,7 +140,7 @@ * @return A Locale object * @since MMBase-1.6 */ - public java.util.Locale getDefaultLocale(); + java.util.Locale getDefaultLocale(); /** @@ -149,7 +150,7 @@ * @return the default time zone * @since MMBase-1.8 */ - public java.util.TimeZone getDefaultTimeZone(); + java.util.TimeZone getDefaultTimeZone(); /** * Returns a new, empty field list @@ -157,7 +158,7 @@ * @return The empty list * @since MMBase-1.6 */ - public FieldList createFieldList(); + FieldList createFieldList(); /** * Returns a new, empty node list. @@ -167,7 +168,7 @@ * @return The empty list * @since MMBase-1.6 */ - public NodeList createNodeList(); + NodeList createNodeList(); /** * Returns a new, empty relation list @@ -176,7 +177,7 @@ * @return The empty list * @since MMBase-1.6 */ - public RelationList createRelationList(); + RelationList createRelationList(); /** * Returns a new, empty node manager list @@ -185,7 +186,7 @@ * @return The empty list * @since MMBase-1.6 */ - public NodeManagerList createNodeManagerList(); + NodeManagerList createNodeManagerList(); /** * Returns a new, empty relation manager list @@ -194,7 +195,7 @@ * @return The empty list * @since MMBase-1.6 */ - public RelationManagerList createRelationManagerList(); + RelationManagerList createRelationManagerList(); /** * Returns a new, empty module list @@ -202,7 +203,7 @@ * @return The empty list * @since MMBase-1.6 */ - public ModuleList createModuleList(); + ModuleList createModuleList(); /** * Returns a new, empty string list @@ -210,7 +211,7 @@ * @return The empty list * @since MMBase-1.6 */ - public StringList createStringList(); + StringList createStringList(); /** @@ -218,14 +219,14 @@ * @return current Authentication information * @since MMBase-1.8 */ - public AuthenticationData getAuthentication(); + AuthenticationData getAuthentication(); /** * Returns the Repository with actions * @return Repository with actions * @since MMBase-1.9 */ - public ActionRepository getActionRepository(); + ActionRepository getActionRepository(); /** @@ -233,17 +234,22 @@ * @return <code>true</code> when mmbase is running * @since MMBase-1.8 */ - public boolean isUp(); + boolean isUp(); /** * Assert whether MMbase is up and running. This will wait until it is. * @since MMBase-1.8 */ - public CloudContext assertUp(); + CloudContext assertUp(); /** * The String which was usesd, and could be used again to acquire this cloud context using {...@link ContextProvider#getCloudContext(String)}. * @since MMBase-1.9 */ - public String getUri(); + String getUri(); + + /** + * @since MMBase-2.0 + */ + SearchQueryHandler getSearchQueryHandler(); } Modified: mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/implementation/BasicQuery.java =================================================================== --- mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/implementation/BasicQuery.java 2010-07-15 16:54:59 UTC (rev 42916) +++ mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/implementation/BasicQuery.java 2010-07-15 17:01:52 UTC (rev 42917) @@ -470,7 +470,9 @@ String stepAlias = fieldIdentifier.substring(0, dot); String fieldName = fieldIdentifier.substring(dot + 1); Step step = getStep(stepAlias); - if (step == null) throw new NotFoundException("No step with alias '" + stepAlias + "' found in " + getSteps()); + if (step == null) { + throw new NotFoundException("No step with alias '" + stepAlias + "' found in " + getSteps()); + } NodeManager nm = cloud.getNodeManager(step.getTableName()); Field field = nm.getField(fieldName); return createStepField(step, field); @@ -745,7 +747,8 @@ return cloud.getList(this); } - @Override public boolean equals(Object obj) { + @Override + public boolean equals(Object obj) { while (obj instanceof SearchQueryWrapper) { obj = ((SearchQueryWrapper)obj).unwrap(); } @@ -753,12 +756,14 @@ } // javadoc is inherited - @Override public int hashCode() { + @Override + public int hashCode() { return query.hashCode(); } - @Override public String toString() { + @Override + public String toString() { return query.toString() + (used ? " (used)" : "") + " INSECURE: " + insecureConstraint + " QUERYCHECK: " + queryCheck; } @@ -773,14 +778,10 @@ @Override public String toSql() { try { - //return MMBase.getMMBase().getSearchQueryHandler().createSqlString(query); - //return cloud.getCloudContext().getSearchQueryHandler().createSqlString(query); - // TODO - return "" + toString(); - // } catch (org.mmbase.storage.search.SearchQueryException sqe) { - //return sqe.getMessage() + ": " + toString(); - } catch (Exception ise) { - return ise.getMessage() + ": " + toString(); + return cloud.getCloudContext().getSearchQueryHandler().createSqlString(query); + } catch (org.mmbase.storage.search.SearchQueryException sqe) { + log.warn(sqe); + return query.toString(); } } Modified: mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/mock/MockCloudContext.java =================================================================== --- mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/mock/MockCloudContext.java 2010-07-15 16:54:59 UTC (rev 42916) +++ mmbase/trunk/bridge/src/main/java/org/mmbase/bridge/mock/MockCloudContext.java 2010-07-15 17:01:52 UTC (rev 42917) @@ -15,6 +15,7 @@ import org.mmbase.bridge.util.AbstractCloudContext; import org.mmbase.bridge.util.NodeManagerDescription; import org.mmbase.datatypes.DataType; +import org.mmbase.storage.search.SearchQueryHandler; import org.mmbase.security.*; import org.mmbase.core.event.*; import org.mmbase.util.*; @@ -310,6 +311,12 @@ return getUri() + "#" + hashCode() + "(" + nodes.size() + " nodes, nodemanagers: " + nodeManagers.keySet() + ", roles: " + roles.keySet() + ")"; } + @Override + public SearchQueryHandler getSearchQueryHandler() { + throw new UnsupportedOperationException(); + } + + public static class MockResolver extends ContextProvider.Resolver { { description.setKey("mock"); _______________________________________________ Cvs mailing list Cvs@lists.mmbase.org http://lists.mmbase.org/mailman/listinfo/cvs