Skip to content

Commit

Permalink
Merge pull request #89 from Novartis/8.7.0
Browse files Browse the repository at this point in the history
8.7.0
  • Loading branch information
varontron authored Oct 22, 2018
2 parents 34da4ff + 1bc8152 commit 1a9c0dc
Show file tree
Hide file tree
Showing 26 changed files with 616 additions and 188 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.novartis.opensource</groupId>
<artifactId>YADA</artifactId>
<version>8.6.2-SNAPSHOT</version>
<version>8.7.0-SNAPSHOT</version>
<name>YADA</name>
<url>http://github.com/Novartis/YADA</url>
<description>YADA (Yet Another Data Abstraction) Thin Server Framework</description>
Expand Down
12 changes: 11 additions & 1 deletion yada-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.novartis.opensource</groupId>
<artifactId>YADA</artifactId>
<version>8.6.2-SNAPSHOT</version>
<version>8.7.0-SNAPSHOT</version>
</parent>
<artifactId>yada-api</artifactId>
<name>yada-api</name>
Expand Down Expand Up @@ -849,6 +849,16 @@
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.11.0-beta</version>
</dependency>
<dependency>
<groupId>com.novartis.opensource</groupId>
<artifactId>jsqlparser</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import com.novartis.opensource.yada.plugin.Postprocess;
import com.novartis.opensource.yada.plugin.Preprocess;
import com.novartis.opensource.yada.plugin.YADAPluginException;
import com.novartis.opensource.yada.plugin.YADASecurityException;
import com.novartis.opensource.yada.util.FileUtils;
import com.novartis.opensource.yada.util.QueryUtils;
import com.novartis.opensource.yada.util.YADAUtils;
Expand Down Expand Up @@ -308,13 +307,13 @@ public void handleRequest(String referer, Map<String,String[]> paraMap)
{
getYADARequest().setMethod(paraMap.get(YADARequest.PS_METHOD));
}
if (paraMap.get(YADARequest.PL_OVERARGS) != null)
if (paraMap.get(YADARequest.PL_OAUTH) != null)
{
setDeprecatedPlugin(paraMap, YADARequest.PL_OVERARGS);
getYADARequest().setOAuth(paraMap.get(YADARequest.PL_OAUTH));
}
if (paraMap.get(YADARequest.PS_OVERARGS) != null)
if (paraMap.get(YADARequest.PS_OAUTH) != null)
{
setDeprecatedPlugin(paraMap, YADARequest.PS_OVERARGS);
getYADARequest().setOAuth(paraMap.get(YADARequest.PS_OAUTH));
}
if (paraMap.get(YADARequest.PL_BYPASSARGS) != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class YADAQueryResult {
*/
private String qname;
/**
* The app to which the {@link qname} is mapped
* The app to which the {@code qname} is mapped
* @since 8.6.1
*/
private String app;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,11 @@ public class YADARequest {
* No longer deprecated (4.0.0) as of 8.5.0
*/
public static final String PS_METHOD = "m";
/**
* a constant equals to: {@value}
* @since 8.7.0
*/
public static final String PS_OAUTH = "o";
/**
* A constant equal to: {@value}
* @since 4.0.0 (Short param aliases were first added in 4.0.0)
Expand Down Expand Up @@ -667,6 +672,12 @@ public class YADARequest {
* No longer deprecated (4.0.0) as of 8.5.0
*/
public static final String PL_METHOD = "method";
/**
* A constant equals to: {@value}.
*
* @since 8.7.0
*/
public static final String PL_OAUTH = "oauth";
/**
* A constant equal to: {@value}. Use {@link YADARequest#PL_BYPASSARGS} instead.
* @deprecated as of 4.0.0
Expand Down Expand Up @@ -723,7 +734,7 @@ public class YADARequest {
public static final String PL_PLUGINTYPE = "plugintype";
/**
* A constant equal to: {@value}
* @deprecated
* @deprecated as of 7.1.0
*/
@Deprecated
public static final String PL_POSTARGS = "postargs";
Expand Down Expand Up @@ -833,6 +844,7 @@ public class YADARequest {
map.put(PS_JOIN, PL_JOIN);
map.put(PS_LEFTJOIN, PL_LEFTJOIN);
map.put(PS_METHOD,PL_METHOD);
map.put(PS_OAUTH,PL_OAUTH);
map.put(PS_OVERARGS,PL_OVERARGS);
map.put(PS_PAGE,PL_PAGE);
map.put(PS_PAGESIZE,PL_PAGESIZE);
Expand Down Expand Up @@ -876,6 +888,7 @@ public class YADARequest {
map.put(PL_LABELS,PL_LABELS);
map.put(PL_MAIL,PL_MAIL);
map.put(PL_METHOD,PL_METHOD);
map.put(PL_OAUTH,PL_OAUTH);
map.put(PL_OVERARGS,PL_OVERARGS);
map.put(PL_PAGE,PL_PAGE);
map.put(PL_PAGESIZE,PL_PAGESIZE);
Expand Down Expand Up @@ -963,7 +976,7 @@ public class YADARequest {
private String mail;
/**
* YADA execution method. Defaults to {@link #METHOD_GET}
* @since 1.0.0, deprecated in v4.0.0, un-deprecated in 8.5.0 to support different HTTP methods for {@link RESTAdaptor}
* @since 1.0.0, deprecated in v4.0.0, un-deprecated in 8.5.0 to support different HTTP methods for {@link com.novartis.opensource.yada.adaptor.RESTAdaptor}
*/
private String method = METHOD_GET;
/**
Expand Down Expand Up @@ -1015,6 +1028,11 @@ public class YADARequest {
* The proxy server to use for external REST queries
*/
private String proxy = null;
/**
* A JSON object containing oauth key/value pairs needed for authenticated requests
* @since 8.7.0
*/
private JSONObject oauth = null;
/**
* The name of the query to be executed, when coupled with {@link #params}, or {@link #plugin}. Defaults to {@link #DEFAULT_QNAME}
*/
Expand Down Expand Up @@ -1171,6 +1189,7 @@ public List<YADAParam> getGlobalParamsForQueries() throws YADAQueryConfiguration
* <li>{@link #PS_FORMAT}</li>
* <li>{@link #PS_HARMONYMAP}</li>
* <li>{@link #PS_METHOD} (for backward compatibility)</li>
* <li>{@link #PS_OAUTH}</li>
* <li>{@link #PS_PAGESIZE}</li>
* <li>{@link #PS_PAGESTART}</li>
* <li>{@link #PS_ROW_DELIMITER}</li>
Expand All @@ -1186,6 +1205,7 @@ public List<YADAParam> getRequestParamsForQueries() throws YADAQueryConfiguratio
JSONObject jobj = new JSONObject();
try
{
jobj.put(PS_OAUTH, getOAuth());
jobj.put(PS_COUNT, getCount());
jobj.put(PS_FILTERS, getFilters());
jobj.put(PS_PAGESIZE, getPageSize());
Expand Down Expand Up @@ -1233,7 +1253,6 @@ public List<YADAParam> getRequestParamsForQueries() throws YADAQueryConfiguratio
*/
public static String getParamValueForKey(List<YADAParam> q, String frag) throws YADAQueryConfigurationException
{
//for (Iterator<YADAParam> iterator = q.iterator(); iterator.hasNext();)
for (YADAParam param : q)
{
try
Expand Down Expand Up @@ -2214,23 +2233,21 @@ public void setMethod(String[] method) {
}

/**
* @deprecated As of YADA 4.0.0
* @param args bypass plugin arguments
* @since 8.7.0
* @param oauth oauth parameters
* @throws YADARequestException if the parameter string is not malformed
*/
@Deprecated
public void setOverArgs(List<String> args) {
this.bypassArgs = args;
l.debug(getFormattedDebugString("bypassArgs", args.toString()));
}

/**
* @since 4.0.0
* @param argArr bypass plugin arguments
* @deprecated as of 7.1.0
*/
@Deprecated
public void setOverargs(String[] argArr) {
this.setBypassargs(argArr);
public void setOAuth(String[] oauth) throws YADARequestException
{
try
{
this.oauth = new JSONObject(oauth[0]);
}
catch(JSONException e)
{
String msg = "The OAuth parameter JSON string appears to be malformed.";
throw new YADARequestException(msg, e);
}
}

/**
Expand Down Expand Up @@ -3038,6 +3055,17 @@ public int getPageSize() {
return this.pageSize;
}

/**
* Returns an {@link JSONObject} containing oauth parameters such as <code>consumer_key</code>,
* <code>secret</code>, etc. See the YADA OAuth 1.0a specification or YADA parameter documentation
* for details.
* @return the oauth parameters object
* @since 8.7.0
*/
//TODO Add link to YADA OAuth 1.0a spec
public JSONObject getOAuth() {
return this.oauth;
}

/**
* Returns the results from page {@code pageStart}, using {@link #getPageSize()} to determine which row should
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
/**
*
*/
package com.novartis.opensource.yada.plugin;
package com.novartis.opensource.yada;

import com.novartis.opensource.yada.plugin.YADAPluginException;

/**
* Throw from a security preprocessor when authentication fails.
* Throw from a security preprocessor or adaptor when authentication or authorization fails.
* Moved to main package from {@code plugin} for {@code 8.7.0}
* @author Dave Varon
* @since 7.0.0
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.novartis.opensource.yada.YADAQuery;
import com.novartis.opensource.yada.YADAQueryResult;
import com.novartis.opensource.yada.YADARequest;
import com.novartis.opensource.yada.YADASecurityException;

/**
* The abstract Adaptor class is at the root of the package hierarchy. Adaptors
Expand Down Expand Up @@ -79,8 +80,9 @@ public Adaptor(YADARequest yadaReq)
*
* @param yq the {@link YADAQuery} containing the code to execute
* @throws YADAAdaptorExecutionException if exception is thrown during query execution
* @throws YADASecurityException if there is authentication or authorization error in preparation for or during execution
*/
public void execute(YADAQuery yq) throws YADAAdaptorExecutionException
public void execute(YADAQuery yq) throws YADAAdaptorExecutionException, YADASecurityException
{
//
}
Expand Down Expand Up @@ -130,7 +132,7 @@ protected YADARequest getServiceParameters()
* @param yq the query to which to apply the new settings
*/
protected void resetCountParameter(YADAQuery yq) {
//TODO run this through the debugger to check the distinction betwen these 2 instances of yadaReq
//TODO run this through the debugger to check the distinction between these 2 instances of yadaReq
this.yadaReq.setCount(new String[] {"false"});
yq.replaceParam(YADARequest.PS_COUNT, "false");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class FileSystemAdaptor extends Adaptor
*/
protected final static String PARAM_SYMBOL_RX = "([\\/=:<])(\\?[idvn])";
/**
* Constant equal to: {@code &lt;{1,2}.*}
* Constant equal to: {@code &lt;&lcub;1,2&rcub;.*}
*/
protected final static String NON_READ_SFX_RX = "<{1,2}.*";
/**
Expand Down
Loading

0 comments on commit 1a9c0dc

Please sign in to comment.