Changeset 7625


Ignore:
Timestamp:
19/10/10 08:29:41 (9 years ago)
Author:
mnagni
Message:

Implemented a TimerService? to periodically harvest a specific provider. The creation/delete/information request has been defined in specific WS methods.

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

Legend:

Unmodified
Added
Removed
  • RevitalizationWS/ws/DPWS/trunk

    • Property svn:ignore
      •  

        old new  
        11target 
         2 
         3.project 
         4 
         5.classpath 
         6 
         7.settings 
  • RevitalizationWS/ws/DPWS/trunk/pom.xml

    r7547 r7625  
    6969                </dependency> 
    7070 
     71 <!-- 
    7172                <dependency> 
    7273                        <groupId>javax</groupId> 
     
    7576                        <scope>provided</scope> 
    7677                </dependency> 
     78-->              
     79                <dependency> 
     80                        <groupId>org.jboss.javaee</groupId> 
     81                        <artifactId>jboss-javaee</artifactId> 
     82                        <version>5.0.1.GA</version> 
     83                        <scope>provided</scope> 
     84                </dependency> 
     85 
     86 
     87 
     88 
    7789 
    7890                <dependency> 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/EJBBeanFactory.java

    r7505 r7625  
    1 /* 
     1/** 
    22 * 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 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
    1231 */ 
    1332package ndg.services.revitalization; 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/MailHelper.java

    r7389 r7625  
    8585                ModelManagerRemote mmr = EJBBeanFactory.getModelManager(); 
    8686                HiProcess process = mmr.getHiProcess(request.getProcessID()); 
     87                 
     88                if (request.getEmailIDs() == null) 
     89                        return; 
     90                 
    8791                List<String> mailTo = filterEmail(request.getEmailIDs(), process.getProviderId()); 
    8892 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/AsyncProcessManager.java

    r7469 r7625  
    1313package ndg.services.revitalization.ejb; 
    1414 
    15 import javax.ejb.Asynchronous; 
     15//To activate when EJB3.1 (JBoss6.0) is available 
     16//import javax.ejb.Asynchronous; 
    1617import javax.ejb.Stateless; 
    1718 
     
    2728 
    2829/** 
    29  * Starts an {@link InvokeProcess} in an asynchronous way 
     30 * Starts an {@link InvokeProcess} in an asynchronous way. Actually does not 
     31 * acts asynchronously because it requires EJB3.1 
    3032 *  
    3133 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk> 
    3234 */ 
    33 @Stateless(name = "ejb/AsyncProcessManager") 
     35@Stateless(mappedName="AsyncProcessManager") 
    3436public class AsyncProcessManager implements AsyncProcessManagerLocal, AsyncProcessManagerRemote { 
    3537 
     
    4143         * */ 
    4244        @Override 
    43         @Asynchronous 
     45        //To activate when EJB3.1 (JBoss6.0) is available 
     46        //@Asynchronous 
    4447        public final void invoke(InvokeProcess process) { 
    4548                try { 
     
    5255        private void manageError(HiProcess hiProcess, NdgExecutionException ex) { 
    5356                try { 
    54                         EJBBeanFactory.getModelManager().updateHarvestingLogAndStatus(hiProcess, null); 
     57                        //EJBBeanFactory.getModelManager().updateHarvestingLogAndStatus(hiProcess, null); 
    5558                        MailHelper.getInstance().sentProcessFailedMail(hiProcess, formatError(hiProcess.getId(), ex)); 
    5659                } catch (NdgExecutionException e) { 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/DPWS.java

    r7389 r7625  
    1 /* 
     1/** 
    22 * 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 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
    1231 */ 
    1332package ndg.services.revitalization.ejb; 
     
    2039import ndg.services.revitalization.ejb.interfaces.DPWSLocal; 
    2140import ndg.services.revitalization.ejb.interfaces.DPWSRemote; 
     41import ndg.services.revitalization.executor.ExecuteAddTimer; 
     42import ndg.services.revitalization.executor.ExecuteDeleteTimer; 
    2243import ndg.services.revitalization.executor.ExecuteDoIngest; 
    2344import ndg.services.revitalization.executor.ExecuteDoNewProvider; 
     
    3051import ndg.services.revitalization.executor.ExecuteHarvest; 
    3152import ndg.services.revitalization.executor.ServiceExecutor; 
     53import ndg.services.schemas.revitalization.AddTimerRequest; 
     54import ndg.services.schemas.revitalization.AddTimerResponse; 
     55import ndg.services.schemas.revitalization.DeleteTimerRequest; 
     56import ndg.services.schemas.revitalization.DeleteTimerResponse; 
    3257import ndg.services.schemas.revitalization.DoHarvestRequest; 
    3358import ndg.services.schemas.revitalization.DoHarvestResponse; 
     
    7095 
    7196        @WebMethod(operationName = "doHarvest") 
     97        @Override 
    7298        public DoHarvestResponse doHarvest(@WebParam(name = "request") DoHarvestRequest request) { 
    7399                ServiceExecutor<DoHarvestRequest, DoHarvestResponse> executor = new ExecuteHarvest(); 
     
    96122        public GetListNamesResponse getListNames() { 
    97123                ServiceExecutor<Object, GetListNamesResponse> executor = new ExecuteGetListNames(); 
    98                 return executor.doService(null); 
     124                return executor.doService(new Object()); 
    99125        } 
    100126 
     
    118144 
    119145        @WebMethod(operationName = "doIngest") 
     146        @Override 
    120147        public DoIngestResponse doIngest(@WebParam(name = "request") DoIngestRequest request) { 
    121148                ServiceExecutor<DoIngestRequest, DoIngestResponse> executor = new ExecuteDoIngest(); 
    122149                return executor.doService(request); 
    123150        } 
     151         
     152        @WebMethod(operationName = "addTimer") 
     153        public AddTimerResponse addTimer(@WebParam(name = "request") AddTimerRequest request) { 
     154                ServiceExecutor<AddTimerRequest, AddTimerResponse> executor = new ExecuteAddTimer(); 
     155                return executor.doService(request); 
     156        } 
     157         
     158        @WebMethod(operationName = "deleteTimer") 
     159        public DeleteTimerResponse deleteTimer(@WebParam(name = "request") DeleteTimerRequest request) { 
     160                ServiceExecutor<DeleteTimerRequest, DeleteTimerResponse> executor = new ExecuteDeleteTimer(); 
     161                return executor.doService(request); 
     162        } 
    124163} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/HiProcessModel.java

    r7505 r7625  
    1313package ndg.services.revitalization.ejb; 
    1414 
     15import java.util.ArrayList; 
    1516import java.util.List; 
    1617 
     
    2930 * Session Bean implementation class HiProcessModel 
    3031 */ 
    31 @Stateless(mappedName = "HiProcessModel") 
     32@Stateless 
    3233public class HiProcessModel implements HiProcessModelLocal { 
    3334 
     
    8283                return (List<HiProcess>) query.getResultList(); 
    8384        } 
     85         
     86        public HiProcess getHiProcess(int processID) { 
     87                List<Integer> id = new ArrayList<Integer>(); 
     88                id.add(processID); 
     89                List<HiProcess> rets = getHiProcess(id); 
     90                return rets.size() > 0 ? rets.get(0) : null; 
     91        } 
    8492} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/JMSConsumer.java

    r7505 r7625  
    1 /* 
     1/** 
    22 * 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 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
    1231 */ 
    1332package ndg.services.revitalization.ejb; 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/JMSDispatcher.java

    r7389 r7625  
     1/** 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
     31 */ 
    132package ndg.services.revitalization.ejb; 
    233 
     
    1849/** 
    1950 * Session Bean implementation class MessageDispatcher 
     51 *  
     52 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
    2053 */ 
    21 @Stateless(mappedName = "JMSDispatcher") 
     54@Stateless(mappedName="JMSDispatcher") 
    2255public class JMSDispatcher implements JMSDispatcherRemote, JMSDispatcherLocal { 
    2356 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/MailDispatcher.java

    r7389 r7625  
     1/** 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
     31 */ 
    132package ndg.services.revitalization.ejb; 
    233 
     
    1950/** 
    2051 * Session Bean implementation class MailDispatcher 
     52 *  
     53 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk>  
    2154 */ 
    22 @Stateless(mappedName = "MailDispatcher") 
     55@Stateless(mappedName="MailDispatcher") 
    2356public class MailDispatcher implements MailDispatcherRemote, MailDispatcherLocal { 
    2457        @Resource(mappedName = "mail/DiscoveryMail") 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/ModelManager.java

    r7505 r7625  
    1 /* 
     1/** 
    22 * 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 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
    1231 */ 
    1332package ndg.services.revitalization.ejb; 
     
    2746import javax.persistence.Query; 
    2847 
     48import ndg.common.ejb.exception.TimerCreationException; 
    2949import ndg.services.revitalization.dictionary.ServiceConfigurationParameter; 
     50import ndg.services.revitalization.ejb.interfaces.HTITimerServiceLocal; 
    3051import ndg.services.revitalization.ejb.interfaces.HiProcessModelLocal; 
    3152import ndg.services.revitalization.ejb.interfaces.ModelManagerLocal; 
     
    4061import ndg.services.revitalization.jpa.ServiceConfig; 
    4162import ndg.services.revitalization.jpa.ServiceParameterValue; 
     63import ndg.services.revitalization.jpa.TimerInfo; 
     64import ndg.services.revitalization.jpa.TimerInfoLog; 
    4265 
    4366/** 
    4467 * Session Bean implementation class ModelManager 
     68 *  
     69 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk> 
    4570 */ 
    46 @Stateless(mappedName = "ModelManager") 
     71@Stateless(mappedName="ModelManager") 
    4772public class ModelManager implements ModelManagerRemote, ModelManagerLocal { 
    4873 
     
    6792        @EJB 
    6893        private HiProcessModelLocal processModel; 
     94         
     95        @EJB 
     96        private HTITimerServiceLocal timerService; 
    6997 
    7098        /* 
     
    223251 
    224252        public HiProcess getHiProcess(Integer processID) { 
    225                         List<Integer> id = new ArrayList<Integer>(); 
    226                         id.add(processID); 
    227                         List<HiProcess> rets = processModel.getHiProcess(id); 
    228                         return rets.size() > 0 ? rets.get(0) : null; 
     253                return processModel.getHiProcess(processID); 
    229254        } 
    230255 
     
    285310 
    286311        @SuppressWarnings("unchecked") 
     312        @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) 
     313        public <T extends TimerInfo> T createNewProviderTimer(T newTimer) throws TimerCreationException { 
     314                        timerService.startTimer(newTimer); 
     315                        return (T)timerService.getTimerInfo(newTimer.getCommonId()); 
     316        } 
     317         
     318        @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) 
     319        public TimerInfoLog deleteProviderTimer(int providerID) { 
     320                        return timerService.deleteProviderTimer(providerID); 
     321        } 
     322         
     323        public void updateTimerInfoLastReqId(int providerID, int lastReqId) { 
     324                timerService.updateTimerInfoLastReqId(providerID, lastReqId); 
     325        } 
     326         
     327        public TimerInfo getTimerInfo(int providerID){ 
     328                return timerService.getTimerInfo(providerID); 
     329        } 
     330         
     331        @SuppressWarnings("unchecked") 
    287332        private <T extends ProviderCommon> T getProvider(int id, String queryText) { 
    288333                        Query query = em.createQuery(queryText); 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/interfaces/DPWSLocal.java

    r7271 r7625  
     1/** 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
     31 */ 
    132package ndg.services.revitalization.ejb.interfaces; 
    233import javax.ejb.Local; 
    334 
     35import ndg.services.schemas.revitalization.DoHarvestRequest; 
     36import ndg.services.schemas.revitalization.DoHarvestResponse; 
     37import ndg.services.schemas.revitalization.DoIngestRequest; 
     38import ndg.services.schemas.revitalization.DoIngestResponse; 
     39 
     40/**   
     41 *  
     42 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk> 
     43 */ 
    444@Local 
    545public interface DPWSLocal { 
    6  
     46        public DoIngestResponse doIngest(DoIngestRequest request); 
     47         
     48        public DoHarvestResponse doHarvest(DoHarvestRequest request); 
    749} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/interfaces/HiProcessModelLocal.java

    r7312 r7625  
    1212        public HiProcess advanceStatus(HiProcess hiProcess); 
    1313        public List<HiProcess> getHiProcess(List<Integer> processIDs); 
     14        public HiProcess getHiProcess(int processID); 
    1415} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/interfaces/ModelManagerLocal.java

    r7469 r7625  
     1/** 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
     31 */ 
     32 
    133package ndg.services.revitalization.ejb.interfaces; 
    234import java.sql.Timestamp; 
     
    1143import ndg.services.revitalization.jpa.IngestSearchLogging; 
    1244import ndg.services.revitalization.jpa.ProviderCommon; 
     45import ndg.services.revitalization.jpa.TimerInfo; 
     46import ndg.services.revitalization.jpa.TimerInfoLog; 
    1347 
     48/**   
     49 *  
     50 * @author Maurizio Nagni <maurizio.nagni@stfc.ac.uk> 
     51 */ 
    1452@Local 
    1553public interface ModelManagerLocal { 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/interfaces/ModelManagerRemote.java

    r7469 r7625  
    1 /* 
     1/** 
    22 * 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 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
    1231 */ 
    1332package ndg.services.revitalization.ejb.interfaces; 
     
    1837import javax.ejb.Remote; 
    1938 
     39import ndg.common.ejb.exception.TimerCreationException; 
     40import ndg.common.ejb.exception.TimerNotExistingException; 
    2041import ndg.services.revitalization.dictionary.ServiceConfigurationParameter; 
    2142import ndg.services.revitalization.executor.ProviderLogs; 
     
    2445import ndg.services.revitalization.jpa.IngestSearchLogging; 
    2546import ndg.services.revitalization.jpa.ProviderCommon; 
     47import ndg.services.revitalization.jpa.TimerInfo; 
     48import ndg.services.revitalization.jpa.TimerInfoLog; 
    2649 
    2750/** 
     
    128151         * */ 
    129152        public HiProcess getHiProcess(Integer processID); 
     153         
     154        /** 
     155         * Creates a new {@link TimerInfo} for the given <code>providerID</code> 
     156         * @param newTimer the new timer 
     157         * @return the persisted {@link TimerInfo} or <code>null</code> if errors occours 
     158         * @throws TimerNotExistingException if the <code>info</code> 
     159         * parameter does not belong to any known timer   
     160         * */ 
     161        public <T extends TimerInfo> T createNewProviderTimer(T newTimer) throws TimerCreationException; 
     162         
     163        /** 
     164         * Deletes a {@link TimerInfo} instance</code> 
     165         * @param providerID the provider id associated with the timer to delete 
     166         * @return the {@link TimerInfoLog} or <code>null</code> if errors occours 
     167         * */ 
     168        public TimerInfoLog deleteProviderTimer(int providerID); 
     169         
     170        /** 
     171         * Returns the {@link TimerInfo} associated with a provider</code> 
     172         * @param providerID the provider id associated with the timer 
     173         * @return the {@link TimerInfo} or <code>null</code> if errors occours 
     174         * */ 
     175        public TimerInfo getTimerInfo(int providerID); 
    130176} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/exception/NdgHarvestNotExistingException.java

    r7389 r7625  
     1/** 
     2 * BSD Licence 
     3 * Copyright (c) 2009, Science & Technology Facilities Council (STFC) All rights reserved. 
     4 * Redistribution and use in source and binary forms, with or without 
     5 * modification, are permitted provided that the following conditions are 
     6 * met: 
     7 * 
     8 *   - Redistributions of source code must retain the above copyright 
     9 *     notice, this list of conditions and the following disclaimer. 
     10 *   - Redistributions in binary form must reproduce the above 
     11 *     copyright notice, this list of conditions and the following disclaimer 
     12 *     in the documentation and/or other materials provided with the 
     13 *     distribution. 
     14 *   - Neither the name of the Science & Technology Facilities Council 
     15 *     (STFC) nor the names of its contributors may be used to endorse or 
     16 *     promote products derived from this software without specific prior 
     17 *     written permission. 
     18 * 
     19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     22 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     23 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     25 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
     29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 *  
     31 */ 
    132package ndg.services.revitalization.exception; 
    233 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/ExecuteGetProviderDetails.java

    r7389 r7625  
    1010import ndg.services.revitalization.jpa.ProviderCommon; 
    1111import ndg.services.revitalization.jpa.ProviderEmail; 
     12import ndg.services.revitalization.jpa.TimerInfo; 
    1213import ndg.services.schemas.revitalization.EmailContactType; 
    1314import ndg.services.schemas.revitalization.GetProviderDetailsRequest; 
     
    6768                                pct.setProviderAdminEmail(pae); 
    6869                        } 
    69                         pd.setProviderType(ProviderAdapter.getInstance().extractDetails(provider, getOf()));                     
     70                        pd.setProviderType(ProviderAdapter.getInstance().extractDetails(provider, getOf())); 
     71                        TimerInfo timerInfo = mm.getTimerInfo(provider.getId()); 
     72                        HTITimerAdapter adapter = new HTITimerAdapter(); 
     73                        pd.setTimerInfo(adapter.modelToResponse(timerInfo));                     
    7074                } 
    7175        } 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/IngesterImpl.java

    r7469 r7625  
    6060        } 
    6161 
     62        private void setHiProcess(HiProcess hiProcess) { 
     63                try { 
     64                        EJBBeanFactory.getModelManager().updateHarvestingLogAndStatus(hiProcess, null); 
     65                } catch (NdgExecutionException e) { 
     66                        e.printStackTrace(); 
     67                }                         
     68        } 
     69         
    6270        private final String errProcMsg = "The process returned an errirID:{0}. \n The standard error stream returned: \n {1}"; 
    6371         
     
    8391                } catch (IOException e) { 
    8492                        //in future a StatePattern could be better 
    85                         getHiProcess().getHiStatus().setId("failed_ingest"); 
     93                        hiProcess.getHiStatus().setId("failed_ingest"); 
     94                        setHiProcess(hiProcess);                         
    8695                        throw new NdgExecutionException(e);      
    8796                } catch (NdgRunTimeProcessException e) { 
    8897                        //in future a StatePattern could be better                       
    89                         getHiProcess().getHiStatus().setId("failed_ingest"); 
     98                        hiProcess.getHiStatus().setId("failed_ingest"); 
     99                        setHiProcess(hiProcess);                         
    90100                        throw new NdgExecutionException(e); 
    91101                } 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/harvest/csw/CSWHarvester.java

    r7529 r7625  
    111111         
    112112        private void extractRecords(InputStream is) throws NdgException { 
    113                 GetRecordsResponseType response; 
     113                GetRecordsResponseType response = null; 
    114114                try { 
    115115                        response = CSWHarvester.manager.unmarshall(is, GetRecordsResponseType.class); 
    116116                } catch (JAXBException e) { 
    117                         throw new NdgExecutionException(e.getMessage(), e); 
     117                        if (e.getLinkedException() != null) 
     118                                throw new NdgExecutionException(e.getLinkedException().getMessage(), e); 
    118119                } 
     120                 
     121                if (response == null) 
     122                        throw new NdgExecutionException("The Provider response message is null"); 
    119123                 
    120124                Iterator<Object> iter = response.getSearchResults().getAny().iterator(); 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/jpa/ProviderCommon.java

    r7503 r7625  
    7979                this.providerEmails = providerEmails; 
    8080        } 
    81  
     81         
    8282        @Override 
    8383        public String toString() { 
Note: See TracChangeset for help on using the changeset viewer.