printer.println("Workflow: [id=" + workflow.getId() + ", name=" + workflow.getName() + ", numTasks=" + workflow.getTasks().size() + ", taskIds="+taskIds.toString() + "]");
@Override public void execute(ActionMessagePrinter printer) { Validate.notNull(message, "Must specify message"); printer.print(message); }
ActionMessagePrinter printer = new ActionMessagePrinter(); cmdLineArgs.getSpecifiedAction().execute(printer); printActionMessages(printer.getPrintedMessages());
ActionMessagePrinter printer = new ActionMessagePrinter(); cmdLineArgs.getSpecifiedAction().execute(printer); printActionMessages(printer.getPrintedMessages());
if (lastVerificationResult = verifier.verify(protocol, getSite(), getAuthentication())) { printer.println("Protocol '" + protocol.getClass().getCanonicalName() + "' PASSED verification!"); } else { printer.println("Protocol '" + protocol.getClass().getCanonicalName() + "' FAILED verification!"); getSite(), getAuthentication(), verifier); if (lastVerificationResult = protocol != null) { printer.println("Protocol '" + protocol.getClass().getCanonicalName() + "' PASSED verification!"); } else { printer.println("No Protocol determined, FAILED verification!");
@SuppressWarnings("unchecked") @Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try (WorkflowManagerClient client = getClient()) { List<Workflow> workflows = client.getWorkflowsByEvent(eventName); if (workflows == null) { throw new Exception("WorkflowManager returned null workflow list"); } for (Workflow workflow : workflows) { StringBuilder taskIds = new StringBuilder(); for (WorkflowTask wt : workflow.getTasks()) { if (taskIds.length()>0) { taskIds.append(", "); } taskIds.append(wt.getTaskId()); } printer.println("Workflow: [id=" + workflow.getId() + ", name=" + workflow.getName() + ", numTasks=" + workflow.getTasks().size() + ", taskIds="+taskIds.toString() + "]"); } } catch (Exception e) { throw new CmdLineActionException( "Failed to get workflows by event name '" + eventName + "' : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { Product p = getProduct(); printer.println("Product:"); printer.println(" - ID: " + p.getProductId()); printer.println(" - Name: " + p.getProductName()); printer.println(" - ProductType: " + p.getProductType().getName()); printer.println(" - Structure: " + p.getProductStructure()); printer.println(" - Status: " + p.getTransferStatus()); if (p.getRootRef() != null) { printer.println(" - RootRef: " + p.getRootRef().getDataStoreReference()); } if (!p.getProductReferences().isEmpty()) { printer.println(" - References: "); for (Reference ref : p.getProductReferences()) { printer.println(" - " + ref.getDataStoreReference() + " (" + ref.getFileSize() + ")"); } } } catch (Exception e) { throw new CmdLineActionException("Failed to get product info : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try (FileManagerClient client = getClient()) { Validate.notNull(productTypeId, "Must specify productTypeId"); Validate.notNull(productTypeName, "Must specify productTypeName"); Validate.notNull(productTypeDescription, "Must specify productTypeDescription"); Validate .notNull(fileRepositoryPath, "Must specify fileRepositoryPath"); Validate.notNull(versioner, "Must specify versioner"); ProductType type = new ProductType(); type.setProductTypeId(productTypeId); type.setName(productTypeName); type.setDescription(productTypeDescription); type.setProductRepositoryPath(fileRepositoryPath); type.setVersioner(versioner); printer.println("addProductType: Result: " + client.addProductType(type)); } catch (Exception e) { throw new CmdLineActionException("Failed to add product type with " + "id '" + productTypeId + "', name '" + productTypeName + "', description '" + productTypeDescription + "', repository '" + fileRepositoryPath + ", and versioner '" + versioner + "' : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try (FileManagerClient client = getClient()) { List<FileTransferStatus> statuses = client.getCurrentFileTransfers(); if (statuses == null) { throw new NullPointerException( "FileManager returned null file transfers"); } for (FileTransferStatus status : statuses) { printer.println("File Transfer: [ref={orig=" + status.getFileRef().getOrigReference() + ",ds=" + status.getFileRef().getDataStoreReference() + "},product=" + status.getParentProduct().getProductName() + ",fileSize=" + status.getFileRef().getFileSize() + ",amtTransferred=" + status.getBytesTransferred() + ",pct=" + status.computePctTransferred() + "]"); } } catch (Exception e) { throw new CmdLineActionException( "Failed to get list of current file transfers : " + e.getMessage(), e); } } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { List<Job> queuedJobs = getClient().getQueuedJobs(); if (queuedJobs != null && queuedJobs.size() > 0){ printer.println("Jobs: "); for(Job job: queuedJobs){ printer.println("Job: [id=" + job.getId() + ", status=" + getReadableJobStatus(job.getStatus()) + ",name=" + job.getName() + ",queue=" + job.getQueueName() + ",load=" + job.getLoadValue() + ",inputClass=" + job.getJobInputClassName() + ",instClass=" + job.getJobInstanceClassName() + "]"); } printer.println(); } } catch (Exception e) { throw new CmdLineActionException("Failed to get queued jobs : " + e.getMessage(), e); } } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { Validate.notNull(jobDefinitionFile, "Must specify jobDefinitionFile"); JobSpec spec = JobBuilder.buildJobSpec(jobDefinitionFile); if (url == null) { printer.println("Successful submit job with jobId '" + getClient().submitJob(spec.getJob(), spec.getIn()) + "'"); } else { if (getClient().submitJob(spec.getJob(), spec.getIn(), url)) { printer.println("Successfully submitted job to url '" + url + "'"); } else { throw new Exception("Job submit returned false"); } } } catch (Exception e) { throw new CmdLineActionException("Failed to submit job for job" + " definition file '" + jobDefinitionFile + "' : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { Product p = getProduct(); printer.println("Product:"); printer.println(" - ID: " + p.getProductId()); printer.println(" - Name: " + p.getProductName()); printer.println(" - ProductType: " + p.getProductType().getName()); printer.println(" - Structure: " + p.getProductStructure()); printer.println(" - Status: " + p.getTransferStatus()); if (p.getRootRef() != null) { printer.println(" - RootRef: " + p.getRootRef().getDataStoreReference()); } if (!p.getProductReferences().isEmpty()) { printer.println(" - References: "); for (Reference ref : p.getProductReferences()) { printer.println(" - " + ref.getDataStoreReference() + " (" + ref.getFileSize() + ")"); } } } catch (Exception e) { throw new CmdLineActionException("Failed to get product info : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { Validate.notNull(productTypeId, "Must specify productTypeId"); Validate.notNull(productTypeName, "Must specify productTypeName"); Validate.notNull(productTypeDescription, "Must specify productTypeDescription"); Validate .notNull(fileRepositoryPath, "Must specify fileRepositoryPath"); Validate.notNull(versioner, "Must specify versioner"); ProductType type = new ProductType(); type.setProductTypeId(productTypeId); type.setName(productTypeName); type.setDescription(productTypeDescription); type.setProductRepositoryPath(fileRepositoryPath); type.setVersioner(versioner); printer.println("addProductType: Result: " + getClient().addProductType(type)); } catch (Exception e) { throw new CmdLineActionException("Failed to add product type with " + "id '" + productTypeId + "', name '" + productTypeName + "', description '" + productTypeDescription + "', repository '" + fileRepositoryPath + ", and versioner '" + versioner + "' : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { List<FileTransferStatus> statuses = getClient() .getCurrentFileTransfers(); if (statuses == null) { throw new NullPointerException( "FileManager returned null file transfers"); } for (FileTransferStatus status : statuses) { printer.println("File Transfer: [ref={orig=" + status.getFileRef().getOrigReference() + ",ds=" + status.getFileRef().getDataStoreReference() + "},product=" + status.getParentProduct().getProductName() + ",fileSize=" + status.getFileRef().getFileSize() + ",amtTransferred=" + status.getBytesTransferred() + ",pct=" + status.computePctTransferred() + "]"); } } catch (Exception e) { throw new CmdLineActionException( "Failed to get list of current file transfers : " + e.getMessage(), e); } } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { FileSystemXmlApplicationContext appContext = new FileSystemXmlApplicationContext( this.beanRepo); try { ProductCrawler pc = (ProductCrawler) appContext .getBean(crawlerId != null ? crawlerId : getName()); pc.setApplicationContext(appContext); if (pc.getDaemonPort() != -1 && pc.getDaemonWait() != -1) { new CrawlDaemon(pc.getDaemonWait(), pc, pc.getDaemonPort()) .startCrawling(); printer.println("Finished crawler daemon"); } else { pc.crawl(); printer.println("Finished crawling"); } pc.shutdown(); } catch (Exception e) { throw new CmdLineActionException("Failed to launch crawler : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { FileTransferStatus status = getClient().getCurrentFileTransfer(); if (status == null) { throw new NullPointerException( "FileManager returned null transfer status"); } printer.println("File Transfer: [ref={orig=" + status.getFileRef().getOrigReference() + ",ds=" + status.getFileRef().getDataStoreReference() + "},product=" + status.getParentProduct().getProductName() + ",fileSize=" + status.getFileRef().getFileSize() + ",amtTransferred=" + status.getBytesTransferred() + ",pct=" + status.computePctTransferred() + "]"); } catch (Exception e) { throw new CmdLineActionException( "Failed to get current file transfer : " + e.getMessage(), e); } } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try (WorkflowManagerClient client = getClient()) { WorkflowTask task = client.getTaskById(taskId); StringBuilder requiredMetFields = new StringBuilder(); for (Object o : task.getRequiredMetFields()) { if (requiredMetFields.length() > 0) { requiredMetFields.append(", "); } requiredMetFields.append((String) o); } printer.println("Task: [id=" + task.getTaskId() + ", name=" + task.getTaskName() + ", order=" + task.getOrder() + ", class=" + task.getClass().getName() + ", numConditions=" + task.getConditions().size() + ", requiredMetadataFields=[" + requiredMetFields.toString() + "]" + ", configuration=" + task.getTaskConfig().getProperties() + "]"); } catch (Exception e) { throw new CmdLineActionException( "Failed to get task by id for taskId '" + taskId + "' : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try (FileManagerClient client = getClient()) { Validate.notNull(productId, "Must specify productid"); Validate.notNull(productTypeName, "Must specify productTypeName"); Product product = new Product(); // TODO(bfoster): Not sure why ProductType is needed here. ProductType pt = client.getProductTypeByName(productTypeName); if (pt == null) { throw new Exception("FileManager returned null ProductType"); } product.setProductType(pt); product.setProductId(productId); printer.println("Product: [id=" + productId + ", transferPct=" + client.getProductPctTransferred(product) + "]"); } catch (Exception e) { throw new CmdLineActionException("Failed to get percent transferred" + " for product id '" + productId + "' and ProductType name '" + productTypeName + "' : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { WorkflowTask task = getClient().getTaskById(taskId); StringBuilder requiredMetFields = new StringBuilder(); for (Object o : task.getRequiredMetFields()) { if (requiredMetFields.length() > 0) { requiredMetFields.append(", "); } requiredMetFields.append((String) o); } printer.println("Task: [id=" + task.getTaskId() + ", name=" + task.getTaskName() + ", order=" + task.getOrder() + ", class=" + task.getClass().getName() + ", numConditions=" + task.getConditions().size() + ", requiredMetadataFields=[" + requiredMetFields.toString()+"]" + ", configuration="+ task.getTaskConfig().getProperties() + "]"); } catch (Exception e) { throw new CmdLineActionException( "Failed to get task by id for taskId '" + taskId + "' : " + e.getMessage(), e); } }
@Override public void execute(ActionMessagePrinter printer) throws CmdLineActionException { try { XmlRpcWorkflowManagerClient client = getClient(); WorkflowInstance inst = client.getWorkflowInstanceById(instanceId); if (inst == null) { throw new Exception( "WorkflowManager returned null workflow instance"); } printer.println("Instance: [id=" + inst.getId() + ", status=" + inst.getStatus() + ", currentTask=" + inst.getCurrentTaskId() + ", workflow=" + inst.getWorkflow().getName() + ",wallClockTime=" + client.getWorkflowWallClockMinutes(inst.getId()) + ",currentTaskWallClockTime=" + client.getWorkflowCurrentTaskWallClockMinutes(inst.getId()) + "]"); } catch (Exception e) { throw new CmdLineActionException( "Failed to get workflow instance information for" + " instanceId '" + instanceId + "' : " + e.getMessage(), e); } }