Creation d'une API

-
Bonjour,
Je veux créer une API de surveillance Java pour établir une connexion entre deux projets Java (code source de deux moteurs de workflow ).
J’ai cherché les méthode de surveillance communes entre ces projets (Pegasus workflow engine et Taverna workflow engine). En fait, ces méthodes de surveillance communes ont les mêmes fonctionnalités, mais ils prennent comme entré des différents paramètres. Je ne sais pas comment créer une API de surveillance permet d’appeler la méthode getState() qui permet d’afficher l’état de workflow à partir de deux classes ( (Pegasus.JobStateEntry.getState() et Taverna.StatusReport.getState()) et afficher ses diffèrent résultats en prenant comme paramètre d’entré le workflow ID.



project 1 (Pegasus workflow engine) : class JobStateEntry

* This file or a portion of this file is licensed under the terms of 

* the Globus Toolkit Public License, found in file GTPL, or at 

* http://www.globus.org/toolkit/download/license.html. This notice must 

* appear in redistributions of this file, with or without modification. 

* 

* Redistributions of this Software, with or without modification, must 

* reproduce the GTPL in: (1) the Software, or (2) the Documentation or 

* some other similar material which is provided with the Software (if 

* any). 

* 

* Copyright 1999-2004 University of Chicago and The University of 

* Southern California. All rights reserved. 

*/ 
package org.griphyn.vdl.workflow; 

import java.util.*; 
import edu.isi.pegasus.common.util.Currently; 

/** 


* This class is the container for a job state record.<p> 

* 

* When constructing a job from piece-meal, please note that setting the 

* job's state will automatically set the job's last modification time 

* to the current time. If this is not desired, you must set the 

* modification time after setting the state. However, none of the 

* constructors will set the modification to the current time (yet). 

* 

* @author Jens-S. Vöckler 

* @author Mike Wilde 

* @version $Revision$ 

*/ 
public class JobStateEntry implements Workflow, Cloneable 
{ 
 /** 


* primary key: which workflow do we belong to. If -1 then unknown. 

*/ 
 private long m_wfid = -1; 

 /** 


* primary key: unique job identifier within the workflow 

*/ 
 private String m_id; 

 /** 


* the Condor state of the job. 

*/ 
 private String m_state; 

 /** 


* the last modification time of the job state. 

*/ 
 private Date m_mtime; 

 /** 


* the resource where the job ran, may be unspecified. 

*/ 
 private String m_site = null; 

 /** 


* Creates and returns a copy of this object. 

* @return a new instance. 

*/ 
 public Object clone() 
 { 
   JobStateEntry result = new JobStateEntry( getWorkflowID(), getID() ); 
   result.setState( getState() ); 
   result.setModificationTime( getModificationTime() ); 
   result.setSite( getSite() ); 
   return result; 
 } 

 /** 


* Default contructor. 

*/ 
 public JobStateEntry() 
 { 
   // empty 
 } 

 /** 


 /** 


* Constructs an other empty class. 

* 

* @param wfid is the workflow primary key 

*/ 
 public JobStateEntry( long wfid ) 
 { 
   m_wfid = wfid; 
 } 

 /** 


* Constructs an other empty class. 

* 

* @param wfid is the workflow primary key 

* @param jobid is the job identifier within the workflow 

*/ 
 public JobStateEntry( long wfid, String jobid ) 
 { 
   m_wfid = wfid; 
   m_id = jobid; 
 } 

 /** 


* Constructs an other empty class. It will set the workflow identifier 

* to -1 to indicate no connection. 

* 

* @param jobid is the job identifier within the workflow 

*/ 
 public JobStateEntry( String jobid ) 
 { 
   m_wfid = -1; 
   m_id = jobid; 
 } 

/** 


* Accessor 

* 

* @see #setState(String) 

* @return the Condor job state string with some extensions. 

*/ 
 public String getState() 
 { return this.m_state; } 





the project 2 (Taverna workflow engine) : class StatusReport 

/* 


* Licensed to the Apache Software Foundation (ASF) under one 

* or more contributor license agreements. See the NOTICE file 

* distributed with this work for additional information 

* regarding copyright ownership. The ASF licenses this file 

* to you under the Apache License, Version 2.0 (the 

* "License"); you may not use this file except in compliance 

* with the License. You may obtain a copy of the License at 

* 

* http://www.apache.org/licenses/LICENSE-2.0 

* 

* Unless required by applicable law or agreed to in writing, 

* software distributed under the License is distributed on an 

* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 

* KIND, either express or implied. See the License for the 

* specific language governing permissions and limitations 

* under the License. 

*/ 

package org.apache.taverna.platform.report; 

import java.net.URI; 
import java.nio.file.Path; 
import java.util.ArrayList; 
import java.util.Date; 
import java.util.List; 
import java.util.NavigableSet; 
import java.util.SortedSet; 
import java.util.TreeSet; 

import org.apache.taverna.scufl2.api.common.Ported; 
import org.apache.taverna.scufl2.api.common.URITools; 

import com.fasterxml.jackson.annotation.JsonIgnore; 
import com.fasterxml.jackson.annotation.JsonProperty; 
import com.fasterxml.jackson.annotation.JsonPropertyOrder; 

/** 


* Report about the {@link State} of a workflow component. 

* 

* @author David Withers 

* @param <SUBJECT> 

*            the WorkflowBean that the report is about 

* @param <PARENT> 

*            the parent report type 

*/ 

@JsonPropertyOrder({ "subject", "parent", "state", "createdDate", "startedDate", "pausedDate", 
   "pausedDates", "resumedDate", "resumedDates", "cancelledDate", "failedDate", "completedDate"}) 
public class StatusReport<SUBJECT extends Ported, PARENT extends StatusReport<?, ?>> { 
private final SUBJECT subject; 
private PARENT parentReport; 
private State state; 
private NavigableSet<Invocation> invocations = new TreeSet<>(); 
private Date createdDate, startedDate, pausedDate, resumedDate, cancelledDate, completedDate, 
failedDate; 
private final List<Date> pausedDates = new ArrayList<>(), 
resumedDates = new ArrayList<>(); 
private List<ReportListener> reportListeners = new ArrayList<>(); 

/** 


* Constructs a new StatusReport for the subject and sets the created date to the 


* current date. 

* 

* @param subject 

*            the subject of the report 

*/ 
public StatusReport(SUBJECT subject) { 
this.subject = subject; 
setCreatedDate(new Date()); 
} 

/** 


* Returns the current {@link State}. 

* <p> 

* A state can be CREATED, RUNNING, COMPLETED, PAUSED, CANCELLED or FAILED. 

* 

* @return the current State

*/ 
public State getState() { 
return state; 
}
Afficher la suite 

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.