this.populateCreateRequest(createRequest);
/* CREATE */
final WorkspaceCreateResponse_Type response;
try {
response = ((WorkspaceFactoryPortType)this.portType).
create(createRequest);
} catch (WorkspaceCreationFault e) {
throw e;
} catch (WorkspaceResourceRequestDeniedFault e) {
throw e;
} catch (WorkspaceSchedulingFault e) {
throw e;
} catch (WorkspaceMetadataFault e) {
throw e;
} catch (WorkspaceEnsembleFault e) {
throw e;
} catch (WorkspaceContextualizationFault e) {
throw e;
} catch (RemoteException e) {
throw RMIUtils.generalRemoteException(e);
}
/* CHECK GENERAL ASSUMPTIONS */
// the "(?)" symbol is a shorthand for "very unexpected"...
if (response == null) {
throw new ExecutionProblem("(?) null response");
}
final CreatedWorkspace_Type[] allrefs = response.getCreatedWorkspace();
if (allrefs == null) {
throw new ExecutionProblem(
"(?) null references in factory response");
}
/* CHECK NODE-NUMBER RELATED ASSUMPTIONS */
final int expectedNodeNum =
createRequest.getResourceRequest().getNodeNumber();
if (expectedNodeNum == 1) {
if (response.getGroupEPR() != null) {
throw new ExecutionProblem("(?) group EPR assigned but " +
"this was not a group request");
}
} else {
if (response.getGroupEPR() == null) {
throw new ExecutionProblem("(?) group EPR was not assigned " +
"but this was a group request");
}
}
if (allrefs.length != expectedNodeNum) {
throw new ExecutionProblem("(?) expecting " + expectedNodeNum +
"CreatedWorkspace reference(s), received " + allrefs.length);
}
/* CHECK ENSEMBLE RELATED ASSUMPTIONS */
final EndpointReferenceType ensembleEPR = response.getEnsembleEPR();
if (this.expectEnsembleEPR && ensembleEPR == null) {
throw new ExecutionProblem("(?) requested ensemble " +
"participation but no ensemble EPR was assigned");
}
if (!this.expectEnsembleEPR && ensembleEPR != null) {
throw new ExecutionProblem("(?) ensemble EPR assigned but " +
"no request was made for ensemble participation");
}
/* CHECK CONTEXT RELATED ASSUMPTIONS */
final EndpointReferenceType contextEPR = response.getContextEPR();
if (this.expectContextEPR && contextEPR == null) {
throw new ExecutionProblem("(?) requested context " +
"participation but no context EPR was assigned");
}