Package org.globus.workspace.client_core.repr

Examples of org.globus.workspace.client_core.repr.Group


            workspace.setContextMemberEPR(contextEPR);

            workspaceList.add(workspace);
        }

        final Group group = new Group();

        group.setGroupEPR(groupEPR);
        group.setEnsembleMemberEPR(ensembleEPR);
        group.setContextMemberEPR(contextEPR);

        final Workspace[] workspaces =
                (Workspace[]) workspaceList.toArray(
                                    new Workspace[workspaceList.size()]);

        group.setWorkspaces(workspaces);

        return group;
    }
View Full Code Here


                this.subscribe(warray);
            }

        } else {

            final Group group = this.group();

            final NumberFormat format = NumberFormat.getInstance();
            format.setMinimumIntegerDigits(this.groupCreate.getSettings().
                                                getGroupSuffixMinCharacters());

            // only override nameToPrint if no short, display name was given
            if (this.d.shortName == null) {
                this.d.nameToPrint = group.getGroupID();
                if (this.d.subscribeLaunch != null) {
                    this.d.subscribeLaunch.setName(this.d.nameToPrint);
                }
            }

            // optional write of each EPR is triggered by groupBaseName
            final String baseName = this.d.groupBaseName;
            final Workspace[] warray = group.getWorkspaces();
            if (baseName != null) {
               
                final String elem =
                   this.eitherCreate.getSettings().getGeneratedEprElementName();

                // suppress console prints of individual EPR writes if > 10
                final Print print;
                boolean suppressed = false;
                if (warray.length > 10) {
                    print = new Print();
                    suppressed = true;
                } else {
                    print = this.pr;
                }
               
                for (int i = 0; i < warray.length; i++) {
                    final int key = warray[i].getID().intValue();
                    final String name = baseName + "-" + format.format(key);
                    warray[i].setDisplayName(name);
                    final String path = name + ".epr";
                    writeOneWorkspaceEprPossibly(warray[i], path, elem, print);
                    writeOneWorkspaceEprAndIpPossibly(warray[i],
                                                      this.d.args.eprIdDir);

                }

                if (suppressed && this.pr.enabled()) {
                    final String msg = "Wrote " + warray.length +
                            " individual EPR files (base name: '" +
                            baseName + "'";
                    if (this.pr.useThis()) {
                        this.pr.infoln(PrCodes.CREATE__INSTANCE_EPRFILE_WRITES_OVERFLOW,
                                       msg);
                    } else if (this.pr.useLogging()) {
                        logger.info(msg);
                    }
                }
               
            } else {
                for (int i = 0; i < warray.length; i++) {
                    final int key = warray[i].getID().intValue();
                    final String name = this.d.nameToPrint + "-" + format.format(key);
                    warray[i].setDisplayName(name);
                }
            }

            if (this.pr.enabled() && this.pr.useThis()) {
                this.pr.infoln(PrCodes.CREATE__EXTRALINES, "");
            }
            if (this.d.subscribeAfterDeployment) {
                this.subscribe(group.getWorkspaces());
            }
        }
    }
View Full Code Here

                    "Creating group \"" + this.d.nameToPrint  + "\"...";
            this.pr.info(PrCodes.CREATE__GROUP_CREATING_PRINT_WAITING_DOTS, msg);
            this.pr.flush();
        }

        final Group group;
        try {
            group = this.groupCreate.createGroup();
        } catch (WorkspaceResourceRequestDeniedFault e) {
            final String err =
                    "Resource request denied: " + CommonUtil.faultString(e);
            throw new ExecutionProblem(err, e);
        } catch (WorkspaceSchedulingFault e) {
            final String err =
                    "Scheduling problem: " + CommonUtil.faultString(e);
            throw new ExecutionProblem(err, e);
        } catch (WorkspaceMetadataFault e) {
            final String err =
                    "Metadata problem: " + CommonUtil.faultString(e);
            throw new ExecutionProblem(err, e);
        } catch (WorkspaceEnsembleFault e) {
            final String err =
                    "Ensemble related problem: " + CommonUtil.faultString(e);
            throw new ExecutionProblem(err, e);
        } catch (WorkspaceContextualizationFault e) {
            final String err =
                    "Context broker related problem: " + CommonUtil.faultString(e);
            throw new ExecutionProblem(err, e);
        } catch (WorkspaceCreationFault e) {
            final String err = "General problem: " + CommonUtil.faultString(e);
            throw new ExecutionProblem(err, e);
        } catch (BaseFaultType e) {
            final String err = CommonStrings.faultStringOrCommonCause(e, "group");
            throw new ExecutionProblem(err, e);
        }

        if (this.pr.enabled() && this.pr.useThis()) {
            final String msg = " done.";
            this.pr.infoln(PrCodes.CREATE__GROUP_CREATING_PRINT_WAITING_DOTS, msg);
        }

        if (this.pr.enabled()) {
            final String msg = "Group created: " + group.getGroupID();
            if (this.pr.useThis()) {
                this.pr.infoln(PrCodes.CREATE__EXTRALINES, "");
                this.pr.infoln(PrCodes.CREATE__GROUP_ID_PRINT, msg);
            } else if (this.pr.useLogging()) {
                logger.info(msg);
            }
        }

        final Workspace[] workspaces = group.getWorkspaces();
        if (workspaces != null && workspaces.length > 0) {
            final Schedule currentSchedule = workspaces[0].getCurrentSchedule();
            if (currentSchedule != null) {
                if (currentSchedule.getActualInstantiationTime() == null) {
                    this.wasBestEffort = true;
                }
            }
        }

        if (workspaces != null) {
            for (int i = 0; i < workspaces.length; i++) {
                final String netStr = NetUtils.oneLineNetString(workspaces[i]);
                if (netStr == null) {
                    continue;
                }
                if (this.pr.useThis()) {
                    this.pr.infoln(PrCodes.CREATE__GROUP_CREATING_NET_ONELINE,
                                   "  - " + netStr);
                } else if (this.pr.useLogging()) {
                    logger.info(netStr);
                }
            }
        }

        if (this.pr.useThis()) {
            this.pr.infoln(PrCodes.CREATE__EXTRALINES, "");
        }

        if (workspaces != null && workspaces.length > 0) {
            ScheduleUtils.instanceCreateResultSchedulePrint(this.pr,
                                                            workspaces[0]);
        }

        if (this.pr.useThis()) {
            this.pr.infoln(PrCodes.CREATE__EXTRALINES, "");
        }

        if (this.d.createEnsemble) {
            if (this.pr.enabled()) {
                final String msg = "Ensemble created: " + group.getEnsembleID();
                if (this.pr.useThis()) {
                    this.pr.infoln(PrCodes.CREATE__EXTRALINES, "");
                    this.pr.infoln(PrCodes.CREATE__ENSEMBLE_ID_PRINT,
                                   msg);
                } else if (this.pr.useLogging()) {
                    logger.info(msg);
                }
            }
        }

        if (this.d.groupEprPath != null) {

            final QName eprQName =
                new QName("", this.eitherCreate.getSettings().
                                        getGeneratedGroupEprElementName());

            try {
                FileUtils.writeEprToFile(group.getGroupEPR(),
                                         this.d.groupEprPath,
                                         eprQName);

                if (this.pr.enabled()) {
                    final String msg = "Wrote group EPR to \"" +
                                                this.d.groupEprPath + "\"";
                    if (this.pr.useThis()) {
                        this.pr.infoln(PrCodes.CREATE__EXTRALINES, "");
                        this.pr.infoln(PrCodes.CREATE__EPRFILE_WRITES,
                                       msg);
                    } else if (this.pr.useLogging()) {
                        logger.info(msg);
                    }
                }

            } catch (Exception e) {
                final String err = "Problem writing group EPR to file: ";
                throw new ExecutionProblem(err + e.getMessage(), e);
            }
        }

        this.writeEnsembleEprPossibly(group.getEnsembleMemberEPR());

        return group;
    }
View Full Code Here

TOP

Related Classes of org.globus.workspace.client_core.repr.Group

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.