Changeset 7360


Ignore:
Timestamp:
25/08/10 08:53:23 (9 years ago)
Author:
mnagni
Message:

Many documentation and a fix to the ExecuteDoNewProvider?

Location:
RevitalizationWS/ws/DPWS/trunk
Files:
1 added
4 deleted
20 edited

Legend:

Unmodified
Added
Removed
  • RevitalizationWS/ws/DPWS/trunk/pom.xml

    r7271 r7360  
    7373                        <artifactId>javaee-api</artifactId> 
    7474                        <version>6.0</version> 
    75                         <scope>provided</scope>                  
     75                        <scope>provided</scope> 
    7676                </dependency> 
    7777 
     
    8080                        <artifactId>jboss-ejb3x</artifactId> 
    8181                        <version>4.2.2.GA</version> 
     82                        <scope>provided</scope> 
     83                </dependency> 
     84 
     85                <dependency> 
     86                        <groupId>org.jboss.security</groupId> 
     87                        <artifactId>jboss-security-spi</artifactId> 
     88                        <version>2.0.4</version> 
     89                        <scope>provided</scope> 
     90                </dependency> 
     91 
     92                <dependency> 
     93                        <groupId>org.jboss</groupId> 
     94                        <artifactId>jbossws-spi</artifactId> 
     95                        <version>1.1.1.GA</version> 
    8296                        <scope>provided</scope> 
    8397                </dependency> 
     
    102116                        <scope>provided</scope> 
    103117                </dependency> 
     118                <dependency> 
     119                        <groupId>ndg.services</groupId> 
     120                        <artifactId>jboss</artifactId> 
     121                        <version>0.0.1-SNAPSHOT</version> 
     122                        <scope>provided</scope> 
     123                </dependency> 
     124                <dependency> 
     125                        <groupId>org.jboss.security</groupId> 
     126                        <artifactId>jbosssx</artifactId> 
     127                        <version>2.0.3.SP1</version> 
     128                        <scope>provided</scope> 
     129                </dependency> 
    104130        </dependencies> 
    105131 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/EJBBeanFactory.java

    r7271 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization; 
    214 
     
    618 
    719import ndg.common.NdgMessage; 
     20import ndg.common.ejb.JMSDispatcherRemote; 
     21import ndg.common.ejb.MailDispatcherRemote; 
    822import ndg.common.exception.NdgExecutionException; 
    9 import ndg.services.revitalization.ejb.interfaces.JMSDispatcherRemote; 
    10 import ndg.services.revitalization.ejb.interfaces.MailDispatcherRemote; 
    1123import ndg.services.revitalization.ejb.interfaces.ModelManagerRemote; 
    1224 
     25/** 
     26 * Utility class to retrieve the remote EJB necessary to the application. 
     27 *  
     28 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     29 **/ 
    1330public class EJBBeanFactory { 
    1431         
     32        /** 
     33         * Returns a {@link JMSDispatcherRemote} 
     34         * @return a instance of a JMSDispatcherRemote  
     35         **/ 
    1536        public static JMSDispatcherRemote getMessageDispatcher() throws NdgExecutionException { 
    1637                return getEJBInstance("JMSDispatcher", JMSDispatcherRemote.class);       
    1738        } 
    1839 
     40        /** 
     41         * Returns a {@link MailDispatcherRemote} 
     42         * @return a instance of a MailDispatcherRemote  
     43         **/ 
    1944        public static MailDispatcherRemote getMailDispatcher() throws NdgExecutionException { 
    2045                return getEJBInstance("MailDispatcher", MailDispatcherRemote.class); 
    2146        } 
    2247         
     48         
     49        /** 
     50         * Returns a {@link ModelManagerRemote} 
     51         * @return a instance of a ModelManagerRemote  
     52         **/ 
    2353        public static ModelManagerRemote getModelManager() throws NdgExecutionException { 
    2454                return getEJBInstance("ModelManager", ModelManagerRemote.class); 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/InvokeProcess.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization; 
    214 
     
    517import ndg.common.exception.NdgExecutionException; 
    618 
     19/** 
     20 * Represents a generic process. 
     21 *  
     22 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     23 **/ 
    724public interface InvokeProcess extends Serializable { 
    825        /** 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/MailHelper.java

    r7319 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization; 
    214 
     
    1426import ndg.services.schemas.revitalization.DoIngestRequest; 
    1527 
     28/** 
     29 * Offers some helper methods to send specific mails. 
     30 *  
     31 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     32 */ 
    1633public class MailHelper { 
    1734 
     
    2340        } 
    2441 
     42        /** 
     43         * Informs a list of subscribers that a new harvest operation has been submitted to the system 
     44         * @param the harvest request containing the list of the subscribers to be informed 
     45         * @param the new process instance 
     46         **/ 
    2547        public void newDispatchedHarvestMail(DoHarvestRequest request, HiProcess process) throws NdgExecutionException { 
    2648                ModelManagerRemote mmr = EJBBeanFactory.getModelManager(); 
    27                 ProviderCommon common = mmr.getProviderCommon(process.getProviderId()); 
     49                ProviderCommon common = mmr.getHarvesterConfiguration(process.getProviderId()); 
    2850                List<String> mailTo = filterEmail(request.getEmailReportID(), common); 
    2951                 
     
    3355        } 
    3456 
     57        /** 
     58         * Informs a list of subscribers that a harvest operation has terminated. A message is send to  
     59         * all the provider's subscription list. 
     60         * @param the terminated process instance 
     61         **/     
    3562        public void terminatedHarvestMail(HiProcess hiProcess) throws NdgExecutionException { 
    3663                sendTerminatedProcess(hiProcess, ServiceConfigurationParameter.HARVEST_TERMINATED_MAIL); 
     
    4168        } 
    4269         
     70        /** 
     71         * Informs a list of subscribers that a new ingest operation has been submitted to the system 
     72         * @param the ingest request containing the list of the subscribers to be informed 
     73         **/     
    4374        public void dispatchedDoIngestMail(DoIngestRequest request) throws NdgExecutionException { 
    4475                ModelManagerRemote mmr = EJBBeanFactory.getModelManager(); 
     
    5990        } 
    6091 
     92        /** 
     93         * Informs a list of subscribers that an operation has failed. A message is send to  
     94         * all the provider's subscription list. 
     95         * @param hiProcess the failed process instance 
     96         * @param msg the failure message 
     97         **/ 
    6198        public void sentProcessFailedMail(HiProcess hiProcess, String msg) throws NdgExecutionException {                
    6299                List<String> mailTo = filterEmail(null, hiProcess.getProviderId()); 
     
    78115         * */ 
    79116        private List<String> filterEmail(List<Integer> emailIDs, int providerID) throws NdgExecutionException { 
    80                 return filterEmail(emailIDs, EJBBeanFactory.getModelManager().getProviderCommon(providerID)); 
     117                return filterEmail(emailIDs, EJBBeanFactory.getModelManager().getHarvesterConfiguration(providerID)); 
    81118        } 
    82119         
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/dictionary/ServiceConfigurationParameter.java

    r7319 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.dictionary; 
    214 
     15/** 
     16 * Contains the reference names for some configuration paramters 
     17 *  
     18 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     19 */ 
    320public enum ServiceConfigurationParameter { 
     21        /** The root path where are stored the harvested directory */ 
    422        HARVEST_ROOT_PATH, 
     23        /** Mail message to be sent when a new Harvest process starts */ 
    524        NEW_DISPATCHED_HARVEST_MAIL, 
     25        /** Mail message to be sent when a Harvest process ends */ 
    626        HARVEST_TERMINATED_MAIL, 
     27        /** The system command to start a new ingest process */  
    728        DO_INGEST_CMD, 
     29        /** Mail message to be sent when a new ingest process has been submitted */ 
    830        NEW_DISPATCHED_INGEST_MAIL, 
     31        /** Mail message to be sent when an ingest process starts */     
    932        DO_INGEST_PROCESS_START, 
     33        /** Mail message to be sent when an ingest process endss */      
    1034        DO_INGEST_PROCESS_TERMINATED_EMAIL, 
     35        /** Mail message to be sent when an process fails */     
    1136        PROCESS_FAILED_EMAIL 
    1237} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/AsyncProcessManager.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.ejb; 
    214 
     
    1022import ndg.services.revitalization.harvest.ejb.interfaces.AsyncProcessManagerRemote; 
    1123 
     24/** 
     25 * Starts an {@link InvokeProcess} in an asynchronous way 
     26 *  
     27 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     28 */  
    1229@Stateless(name="ejb/AsyncProcessManager") 
    1330public class AsyncProcessManager implements AsyncProcessManagerLocal, AsyncProcessManagerRemote { 
    1431 
     32        /**  
     33         * Invokes the process  
     34         * @param process the to invoke  
     35         * */ 
     36        @Override 
    1537        @Asynchronous 
    1638        public final void invoke(InvokeProcess process) {                
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/DPWS.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.ejb; 
    214 
     
    416import javax.jws.WebMethod; 
    517import javax.jws.WebParam; 
     18import javax.jws.WebResult; 
    619import javax.jws.WebService; 
     20import javax.jws.soap.SOAPBinding; 
     21import javax.jws.soap.SOAPBinding.Style; 
     22import javax.jws.soap.SOAPBinding.Use; 
    723 
    824import ndg.services.revitalization.ejb.interfaces.DPWSLocal; 
     
    3551import ndg.services.schemas.revitalization.GetProviderDetailsResponse; 
    3652 
     53import org.jboss.wsf.spi.annotation.WebContext; 
     54 
    3755/** 
    3856 * Session Bean implementation class DPWS 
     57 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>   
    3958 */ 
     59//@RolesAllowed("OPERATOR") 
     60/* 
     61@PermitAll 
     62@SecurityDomain("discoveryDomain") 
     63@WebContext(contextRoot="/discovery", urlPattern="/dpws" ,authMethod="CLIENT-CERT", transportGuarantee="CONFIDENTIAL", secureWSDLAccess=false) 
     64*/ 
    4065@WebService 
    4166@Stateless(name="dpws") 
     67@WebContext(contextRoot="/discovery", urlPattern="/dpws") 
    4268public class DPWS implements DPWSRemote, DPWSLocal { 
    4369         
     
    4874        } 
    4975 
     76         
    5077        @WebMethod(operationName="getStatusProcess") 
    5178        public GetProcessStatusResponse getUsageStats(@WebParam(name="request") GetProcessStatusRequest request) { 
     
    5582 
    5683        @WebMethod(operationName="getList") 
    57         public GetListResponse getListType(@WebParam(name="request") GetListType request) { 
     84        public GetListResponse getList(@WebParam(name="request")GetListType request) { 
    5885                ServiceExecutor<GetListType, GetListResponse> executor = new ExecuteGetList(); 
    5986                return executor.doService(request); 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/JMSDispatcher.java

    r7271 r7360  
    1313import javax.jms.Session; 
    1414 
    15 import ndg.services.revitalization.ejb.interfaces.JMSDispatcherLocal; 
    16 import ndg.services.revitalization.ejb.interfaces.JMSDispatcherRemote; 
     15import ndg.common.ejb.JMSDispatcherLocal; 
     16import ndg.common.ejb.JMSDispatcherRemote; 
    1717 
    1818/** 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/MailDispatcher.java

    r7282 r7360  
    1414import javax.mail.internet.MimeMessage; 
    1515 
    16 import ndg.services.revitalization.ejb.interfaces.MailDispatcherLocal; 
    17 import ndg.services.revitalization.ejb.interfaces.MailDispatcherRemote; 
     16import ndg.common.ejb.MailDispatcherLocal; 
     17import ndg.common.ejb.MailDispatcherRemote; 
    1818 
    1919/** 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/ModelManager.java

    r7316 r7360  
    4040        private final static String GET_SERVICE_PARAMETER_VALUES = "select p.serviceParameterValues from ServiceParameter p where p.name=:parName"; 
    4141        private final static String GET_CONFIGURATION_PARAMETER = "from ServiceConfig p where p.id=:id"; 
    42         private final static String GET_PROVIDER_COMMON = "from ProviderCommon p where p.id=:id"; 
     42        private final static String GET_PROVIDER_COMMON = "from ProviderCommon p"; 
     43        private final static String GET_PROVIDER_COMMON_BY_ID = "from ProviderCommon p where p.id=:id"; 
    4344        private final static String GET_OAI_PROVIDER = "from OaiProvider p where p.id=:id"; 
    4445        private final static String GET_CSW_PROVIDER = "from CswProvider p where p.id=:id"; 
     
    9495                Query query = null; 
    9596                if (Double.isNaN(providerId)) { 
     97                        query = em.createQuery(GET_HARVEST_LOG_ALL_PROVIDER); 
     98                } else { 
    9699                        query = em.createQuery(GET_HARVEST_LOG_BY_PROVIDER); 
    97100                        query.setParameter("providerID", providerId); 
    98                 } else { 
    99                         query = em.createQuery(GET_HARVEST_LOG_ALL_PROVIDER); 
    100101                } 
    101102 
     
    155156 
    156157        @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) 
    157         public <T extends ProviderCommon> void createNewProvider(T provider) { 
     158        public <T extends ProviderCommon> T createNewProvider(T provider) { 
    158159                if (provider.getId() == null) { 
    159160                        em.persist(provider); 
     
    173174                        } 
    174175                } 
    175                 em.merge(provider); 
     176                return em.merge(provider); 
    176177        } 
    177178 
     
    192193         
    193194        public ProviderCommon getProviderCommon(int commonId) { 
    194                 Query query = em.createQuery(GET_PROVIDER_COMMON); 
     195                Query query = em.createQuery(GET_PROVIDER_COMMON_BY_ID); 
    195196                query.setParameter("id", commonId); 
    196197                List<ProviderCommon> values = query.getResultList(); 
     
    228229        public List<? extends ProviderCommon> getHarvesterConfiguration(List<Integer> commonIDs) { 
    229230                List<ProviderCommon> ret = new ArrayList<ProviderCommon>(); 
    230                 if (commonIDs == null || commonIDs.size() == 0) 
    231                         return ret; 
     231                if (commonIDs == null || commonIDs.size() == 0) { 
     232                        Query query = em.createQuery(GET_PROVIDER_COMMON); 
     233                        return query.getResultList();                    
     234                } 
    232235                ProviderCommon provider = null; 
    233236                for (Integer id : commonIDs) { 
     
    248251        } 
    249252 
     253         
    250254} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/interfaces/ModelManagerLocal.java

    r7316 r7360  
    4141        public List<HiProcess> getHiProcess(List<Integer> processIDs); 
    4242         
    43         public <T extends ProviderCommon> void createNewProvider(T provider); 
     43        public <T extends ProviderCommon> T createNewProvider(T provider); 
    4444         
    4545        public String getConfigurationParameter(ServiceConfigurationParameter param); 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/interfaces/ModelManagerRemote.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.ejb.interfaces; 
     14 
    215import java.sql.Timestamp; 
    316import java.util.List; 
     
    1225import ndg.services.revitalization.jpa.ProviderCommon; 
    1326 
     27/** 
     28 * Public interface for the access to the DPWS data model  
     29 *  
     30 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     31 **/ 
    1432@Remote 
    1533public interface ModelManagerRemote { 
     
    3048        public List<String> getServiceParameterNamesValues(String parName); 
    3149         
     50        /** 
     51         * Advances an {@link HiProcess} to the proper status. 
     52         * @param hiProcess the process to promote 
     53         * @param harvestLog the log harvesting file  
     54         **/ 
    3255        public void updateHarvestingLogAndStatus(HiProcess hiProcess, HarvestLog harvestLog); 
    3356         
     57        /** 
     58         * Returns the harvesting log relative to a <code>List</code> of given processes. 
     59         * @param processIds the processes IDs 
     60         * @return a list of logs  
     61         **/     
    3462        public List<HarvestLog> getHarvestLog(List<Integer> processIds); 
    3563         
     64        /** 
     65         * Returns the logs relative of a given {@link ProviderCommon} during a specified interval of time 
     66         * @param start the earlier date of a log 
     67         * @param end the latter date of a log  
     68         * @param providerId the provider code  
     69         * @return a list of ProviderLogs 
     70         **/     
    3671        public List<ProviderLogs> getHarvestByProvider(Timestamp start, Timestamp end, int providerId); 
    3772         
     73        /** 
     74         * Returns the ingesting log relative to a <code>List</code> of given processes. 
     75         * @param processIds the processes IDs 
     76         * @return a list of ingest logging 
     77         **/     
    3878        public List<IngestSearchLogging> getIngestLogs(List<Integer> processIds); 
    3979         
     80        /** 
     81         * Creates a new process, associated with a given {@link ProviderCommon},  
     82         * to which refer harvesting/ingesting operations. 
     83         * @param providerID the provider 
     84         * @return a list of logs  
     85         **/     
    4086        public HiProcess createNewProcess(int providerID); 
    4187         
     88        /** 
     89         * Returns status relative to a <code>List</code> of given processes. 
     90         * @param processIds the processes IDs 
     91         * @return a list of processes 
     92         **/     
    4293        public List<HiProcess> getHiProcess(List<Integer> processIDs); 
    4394         
    44         public <T extends ProviderCommon> void createNewProvider(T provider); 
     95        /** 
     96         * Creates a new specific {@link CommonProvider}. 
     97         * @param the specific instance to persist 
     98         * @return the persisted object filled with the assigned ID 
     99         **/     
     100        public <T extends ProviderCommon> T createNewProvider(T provider); 
    45101         
     102        /** 
     103         * Returns one configuration parameter. 
     104         * @param the configuration name 
     105         * @return the parameter value, <code>null</code> if the parameter is not found 
     106         **/     
    46107        public String getConfigurationParameter(ServiceConfigurationParameter param); 
    47108         
     109        /** 
     110         * Returns the configuration of a Harverster. 
     111         * @param commonID the providerID  
     112         * @return the provider configuration 
     113         **/     
    48114        public <T extends ProviderCommon> T getHarvesterConfiguration(int commonID); 
    49115         
     116         
     117        /** 
     118         * Returns a <code>List</code> of configurations for the given providerIDs 
     119         * @param commonIDs the provider's IDs 
     120         * @return the providers configuration 
     121         **/     
    50122        public List<? extends ProviderCommon> getHarvesterConfiguration(List<Integer> commonIDs); 
    51          
    52         public ProviderCommon getProviderCommon(int commonId); 
    53123         
    54124        /** 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/ExecuteDoNewProvider.java

    r7316 r7360  
    9292                //updates the common fields 
    9393                prepareCommonProvider(pdetails, provider);               
    94                 EJBBeanFactory.getModelManager().createNewProvider(provider); 
     94                prepareResponse(EJBBeanFactory.getModelManager().createNewProvider(provider)); 
    9595        } 
     96         
     97        private void prepareResponse(ProviderCommon ret) throws NdgExecutionException{ 
     98                ProviderDetail pd = getOf().createProviderDetail(); 
     99                getResponse().setProvider(pd); 
     100                 
     101                ProviderCommonType pct = getOf().createProviderCommonType(); 
     102                pd.setProviderCommon(pct); 
     103                 
     104                pd.setProviderID(ret.getId()); 
     105                pct.setProviderName(ret.getName()); 
     106                pct.setProviderURL(ret.getBaseUrl());            
     107                extractProviderEmails(pct, ret);                 
     108                ProviderAdapterHelper helper = ProviderAdapterHelper.getProviderAdapter(ret.getClass()); 
     109                pd.setProviderType(helper.extractDetails(ret, getOf()));                         
     110        } 
     111         
     112        private void extractProviderEmails(ProviderCommonType common, ProviderCommon provider) {                 
     113                if (common.getProviderContacts() == null) 
     114                        return; 
     115                 
     116                List<ProviderEmail> contacts = provider.getProviderEmails(); 
     117                 
     118                if (contacts.size() == 0) 
     119                        return; 
     120                 
     121                //Contact email 
     122                EmailContactType email = null; 
     123                ProviderAdminEmail adminEmail = null; 
     124                for (ProviderEmail item : contacts){ 
     125                        email = getOf().createEmailContactType(); 
     126                         
     127                        if (item.getAdminEmail()) { 
     128                                adminEmail = getOf().createProviderCommonTypeProviderAdminEmail(); 
     129                                adminEmail.setMonitor(provider.getEmailToAdmin()); 
     130                                adminEmail.setEmailContact(email); 
     131                        } 
     132                         
     133                        email.setEmail(item.getEmail()); 
     134                        email.setName(item.getRealName()); 
     135                        email.setID(item.getId()); 
     136                        common.getProviderContacts().add(email); 
     137                } 
     138        }        
    96139} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/ExecuteHarvest.java

    r7316 r7360  
    44 
    55import ndg.common.NdgMessage; 
     6import ndg.common.ejb.JMSDispatcherRemote; 
    67import ndg.common.exception.NdgExecutionException; 
    78import ndg.services.revitalization.EJBBeanFactory; 
    89import ndg.services.revitalization.MailHelper; 
    9 import ndg.services.revitalization.ejb.interfaces.JMSDispatcherRemote; 
    1010import ndg.services.revitalization.ejb.interfaces.ModelManagerRemote; 
    1111import ndg.services.revitalization.exception.NdgHarvestNotExistingException; 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/ServiceExecutor.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.executor; 
    214 
    315import ndg.common.MessageFormatter; 
    416import ndg.common.exception.NdgExecutionException; 
     17import ndg.services.revitalization.ejb.DPWS; 
    518import ndg.services.schemas.revitalization.ConfirmationType; 
    619import ndg.services.schemas.revitalization.ObjectFactory; 
     
    922import org.apache.log4j.Logger; 
    1023 
     24/** 
     25 * Generalizes the exploiting the requests for the {@link DPWS} webservice. 
     26 *  
     27 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     28 */ 
    1129public abstract class ServiceExecutor<Y, T extends ResponseType> { 
    1230 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/harvest/HarvestRequest.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.harvest; 
    214 
     
    618 
    719/** 
    8  * Represents an Harvest request 
     20 * Represents an Harvest request. This object contains only the elements which are supposed 
     21 * to be in common among all the possible specific implementations. 
     22 *  
     23 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
    924 **/ 
    1025public class HarvestRequest implements Serializable { 
     
    1429         */ 
    1530        private static final long serialVersionUID = 4539301981210054562L; 
     31        /** The provider identificator */ 
    1632        final private int providerID; 
     33        /** The provider URL */ 
    1734        final private String url; 
    1835         
     
    2340        } 
    2441 
     42        /** 
     43         * Returns the id that the application associates to this provider. Usually this id 
     44         * is supported by a DB providing the necessary persistence system. 
     45         * @return the provider id  
     46         **/ 
    2547        public int getProviderID() { 
    2648                return providerID; 
    2749        } 
    2850 
     51        /** 
     52         * Returns the URL that the application associates to this provider. Usually this URL 
     53         * is part of a more general configuration parameters, stored in a DB providing the necessary persistence system. 
     54         * @return the provider address  
     55         **/     
    2956        public String getUrl() { 
    3057                return url; 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/harvest/Harvester.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.harvest; 
    214 
     
    416 
    517import ndg.services.revitalization.InvokeProcess; 
     18import ndg.services.revitalization.harvest.ejb.interfaces.AsyncProcessManagerLocal; 
     19import ndg.services.revitalization.harvest.ejb.interfaces.AsyncProcessManagerRemote; 
    620 
     21/** 
     22 * Represents an Harvester provider. While the {@link #getHarvestRequest()} method is supposed  
     23 * to be used in the initialization of the class, inheriting from the {@link InvokeProcess} 
     24 * allow this interface to be seam less injected into a process processor 
     25 *  
     26 * @see {@link AsyncProcessManagerLocal}, {@link AsyncProcessManagerRemote}  
     27 * @author Maurizio Nagni <maurizio.nagni@stcf.ac.uk> 
     28 **/ 
    729public interface Harvester<T extends HarvestRequest> extends Serializable, InvokeProcess { 
     30         
     31        /** 
     32         * Returns a {@link HarvestRequest} instance containing the request parameters 
     33         * to initialize this instance  
     34         * @return a specific <code>HarvestRequest</code> instance  
     35         **/ 
    836        public T getHarvestRequest(); 
    937} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/harvest/HarvesterBase.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.harvest; 
    214 
     
    1022import ndg.services.revitalization.EJBBeanFactory; 
    1123import ndg.services.revitalization.MailHelper; 
     24import ndg.services.revitalization.harvest.oai.OAIHarvester; 
    1225import ndg.services.revitalization.jpa.HarvestLog; 
    1326import ndg.services.revitalization.jpa.HiProcess; 
    1427 
     28/** 
     29 * Abstract implementation of an {@link Harvester}. The main component is represented by the impementation  
     30 * of the {@link #invoke()} method which manages the real harvesting operation. 
     31 *  
     32 * @see OAIHarvester 
     33 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     34 **/ 
    1535public abstract class HarvesterBase<T extends HarvestRequest> implements Harvester<T>{ 
    1636 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/harvest/ejb/interfaces/AsyncProcessManagerLocal.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.harvest.ejb.interfaces; 
    214 
     
    517import ndg.services.revitalization.InvokeProcess; 
    618 
     19/** 
     20 * Starts an {@link InvokeProcess} in an asynchronous way 
     21 *  
     22 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     23 */  
    724@Local 
    825public interface AsyncProcessManagerLocal { 
    926 
    1027        /**  
    11          * Invokes the a process  
     28         * Invokes the process  
     29         * @param process the to invoke  
    1230         * */ 
    1331        public void invoke(InvokeProcess process); 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/harvest/ejb/interfaces/AsyncProcessManagerRemote.java

    r7316 r7360  
     1/* 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) 
     4 * All rights reserved. 
     5 
     6 * See the LICENSE file in the source distribution of this software for 
     7 * the full license text.        
     8 * Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council). 
     9 * This software may be distributed under the terms of the 
     10 * Q Public License, version 1.0 or later. 
     11 * http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt 
     12 */ 
    113package ndg.services.revitalization.harvest.ejb.interfaces; 
    214 
     
    517import ndg.services.revitalization.InvokeProcess; 
    618 
     19/** 
     20 * Starts an {@link InvokeProcess} in an asynchronous way 
     21 *  
     22 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
     23 */  
    724@Remote 
    825public interface AsyncProcessManagerRemote { 
    926 
    1027        /**  
    11          * Invokes the a process  
     28         * Invokes the process  
     29         * @param process the to invoke  
    1230         * */ 
    1331        public void invoke(InvokeProcess process); 
Note: See TracChangeset for help on using the changeset viewer.