Skip to content
Snippets Groups Projects
Commit 09afc9d1 authored by felmer's avatar felmer
Browse files

SSDM-2718: Introducing ExecutionOptions replacing parameters map.

SVN: 35358
parent 92971d67
No related branches found
No related tags found
No related merge requests found
Showing
with 84 additions and 31 deletions
...@@ -69,6 +69,7 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId; ...@@ -69,6 +69,7 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
...@@ -608,9 +609,9 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi> ...@@ -608,9 +609,9 @@ public class ApplicationServerApi extends AbstractServer<IApplicationServerApi>
@Override @Override
@RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER }) @RolesAllowed({ RoleWithHierarchy.SPACE_OBSERVER, RoleWithHierarchy.SPACE_ETL_SERVER })
@Capability("EXECUTE_SERVICE") @Capability("EXECUTE_SERVICE")
public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, Serializable> parameters) public Serializable executeService(String sessionToken, IServiceId serviceId, ExecutionOptions options)
{ {
return executeServiceExecutor.executeService(sessionToken, serviceId, parameters); return executeServiceExecutor.executeService(sessionToken, serviceId, options);
} }
@Override @Override
......
...@@ -65,6 +65,7 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId; ...@@ -65,6 +65,7 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
...@@ -350,14 +351,14 @@ public class ApplicationServerApiLogger extends AbstractServerLogger implements ...@@ -350,14 +351,14 @@ public class ApplicationServerApiLogger extends AbstractServerLogger implements
@Override @Override
public SearchResult<Service> searchServices(String sessionToken, ServiceSearchCriteria searchCriteria, ServiceFetchOptions fetchOptions) public SearchResult<Service> searchServices(String sessionToken, ServiceSearchCriteria searchCriteria, ServiceFetchOptions fetchOptions)
{ {
logAccess(sessionToken, "search-services", "SEARCH_CRITERIA(%s) FETCH_OPTIONS(%s)", searchCriteria, fetchOptions); logAccess(sessionToken, "search-services", "SEARCH_CRITERIA:\n%s\nFETCH_OPTIONS:\n%s\n", searchCriteria, fetchOptions);
return null; return null;
} }
@Override @Override
public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, Serializable> parameters) public Serializable executeService(String sessionToken, IServiceId serviceId, ExecutionOptions options)
{ {
logAccess(sessionToken, "execute-service", "SERVICE_ID(%s) PARAMETERS(%s)", serviceId, parameters); logAccess(sessionToken, "execute-service", "SERVICE_ID(%s) EXECUTION_OPTIONS(%s)", serviceId, options);
return null; return null;
} }
......
...@@ -22,12 +22,13 @@ import java.util.Map; ...@@ -22,12 +22,13 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.ServiceCode; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.ServiceCode;
import ch.ethz.sis.openbis.generic.as.api.v3.exceptions.ObjectNotFoundException; import ch.ethz.sis.openbis.generic.as.api.v3.exceptions.ObjectNotFoundException;
import ch.ethz.sis.openbis.generic.as.api.v3.exceptions.UnsupportedObjectIdException; import ch.ethz.sis.openbis.generic.as.api.v3.exceptions.UnsupportedObjectIdException;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.IServiceExecutor; import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.IServiceExecutor;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.context.ServiceContext; import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.context.ServiceContext;
/** /**
* *
...@@ -41,7 +42,7 @@ public class ExecuteServiceMethodExecutor implements IExecuteServiceMethodExecut ...@@ -41,7 +42,7 @@ public class ExecuteServiceMethodExecutor implements IExecuteServiceMethodExecut
private IServiceProvider serviceProvider; private IServiceProvider serviceProvider;
@Override @Override
public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, Serializable> parameters) public Serializable executeService(String sessionToken, IServiceId serviceId, ExecutionOptions options)
{ {
if (serviceId instanceof ServiceCode == false) if (serviceId instanceof ServiceCode == false)
{ {
...@@ -55,7 +56,7 @@ public class ExecuteServiceMethodExecutor implements IExecuteServiceMethodExecut ...@@ -55,7 +56,7 @@ public class ExecuteServiceMethodExecutor implements IExecuteServiceMethodExecut
} }
ServiceContext serviceContext = new ServiceContext(); ServiceContext serviceContext = new ServiceContext();
serviceContext.setSessionToken(sessionToken); serviceContext.setSessionToken(sessionToken);
return serviceExecutor.executeService(parameters, serviceContext); return serviceExecutor.executeService(serviceContext, options);
} }
} }
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
package ch.ethz.sis.openbis.generic.server.api.v3.executor.method; package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
/** /**
...@@ -28,5 +28,5 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId; ...@@ -28,5 +28,5 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
*/ */
public interface IExecuteServiceMethodExecutor public interface IExecuteServiceMethodExecutor
{ {
public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, Serializable> parameters); public Serializable executeService(String sessionToken, IServiceId serviceId, ExecutionOptions options);
} }
...@@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.executor.method; ...@@ -19,7 +19,7 @@ package ch.ethz.sis.openbis.generic.server.api.v3.executor.method;
import java.util.List; import java.util.List;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.IServiceExecutor; import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.IServiceExecutor;
/** /**
* *
......
...@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component; ...@@ -30,7 +30,7 @@ import org.springframework.stereotype.Component;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.ServiceCode; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.ServiceCode;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.IServiceExecutor; import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.IServiceExecutor;
import ch.systemsx.cisd.common.properties.PropertyParametersUtil; import ch.systemsx.cisd.common.properties.PropertyParametersUtil;
import ch.systemsx.cisd.common.properties.PropertyParametersUtil.SectionProperties; import ch.systemsx.cisd.common.properties.PropertyParametersUtil.SectionProperties;
import ch.systemsx.cisd.common.properties.PropertyUtils; import ch.systemsx.cisd.common.properties.PropertyUtils;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
package ch.ethz.sis.openbis.generic.server.api.v3.helper.service; package ch.ethz.sis.openbis.generic.server.api.v3.helper.service;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.context.ServiceContext; import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.context.ServiceContext;
/** /**
* *
......
...@@ -17,7 +17,8 @@ ...@@ -17,7 +17,8 @@
package ch.ethz.sis.openbis.generic.server.api.v3.helper.service; package ch.ethz.sis.openbis.generic.server.api.v3.helper.service;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
/** /**
* *
...@@ -26,5 +27,5 @@ import java.util.Map; ...@@ -26,5 +27,5 @@ import java.util.Map;
*/ */
public interface IServiceScriptRunner public interface IServiceScriptRunner
{ {
public Serializable process(Map<String, Serializable> parameters); public Serializable process(ExecutionOptions options);
} }
/* /*
* Copyright 2015 ETH Zuerich, SIS * Copyright 2015 ETH Zuerich, SIS
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
...@@ -17,12 +18,12 @@ ...@@ -17,12 +18,12 @@
package ch.ethz.sis.openbis.generic.server.api.v3.helper.service; package ch.ethz.sis.openbis.generic.server.api.v3.helper.service;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map;
import java.util.Properties; import java.util.Properties;
import ch.ethz.sis.openbis.generic.as.api.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.as.api.v3.IApplicationServerApi;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.IServiceExecutor; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.context.ServiceContext; import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.IServiceExecutor;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.context.ServiceContext;
import ch.systemsx.cisd.common.properties.PropertyUtils; import ch.systemsx.cisd.common.properties.PropertyUtils;
import ch.systemsx.cisd.openbis.generic.server.CommonServiceProvider; import ch.systemsx.cisd.openbis.generic.server.CommonServiceProvider;
...@@ -48,9 +49,9 @@ public class JythonBasedServiceExecutor implements IServiceExecutor ...@@ -48,9 +49,9 @@ public class JythonBasedServiceExecutor implements IServiceExecutor
} }
@Override @Override
public Serializable executeService(Map<String, Serializable> parameters, ServiceContext context) public Serializable executeService(ServiceContext context, ExecutionOptions options)
{ {
return factory.createServiceRunner(context).process(parameters); return factory.createServiceRunner(context).process(options);
} }
} }
...@@ -17,10 +17,10 @@ ...@@ -17,10 +17,10 @@
package ch.ethz.sis.openbis.generic.server.api.v3.helper.service; package ch.ethz.sis.openbis.generic.server.api.v3.helper.service;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map;
import ch.ethz.sis.openbis.generic.as.api.v3.IApplicationServerApi; import ch.ethz.sis.openbis.generic.as.api.v3.IApplicationServerApi;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.context.ServiceContext; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.context.ServiceContext;
import ch.systemsx.cisd.common.jython.JythonUtils; import ch.systemsx.cisd.common.jython.JythonUtils;
import ch.systemsx.cisd.common.jython.evaluator.Evaluator; import ch.systemsx.cisd.common.jython.evaluator.Evaluator;
import ch.systemsx.cisd.common.jython.evaluator.EvaluatorException; import ch.systemsx.cisd.common.jython.evaluator.EvaluatorException;
...@@ -84,9 +84,9 @@ class ScriptRunnerFactory implements IScriptRunnerFactory ...@@ -84,9 +84,9 @@ class ScriptRunnerFactory implements IScriptRunnerFactory
} }
@Override @Override
public Serializable process(Map<String, Serializable> parameters) public Serializable process(ExecutionOptions options)
{ {
Object result = evaluator.evalFunction(PROCESS_FUNCTION_NAME, parameters); Object result = evaluator.evalFunction(PROCESS_FUNCTION_NAME, options.getParameters());
if (result == null || result instanceof Serializable) if (result == null || result instanceof Serializable)
{ {
return (Serializable) result; return (Serializable) result;
......
...@@ -64,6 +64,7 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId; ...@@ -64,6 +64,7 @@ import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.ISampleId;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.id.SamplePermId;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.search.SampleSearchCriteria;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate; import ch.ethz.sis.openbis.generic.as.api.v3.dto.sample.update.SampleUpdate;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.fetchoptions.ServiceFetchOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.id.IServiceId;
...@@ -175,6 +176,6 @@ public interface IApplicationServerApi extends IRpcService ...@@ -175,6 +176,6 @@ public interface IApplicationServerApi extends IRpcService
public void confirmDeletions(String sessionToken, List<? extends IDeletionId> deletionIds); public void confirmDeletions(String sessionToken, List<? extends IDeletionId> deletionIds);
public Serializable executeService(String sessionToken, IServiceId serviceId, Map<String, Serializable> parameters); public Serializable executeService(String sessionToken, IServiceId serviceId, ExecutionOptions options);
} }
/*
* Copyright 2015 ETH Zuerich, SIS
*
* 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 ch.ethz.sis.openbis.generic.as.api.v3.dto.service;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import ch.systemsx.cisd.base.annotation.JsonObject;
/**
*
*
* @author Franz-Josef Elmer
*/
@JsonObject("dto.service.ExecutionOptions")
public class ExecutionOptions implements Serializable
{
private static final long serialVersionUID = 1L;
private final Map<String, Serializable> parameters = new HashMap<String, Serializable>();
public ExecutionOptions withParameter(String parameterName, Serializable value)
{
parameters.put(parameterName, value);
return this;
}
public Map<String, Serializable> getParameters()
{
return parameters;
}
}
...@@ -14,13 +14,13 @@ ...@@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
*/ */
package ch.ethz.sis.openbis.generic.as.api.v3.plugin; package ch.ethz.sis.openbis.generic.as.api.v3.plugin.service;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.ExecutionOptions;
import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service; import ch.ethz.sis.openbis.generic.as.api.v3.dto.service.Service;
import ch.ethz.sis.openbis.generic.as.api.v3.plugin.context.ServiceContext; import ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.context.ServiceContext;
/** /**
* Executor of a {@link Service}. * Executor of a {@link Service}.
...@@ -29,5 +29,5 @@ import ch.ethz.sis.openbis.generic.as.api.v3.plugin.context.ServiceContext; ...@@ -29,5 +29,5 @@ import ch.ethz.sis.openbis.generic.as.api.v3.plugin.context.ServiceContext;
*/ */
public interface IServiceExecutor public interface IServiceExecutor
{ {
public Serializable executeService(Map<String, Serializable> parameters, ServiceContext context); public Serializable executeService(ServiceContext context, ExecutionOptions options);
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package ch.ethz.sis.openbis.generic.as.api.v3.plugin.context; package ch.ethz.sis.openbis.generic.as.api.v3.plugin.service.context;
/** /**
* *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment