01: package com.xoetrope.service.file;
02:
03: import net.xoetrope.optional.service.ServiceContext;
04: import net.xoetrope.optional.service.ServiceProxy;
05: import net.xoetrope.optional.service.ServiceProxyArgs;
06: import net.xoetrope.optional.service.ServiceProxyException;
07: import net.xoetrope.optional.service.XRouteManager;
08:
09: /**
10: *
11: * <p> Copyright (c) Xoetrope Ltd., 2001-2006, This software is licensed under
12: * the GNU Public License (GPL), please see license.txt for more details. If
13: * you make commercial use of this software you must purchase a commercial
14: * license from Xoetrope.</p>
15: * <p> $Revision: 1.6 $</p>
16: */
17: public class EncryptionService extends ServiceProxy {
18: public EncryptionService() {
19: }
20:
21: public Object call(String method, ServiceContext context)
22: throws ServiceProxyException {
23: Object res = null;
24: ServiceProxyArgs args = context.getArgs();
25:
26: String mode = (String) args.getPassParam("Mode");
27: String paramName = (String) args.getPassParam("encryptParam");
28: boolean save = mode.equals("Save");
29: boolean client = (side == XRouteManager.CLIENT_SIDE);
30: if ((save && client) || (!save && !client)) {
31: args.setPassParam(paramName, args.getPassParam(paramName)
32: .toString()
33: + args.getPassParam(paramName).toString());
34: res = nextProxy.call(method, context);
35: } else if ((!save && client) || (save && !client)) {
36: String temp;
37: if (nextProxy != null) {
38: res = (String) nextProxy.call(method, context);
39: temp = args.getReturnParam(paramName).toString();
40: } else
41: temp = args.getReturnParam(paramName).toString();
42:
43: args.setReturnParam(paramName, temp.substring(0, temp
44: .length() / 2));
45: }
46:
47: return res;
48: }
49: }
|