[workspace-commit] CVS update: MODIFIED: impls
Tim Freeman
commit at globus.org
Thu Jan 4 10:09:29 CST 2007
, StatefulResourceImpl.java, WorkspaceResourceImpl.java
, WorkspaceResourceOptions.java
...
User: tfreeman
Date: 07/01/04 10:09:29
Modified: vm/service/service/java/source/src/org/globus/workspace/service/impls
StatefulResourceImpl.java StateTransition.java
WorkspaceResourceImpl.java
WorkspaceResourceOptions.java
Log:
Updates to accomodate easier testing of StateTransition (mostly making it easier to use mock objects instead of the normal task objects returned by the request factory). In the process of writing the tests a few small bugs were repaired in StateTransition.
Revision Changes Path
1.7 +30 -7 workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/StatefulResourceImpl.java
http://viewcvs.globus.org/viewcvs.cgi/workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/StatefulResourceImpl.java.diff?r1=1.6&r2=1.7
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StatefulResourceImpl.java
===================================================================
RCS file: /home/globdev/CVS/globus-packages/workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/StatefulResourceImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- StatefulResourceImpl.java 30 Nov 2006 20:47:14 -0000 1.6
+++ StatefulResourceImpl.java 4 Jan 2007 16:09:29 -0000 1.7
@@ -20,6 +20,7 @@
import org.globus.workspace.WorkspaceException;
import org.globus.workspace.service.WorkspaceHome;
import org.globus.workspace.service.WorkspaceResource;
+import org.globus.workspace.service.impls.async.RequestFactory;
import org.globus.workspace.persistence.DataUtil;
import org.globus.workspace.persistence.WorkspaceDatabaseException;
import org.globus.wsrf.NoSuchResourceException;
@@ -42,6 +43,28 @@
private static TimerManager timerManager = null;
+ private RequestFactory reqFactory;
+
+ public StatefulResourceImpl() {
+ super();
+ try {
+ this.reqFactory = (RequestFactory)
+ new InitialContext().lookup(TASK_FACTORY_ADAPTER);
+ } catch (Exception e) {
+ logger.fatal("",e);
+ }
+ }
+
+ public StatefulResourceImpl(boolean underTest) {
+ super(underTest);
+ try {
+ this.reqFactory = (RequestFactory)
+ new InitialContext().lookup(TASK_FACTORY_ADAPTER);
+ } catch (Exception e) {
+ logger.fatal("",e);
+ }
+ }
+
// When these states are reached, a WS-notification is sent to
// any subscribers of the current deployment state.
@@ -70,7 +93,7 @@
// WorkspaceResource interface
public synchronized void activate() throws WorkspaceException {
try {
- StateTransition.run(this);
+ StateTransition.run(this, this.reqFactory);
} catch (WorkspaceException e) {
logger.error("problem activating " + Lager.id(this.id), e);
throw e;
@@ -104,9 +127,9 @@
/**
* @see org.globus.workspace.service.impls.async.RequestDispatch#message(int, int, Exception)
- * @param id
- * @param state
- * @param err
+ * @param id task id
+ * @param state state accomplished or state attempted
+ * @param err if null, state is assumed accomplished, otherwise error
*/
public static void notify(int id, int state, Exception err) {
@@ -333,7 +356,7 @@
if (evaluate) {
// re-evaluate what to do now that the state has changed
try {
- StateTransition.run(this);
+ StateTransition.run(this, this.reqFactory);
} catch (WorkspaceException e) {
logger.error(
"problem transitioning " + Lager.id(this.id), e);
@@ -516,7 +539,7 @@
if (evaluate) {
try {
// re-evaluate what to do now that the target state has changed
- StateTransition.run(this);
+ StateTransition.run(this, this.reqFactory);
} catch (WorkspaceException e) {
logger.error("problem transitioning " + Lager.id(this.id), e);
// setting to corrupted and/or destroying is dependent on the
@@ -536,7 +559,7 @@
}
/**
- * @param targetState
+ * @param targetState state int
* @return null for success or failure msg for helpful logging
*/
public static String isValidTargetState(int targetState) {
1.5 +114 -70 workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/StateTransition.java
http://viewcvs.globus.org/viewcvs.cgi/workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/StateTransition.java.diff?r1=1.4&r2=1.5
(In the diff below, changes in quantity of whitespace are not shown.)
Index: StateTransition.java
===================================================================
RCS file: /home/globdev/CVS/globus-packages/workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/StateTransition.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -b -r1.4 -r1.5
--- StateTransition.java 19 Sep 2006 15:51:54 -0000 1.4
+++ StateTransition.java 4 Jan 2007 16:09:29 -0000 1.5
@@ -45,10 +45,12 @@
*
* Only public method in class.
*
- * @param resource
- * @throws WorkspaceException
+ * @param resource resource to inspect
+ * @param reqFactory impl of taskfactory
+ * @throws WorkspaceException problem
*/
- public static void run(StatefulResourceImpl resource)
+ public static void run(StatefulResourceImpl resource,
+ RequestFactory reqFactory)
throws WorkspaceException {
int id = ((Integer)resource.getID()).intValue();
@@ -58,10 +60,15 @@
logger.trace(idStr + ": request state transition");
}
+ if (reqFactory == null) {
+ throw new IllegalArgumentException("reqFactory is null");
+ }
+
_run(resource,
resource.getState(),
resource.getTargetState(),
id,
+ reqFactory,
idStr,
DataUtil.stateName(resource.getState()),
DataUtil.stateName(resource.getTargetState()));
@@ -71,7 +78,7 @@
}
}
- /**
+ /*
* Runs a hardcoded chain of command pattern (with jumps).
* Originally used Apache Commons chain library, but this works well.
*/
@@ -79,6 +86,7 @@
int cur,
int tar,
int id,
+ RequestFactory reqFac,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
@@ -88,13 +96,13 @@
}
return corrupted( cur,tar, idStr,curStr,tarStr) ||
- remove(res,cur,tar,id,idStr,curStr,tarStr) ||
- stageIn(res,cur,tar,id,idStr,curStr,tarStr) ||
- propagate(res,cur,tar,id,idStr,curStr,tarStr) ||
- start(res,cur,tar,id,idStr,curStr,tarStr) ||
- shutdown(res,cur,tar,id,idStr,curStr,tarStr) ||
- readyForTransport(res,cur,tar,id,idStr,curStr,tarStr) ||
- stageOut(res,cur,tar,id,idStr,curStr,tarStr);
+ remove(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ stageIn(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ propagate(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ start(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ shutdown(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ readyForTransport(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ stageOut(res,cur,tar,id,reqFac,idStr,curStr,tarStr);
}
// allows a curstate jump, see stageIn handler
@@ -102,16 +110,17 @@
int cur,
int tar,
int id,
+ RequestFactory reqFac,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
- return propagate(res,cur,tar,id,idStr,curStr,tarStr) ||
- start(res,cur,tar,id,idStr,curStr,tarStr) ||
- shutdown(res,cur,tar,id,idStr,curStr,tarStr) ||
- readyForTransport(res,cur,tar,id,idStr,curStr,tarStr) ||
- stageOut(res,cur,tar,id,idStr,curStr,tarStr);
+ return propagate(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ start(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ shutdown(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ readyForTransport(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ stageOut(res,cur,tar,id,reqFac,idStr,curStr,tarStr);
}
// allows a curstate jump, see propagate handler
@@ -119,15 +128,16 @@
int cur,
int tar,
int id,
+ RequestFactory reqFac,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
- return start(res,cur,tar,id,idStr,curStr,tarStr) ||
- shutdown(res,cur,tar,id,idStr,curStr,tarStr) ||
- readyForTransport(res,cur,tar,id,idStr,curStr,tarStr) ||
- stageOut(res,cur,tar,id,idStr,curStr,tarStr);
+ return start(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ shutdown(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ readyForTransport(res,cur,tar,id,reqFac,idStr,curStr,tarStr) ||
+ stageOut(res,cur,tar,id,reqFac,idStr,curStr,tarStr);
}
@@ -246,6 +256,7 @@
int current,
int target,
int id,
+ RequestFactory reqFactory,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
@@ -298,7 +309,7 @@
switch (current) {
case STATE_STAGING_IN:
- req = RequestFactory.cancelStagingIn();
+ req = reqFactory.cancelStagingIn();
nextstate = STATE_CANCELLING_STAGING_IN;
resource.getWorkspace().getStageInRequest().
setDelegDN(resource.getCreatorDN());
@@ -306,22 +317,22 @@
resource.getWorkspace().getStageInRequest());
break;
case STATE_UNPROPAGATED:
- req = RequestFactory.cancelUnpropagated();
+ req = reqFactory.cancelUnpropagated();
nextstate = STATE_CANCELLING_UNPROPAGATED;
ctx.setVm((VirtualMachine)resource.getWorkspace());
break;
case STATE_PROPAGATING:
- req = RequestFactory.cancelPropagating();
+ req = reqFactory.cancelPropagating();
nextstate = STATE_CANCELLING_PROPAGATING;
ctx.setVm((VirtualMachine)resource.getWorkspace());
break;
case STATE_PROPAGATING_TO_START:
- req = RequestFactory.cancelPropagatingToStart();
+ req = reqFactory.cancelPropagatingToStart();
nextstate = STATE_CANCELLING_PROPAGATING_TO_START;
ctx.setVm((VirtualMachine)resource.getWorkspace());
break;
case STATE_PROPAGATING_TO_PAUSE:
- req = RequestFactory.cancelPropagatingToPause();
+ req = reqFactory.cancelPropagatingToPause();
nextstate = STATE_CANCELLING_PROPAGATING_TO_PAUSE;
ctx.setVm((VirtualMachine)resource.getWorkspace());
break;
@@ -333,24 +344,24 @@
case STATE_PAUSING:
case STATE_PAUSED:
case STATE_SHUTTING_DOWN:
- req = RequestFactory.cancelAllAtVMM();
+ req = reqFactory.cancelAllAtVMM();
nextstate = STATE_CANCELLING_AT_VMM;
ctx.setVm((VirtualMachine)resource.getWorkspace());
break;
case STATE_READYING_FOR_TRANSPORT:
- req = RequestFactory.cancelReadyingForTransport();
+ req = reqFactory.cancelReadyingForTransport();
nextstate = STATE_CANCELLING_READYING_FOR_TRANSPORT;
ctx.setVm((VirtualMachine)resource.getWorkspace());
break;
case STATE_READY_FOR_TRANSPORT:
- req = RequestFactory.cancelReadyForTransport();
+ req = reqFactory.cancelReadyForTransport();
nextstate = STATE_CANCELLING_READY_FOR_TRANSPORT;
ctx.setVm((VirtualMachine)resource.getWorkspace());
break;
case STATE_STAGING_OUT:
- req = RequestFactory.cancelStagingOut();
+ req = reqFactory.cancelStagingOut();
nextstate = STATE_CANCELLING_STAGING_OUT;
- resource.getWorkspace().getStageInRequest().
+ resource.getWorkspace().getStageOutRequest().
setDelegDN(resource.getCreatorDN());
ctx.setStagingRequest(
resource.getWorkspace().getStageOutRequest());
@@ -370,7 +381,7 @@
if (oldstate >= STATE_PROPAGATING
&& oldstate < STATE_READYING_FOR_TRANSPORT) {
- req = RequestFactory.cancelAllAtVMM();
+ req = reqFactory.cancelAllAtVMM();
nextstate = STATE_CANCELLING_AT_VMM;
ctx.setVm((VirtualMachine)resource.getWorkspace());
@@ -440,10 +451,20 @@
int current,
int target,
int id,
+ RequestFactory reqFactory,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
+ if (current == STATE_STAGING_IN) {
+ // can happen if user calls operations while staging is still
+ // happening, just cut out and do nothing
+ if (trace) {
+ logger.debug("current is " + curStr + ", nothing to do");
+ }
+ return true;
+ }
+
// target not applicable
if (target < STATE_UNPROPAGATED) {
return false;
@@ -462,19 +483,22 @@
if (!resource.isStageInRequired()) {
resource.setStateUnderLock(STATE_UNPROPAGATED);
- _runProp(resource, STATE_UNPROPAGATED, target, id, idStr,
- DataUtil.stateName(STATE_UNPROPAGATED), tarStr);
+ _runProp(resource, STATE_UNPROPAGATED, target, id, reqFactory,
+ idStr, DataUtil.stateName(STATE_UNPROPAGATED), tarStr);
return true;
}
// staging is needed
- WorkspaceRequest req = RequestFactory.stageIn();
- if (req == null) {
+ boolean enabled =
+ WorkspaceResourceImpl.getOptions().isStageInEnabled();
+
+ WorkspaceRequest req = reqFactory.stageIn();
+ if (req == null || !enabled) {
resource.setStateUnderLock(STATE_CORRUPTED + STATE_STAGING_IN);
- if (WorkspaceResourceImpl.getOptions().isStageInEnabled()) {
+ if (enabled) {
throw new WorkspaceException("stageIn functionality needed" +
" and enabled but no implementation class is configured");
} else {
@@ -513,10 +537,22 @@
int current,
int target,
int id,
+ RequestFactory reqFactory,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
+ if (current == STATE_PROPAGATING ||
+ current == STATE_PROPAGATING_TO_PAUSE ||
+ current == STATE_PROPAGATING_TO_START) {
+ // can happen if user calls operations while propagation is still
+ // happening, just cut out and do nothing
+ if (trace) {
+ logger.debug("current state is " + curStr + ", nothing to do");
+ }
+ return true;
+ }
+
if (target < STATE_PROPAGATED) {
return false;
}
@@ -534,8 +570,8 @@
if (!resource.isPropagateRequired()) {
resource.setStateUnderLock(STATE_PROPAGATED);
- _runStart(resource, STATE_PROPAGATED, target, id, idStr,
- DataUtil.stateName(STATE_PROPAGATED), tarStr);
+ _runStart(resource, STATE_PROPAGATED, target, id, reqFactory,
+ idStr, DataUtil.stateName(STATE_PROPAGATED), tarStr);
return true;
}
@@ -572,7 +608,7 @@
if (target == STATE_STARTED) {
if (propstartOK) {
- req = RequestFactory.propagateAndStart();
+ req = reqFactory.propagateAndStart();
if (req == null) {
if (trace) {
@@ -585,7 +621,7 @@
} else {
- req = RequestFactory.propagate();
+ req = reqFactory.propagate();
if (req == null) {
throw new WorkspaceException("propagate functionality " +
@@ -607,7 +643,7 @@
if (propstartOK) {
- req = RequestFactory.propagateAndPause();
+ req = reqFactory.propagateAndPause();
if (req == null) {
if (trace) {
@@ -619,7 +655,7 @@
} else {
- req = RequestFactory.propagate();
+ req = reqFactory.propagate();
if (req == null) {
throw new WorkspaceException("propagate functionality " +
@@ -639,7 +675,7 @@
} else if (target == STATE_PROPAGATED) {
- req = RequestFactory.propagate();
+ req = reqFactory.propagate();
if (req == null) {
@@ -672,7 +708,7 @@
": falling back to propagate-only\n");
}
- req = RequestFactory.propagate();
+ req = reqFactory.propagate();
if (req == null) {
throw new WorkspaceException("propagate functionality " +
@@ -746,6 +782,7 @@
int current,
int target,
int id,
+ RequestFactory reqFactory,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
@@ -778,11 +815,13 @@
// corrupted
// TODO: but make sure exception propagates back to client
+ boolean notifyPaused = false;
+
WorkspaceRequest req;
if (target == STATE_REBOOT) {
- req = RequestFactory.reboot();
+ req = reqFactory.reboot();
if (req == null) {
throw new WorkspaceException("reboot not implemented");
@@ -804,7 +843,7 @@
throw new WorkspaceException("programmer error");
}
- req = RequestFactory.unpause();
+ req = reqFactory.unpause();
if (req == null) {
throw new WorkspaceException("unpause not implemented");
@@ -818,9 +857,10 @@
} else if (current == STATE_PROPAGATED) {
if (target == STATE_PAUSED) {
- req = RequestFactory.startPaused();
+ req = reqFactory.startPaused();
+ notifyPaused = true;
} else {
- req = RequestFactory.start();
+ req = reqFactory.start();
}
if (req == null) {
@@ -834,7 +874,7 @@
} else if (current == STATE_SERIALIZED) {
- req = RequestFactory.unserialize();
+ req = reqFactory.unserialize();
if (req == null) {
throw new WorkspaceException("unserialize not implemented");
@@ -862,7 +902,11 @@
new WorkspaceRequestContext(id, resource.getName());
ctx.setVm((VirtualMachine)resource.getWorkspace());
+ if (notifyPaused) {
+ ctx.setNotify(STATE_PAUSED);
+ } else {
ctx.setNotify(STATE_STARTED);
+ }
req.setContext(ctx);
resource.setStateUnderLock(STATE_STARTING);
@@ -880,6 +924,7 @@
int current,
int target,
int id,
+ RequestFactory reqFactory,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
@@ -916,7 +961,7 @@
target == STATE_READY_FOR_TRANSPORT ||
target == STATE_STAGED_OUT) {
- req = RequestFactory.shutdownNormal();
+ req = reqFactory.shutdownNormal();
if (req == null) {
throw new WorkspaceException("shutdown normal unimplemented");
@@ -941,7 +986,7 @@
// current == STATE_PAUSED guaranteed to be false, so we are
// just left with STATE_STARTING and STATE_STARTED
- req = RequestFactory.pause();
+ req = reqFactory.pause();
if (req == null) {
throw new WorkspaceException("pause not implemented");
@@ -958,7 +1003,7 @@
} else {
- req = RequestFactory.shutdownSerialize();
+ req = reqFactory.shutdownSerialize();
if (req == null) {
throw new WorkspaceException(
@@ -991,6 +1036,7 @@
int current,
int target,
int id,
+ RequestFactory reqFactory,
String idStr,
String curStr,
String tarStr)
@@ -1018,7 +1064,8 @@
if (!resource.isUnPropagateRequired()) {
resource.setStateUnderLock(STATE_READY_FOR_TRANSPORT);
- stageOut(resource, STATE_READY_FOR_TRANSPORT, target, id, idStr,
+ stageOut(resource, STATE_READY_FOR_TRANSPORT, target, id,
+ reqFactory, idStr,
DataUtil.stateName(STATE_READY_FOR_TRANSPORT), tarStr);
return true;
}
@@ -1054,8 +1101,7 @@
"needed but it has been disabled");
}
-
- WorkspaceRequest req = RequestFactory.readyForTransport();
+ WorkspaceRequest req = reqFactory.readyForTransport();
if (req == null) {
if (corrupTag == STATE_INVALID) {
@@ -1064,15 +1110,9 @@
resource.setStateUnderLock(STATE_CORRUPTED + corrupTag);
}
- if (WorkspaceResourceImpl.getOptions().isStageInEnabled()) {
throw new WorkspaceException("ready-for-transport " +
"functionality needed and enabled but no implementation " +
"class is configured");
- } else {
- // Binding should have rejected this request
- throw new WorkspaceException("ready-for-transport " +
- "functionality needed but it has been disabled");
- }
}
WorkspaceRequestContext ctx =
@@ -1102,6 +1142,7 @@
int current,
int target,
int id,
+ RequestFactory reqFactory,
String idStr,
String curStr,
String tarStr) throws WorkspaceException {
@@ -1135,12 +1176,15 @@
return false;
}
- WorkspaceRequest req = RequestFactory.stageOut();
- if (req == null) {
+ boolean enabled =
+ WorkspaceResourceImpl.getOptions().isStageOutEnabled();
+
+ WorkspaceRequest req = reqFactory.stageOut();
+ if (req == null || !enabled) {
resource.setStateUnderLock(STATE_CORRUPTED + STATE_STAGING_OUT);
- if (WorkspaceResourceImpl.getOptions().isStageOutEnabled()) {
+ if (enabled) {
throw new WorkspaceException("stage-out functionality " +
"needed and enabled but no implementation class is " +
"configured");
1.8 +30 -2 workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/WorkspaceResourceImpl.java
http://viewcvs.globus.org/viewcvs.cgi/workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/WorkspaceResourceImpl.java.diff?r1=1.7&r2=1.8
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WorkspaceResourceImpl.java
===================================================================
RCS file: /home/globdev/CVS/globus-packages/workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/WorkspaceResourceImpl.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- WorkspaceResourceImpl.java 19 Sep 2006 15:51:54 -0000 1.7
+++ WorkspaceResourceImpl.java 4 Jan 2007 16:09:29 -0000 1.8
@@ -60,6 +60,7 @@
import org.globus.wsrf.security.SecurityManager;
import javax.naming.InitialContext;
+import javax.naming.NamingException;
import java.text.DateFormat;
import java.util.Calendar;
@@ -84,8 +85,15 @@
protected Counter pendingNotifications = new Counter(0, null);
protected boolean opsEnabled;
- private static WorkspaceResourceOptions options =
- new WorkspaceResourceOptions();
+ private static WorkspaceResourceOptions options;
+
+ static {
+ try {
+ options = new WorkspaceResourceOptions();
+ } catch (NamingException e) {
+ logger.fatal(e.getMessage());
+ }
+ }
protected static PersistenceAdapter persistenceAdapter;
protected static Scheduler schedAdapter;
@@ -158,6 +166,26 @@
}
}
+ public WorkspaceResourceImpl(boolean underTest) {
+ if (underTest) {
+ logger.info("WorkspaceResourceImpl is in standalone " +
+ "test environment");
+ }
+
+ try {
+ if (persistenceAdapter == null) {
+ persistenceAdapter = DBUtil.getDBAdapter(PERSISTENCE_ADAPTER);
+ }
+
+ if (schedAdapter == null) {
+ schedAdapter = (Scheduler)
+ new InitialContext().lookup(SCHEDULER_ADAPTER);
+ }
+ } catch (Exception e) {
+ logger.fatal("",e);
+ }
+ }
+
/*************/
/* Creation */
1.4 +14 -4 workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/WorkspaceResourceOptions.java
http://viewcvs.globus.org/viewcvs.cgi/workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/WorkspaceResourceOptions.java.diff?r1=1.3&r2=1.4
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WorkspaceResourceOptions.java
===================================================================
RCS file: /home/globdev/CVS/globus-packages/workspace/vm/service/service/java/source/src/org/globus/workspace/service/impls/WorkspaceResourceOptions.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- WorkspaceResourceOptions.java 12 Sep 2006 14:23:03 -0000 1.3
+++ WorkspaceResourceOptions.java 4 Jan 2007 16:09:29 -0000 1.4
@@ -18,6 +18,10 @@
import org.globus.workspace.service.impls.async.RequestFactory;
import org.globus.workspace.service.impls.async.WorkspaceRequestContext;
+import org.globus.workspace.WorkspaceConstants;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
/**
* Options that are set once and apply to all resources
@@ -32,6 +36,12 @@
private Boolean allowStaticIPs = null;
private long fakelag = 0;
private String[] availableStagingSchemes = null;
+ private RequestFactory reqFactory = null;
+
+ public WorkspaceResourceOptions() throws NamingException {
+ reqFactory = (RequestFactory) new InitialContext().lookup(
+ WorkspaceConstants.TASK_FACTORY_ADAPTER);
+ }
public boolean isStageInEnabled() {
if (this.stageInEnabled != null) {
@@ -49,7 +59,7 @@
return;
}
if (!flag.booleanValue()) {
- RequestFactory.disableStageIn();
+ reqFactory.disableStageIn();
}
this.stageInEnabled = flag;
}
@@ -70,7 +80,7 @@
return;
}
if (!flag.booleanValue()) {
- RequestFactory.disablePropagate();
+ reqFactory.disablePropagate();
}
this.propagateEnabled = flag;
}
@@ -91,7 +101,7 @@
return;
}
if (!flag.booleanValue()) {
- RequestFactory.disableReadyTransport();
+ reqFactory.disableReadyTransport();
}
this.unpropagateEnabled = flag;
}
@@ -112,7 +122,7 @@
return;
}
if (!flag.booleanValue()) {
- RequestFactory.disableStageOut();
+ reqFactory.disableStageOut();
}
this.stageOutEnabled = flag;
}
More information about the workspace-commit
mailing list