Changeset 7982 for RevitalizationWS


Ignore:
Timestamp:
16/11/11 13:44:49 (8 years ago)
Author:
mnagni
Message:

Enable the IngesterCommand?

Location:
RevitalizationWS/ws/DPWS/trunk
Files:
3 added
17 edited
1 moved

Legend:

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

    r7925 r7982  
    44        <groupId>ndg.services.dpws</groupId> 
    55        <artifactId>ejb</artifactId> 
    6         <version>1.0.0</version> 
     6        <version>2.0.0</version> 
    77        <packaging>ejb</packaging> 
    88 
     
    2929                        <plugin> 
    3030                                <groupId>org.apache.maven.plugins</groupId> 
    31                                 <artifactId>maven-compiler-plugin</artifactId> 
    32                                 <version>2.3.2</version> 
     31                                <artifactId>maven-compiler-plugin</artifactId>                                                           
    3332                                <configuration> 
    3433                                        <source>1.6</source> 
     
    5958                        <groupId>ndg.services.schemas</groupId> 
    6059                        <artifactId>dataprovider</artifactId> 
    61                         <version>1.0.0</version> 
     60                        <version>1.1.0</version> 
    6261                        <scope>provided</scope> 
    6362                </dependency> 
     
    179178 
    180179                <dependency> 
    181                         <groupId>ndg.services.schemas</groupId> 
    182                         <artifactId>gml</artifactId> 
    183                         <version>3.1.1</version> 
    184                         <scope>provided</scope> 
    185                 </dependency> 
    186  
    187                 <dependency> 
    188180                        <groupId>xerces</groupId> 
    189181                        <artifactId>xercesImpl</artifactId> 
     
    197189                        <version>3.4.0.GA</version> 
    198190                        <scope>provided</scope> 
     191                </dependency> 
     192 
     193                <dependency> 
     194                        <groupId>commons-io</groupId> 
     195                        <artifactId>commons-io</artifactId> 
     196                        <version>2.0.1</version> 
    199197                </dependency> 
    200198 
     
    212210                        <scope>test</scope>                      
    213211                </dependency> 
    214  
    215212        </dependencies> 
    216  
     213         
    217214        <distributionManagement> 
    218                 <snapshotRepository> 
    219                         <id>triton.badc.rl.ac.uk</id> 
    220                         <name>triton.badc.rl.ac.uk-snapshots</name> 
    221                         <url>http://triton.badc.rl.ac.uk:8180/artifactory/libs-snapshots-local</url> 
    222                 </snapshotRepository> 
    223215                <repository> 
    224                         <id>triton.badc.rl.ac.uk</id> 
    225                         <name>triton.badc.rl.ac.uk-release</name> 
     216                        <id>triton.artifactory.central</id> 
     217                        <name>triton.artifactory.central</name>                  
    226218                        <url>http://triton.badc.rl.ac.uk:8180/artifactory/libs-releases-local</url> 
    227                 </repository>    
     219                </repository> 
    228220        </distributionManagement> 
    229221</project> 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/discovery/basic/DiscoveryBasicDPWS.java

    r7925 r7982  
    2323 * @author Maurizio Nagni <maurizio.nagni@stcf.ac.uk> 
    2424 **/ 
    25 public class DiscoveryBasic { 
     25public class DiscoveryBasicDPWS { 
    2626 
    2727        /** The database connection */ 
     
    3535 
    3636        /** The singleton instance */ 
    37         private final static DiscoveryBasic instance = new DiscoveryBasic(); 
     37        private final static DiscoveryBasicDPWS instance = new DiscoveryBasicDPWS(); 
    3838 
    39         private static Logger logger = Logger.getLogger(DiscoveryBasic.class.getName()); 
     39        private static Logger logger = Logger.getLogger(DiscoveryBasicDPWS.class.getName()); 
    4040 
    4141        // Hides the constructor 
    42         private DiscoveryBasic() { 
     42        private DiscoveryBasicDPWS() { 
    4343        } 
    4444 
     
    8181         * @return the singleton instance 
    8282         * */ 
    83         public static final DiscoveryBasic getInstance() { 
     83        public static final DiscoveryBasicDPWS getInstance() { 
    8484                return instance; 
    8585        } 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/AsyncProcessManager.java

    r7908 r7982  
    1717import javax.ejb.Stateless; 
    1818 
    19 import ndg.common.MessageFormatter; 
    2019import ndg.common.exception.NdgExecutionException; 
    21 import ndg.services.revitalization.EJBBeanFactory; 
    2220import ndg.services.revitalization.InvokeProcess; 
    23 import ndg.services.revitalization.MailHelper; 
    24 import ndg.services.revitalization.dictionary.ServiceConfigurationParameter; 
    2521import ndg.services.revitalization.harvest.ejb.interfaces.AsyncProcessManagerLocal; 
    2622import ndg.services.revitalization.harvest.ejb.interfaces.AsyncProcessManagerRemote; 
    27 import ndg.services.revitalization.jpa.HiProcess; 
    2823 
    2924/** 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/DPWS.java

    r7905 r7982  
    3535import javax.jws.WebService; 
    3636 
    37 import org.jboss.wsf.spi.annotation.WebContext; 
    38  
    3937import ndg.services.revitalization.ejb.interfaces.DPWSLocal; 
    4038import ndg.services.revitalization.ejb.interfaces.DPWSRemote; 
    4139import ndg.services.revitalization.executor.ExecuteAddTimer; 
     40import ndg.services.revitalization.executor.ExecuteCreateIngestCommand; 
     41import ndg.services.revitalization.executor.ExecuteDeleteIngestCommand; 
    4242import ndg.services.revitalization.executor.ExecuteDeleteProvider; 
    4343import ndg.services.revitalization.executor.ExecuteDeleteTimer; 
     
    5555import ndg.services.schemas.revitalization.AddTimerRequest; 
    5656import ndg.services.schemas.revitalization.AddTimerResponse; 
     57import ndg.services.schemas.revitalization.CreateIngestCommandResponse; 
     58import ndg.services.schemas.revitalization.DeleteIngestCommandRequest; 
     59import ndg.services.schemas.revitalization.DeleteIngestCommandResponse; 
    5760import ndg.services.schemas.revitalization.DeleteProviderRequest; 
    5861import ndg.services.schemas.revitalization.DeleteProviderResponse; 
     
    7780import ndg.services.schemas.revitalization.GetProviderStatisticRequest; 
    7881import ndg.services.schemas.revitalization.GetProviderStatisticResponse; 
     82import ndg.services.schemas.revitalization.IngestCommandType; 
     83 
     84import org.jboss.wsf.spi.annotation.WebContext; 
    7985 
    8086/** 
     
    161167                ServiceExecutor<GetProviderStatisticRequest, GetProviderStatisticResponse> executor = new ExecuteGetProviderStatistic(); 
    162168                return executor.doService(request); 
    163         }        
     169        } 
     170         
     171        public CreateIngestCommandResponse createIngestCommand(IngestCommandType request) { 
     172                ServiceExecutor<IngestCommandType, CreateIngestCommandResponse> executor = new ExecuteCreateIngestCommand(); 
     173                return executor.doService(request); 
     174        } 
     175         
     176        public DeleteIngestCommandResponse deleteIngestCommand(DeleteIngestCommandRequest request) { 
     177                ServiceExecutor<DeleteIngestCommandRequest, DeleteIngestCommandResponse> executor = new ExecuteDeleteIngestCommand(); 
     178                return executor.doService(request); 
     179        } 
    164180} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/DPWSInterface.java

    r7905 r7982  
    3939import ndg.services.schemas.revitalization.AddTimerRequest; 
    4040import ndg.services.schemas.revitalization.AddTimerResponse; 
     41import ndg.services.schemas.revitalization.CreateIngestCommandResponse; 
     42import ndg.services.schemas.revitalization.DeleteIngestCommandRequest; 
     43import ndg.services.schemas.revitalization.DeleteIngestCommandResponse; 
    4144import ndg.services.schemas.revitalization.DeleteProviderRequest; 
    4245import ndg.services.schemas.revitalization.DeleteProviderResponse; 
     
    6164import ndg.services.schemas.revitalization.GetProviderStatisticRequest; 
    6265import ndg.services.schemas.revitalization.GetProviderStatisticResponse; 
     66import ndg.services.schemas.revitalization.IngestCommandType; 
    6367import net.opengis.gml._311.ObjectFactory; 
    64  
    65 import org.jboss.wsf.spi.annotation.WebContext; 
    6668 
    6769/** 
     
    122124        @WebMethod(operationName = "getProviderStatistic") 
    123125        public GetProviderStatisticResponse getProviderStatistic(@WebParam(name = "request") GetProviderStatisticRequest request); 
     126         
     127        @WebMethod(operationName = "createCommand") 
     128        public CreateIngestCommandResponse createIngestCommand(@WebParam(name = "request") IngestCommandType request); 
     129         
     130        @WebMethod(operationName = "deleteCommand") 
     131        public DeleteIngestCommandResponse deleteIngestCommand(@WebParam(name = "request") DeleteIngestCommandRequest request);          
    124132} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/JMSConsumer.java

    r7909 r7982  
    4747import ndg.common.exception.NdgExecutionException; 
    4848import ndg.services.revitalization.InvokeProcess; 
    49 import ndg.services.revitalization.MailHelper; 
    5049import ndg.services.revitalization.executor.IngesterImpl; 
    5150import ndg.services.revitalization.harvest.HarvestRequest; 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/ModelManager.java

    r7907 r7982  
    3636import java.util.ArrayList; 
    3737import java.util.Calendar; 
    38 import java.util.Collections; 
    3938import java.util.Iterator; 
    4039import java.util.List; 
     
    4847import javax.persistence.Query; 
    4948import javax.xml.namespace.QName; 
    50  
    51 import org.apache.log4j.Logger; 
    5249 
    5350import ndg.common.ejb.exception.TimerCreationException; 
     
    6057import ndg.services.revitalization.executor.ProviderLogs; 
    6158import ndg.services.revitalization.harvest.Harvester; 
    62 import ndg.services.revitalization.harvest.csw.CSWHarvester; 
    6359import ndg.services.revitalization.jpa.CswProvider; 
    6460import ndg.services.revitalization.jpa.HarvestLog; 
    6561import ndg.services.revitalization.jpa.HiProcess; 
     62import ndg.services.revitalization.jpa.IngestCommand; 
    6663import ndg.services.revitalization.jpa.IngestSearchLogging; 
    6764import ndg.services.revitalization.jpa.OaiProvider; 
     
    7471import ndg.services.revitalization.jpa.TimerInfoLog; 
    7572 
     73import org.apache.log4j.Logger; 
     74 
    7675/** 
    7776 * Session Bean implementation class ModelManager 
     
    8887        private final static String GET_PROVIDER_COMMON_BY_ID = "from ProviderCommon p where p.id=:id"; 
    8988        private final static String GET_OAI_PROVIDER = "from OaiProvider p where p.id=:id"; 
    90         private final static String GET_CSW_PROVIDER = "from CswProvider p where p.id=:id"; 
     89        private final static String GET_CSW_PROVIDER = "from CswProvider p where p.id=:id";      
    9190        private final static String GET_INGESTER_HISTORY = "from IngestSearchLogging p where p.id IN (:processIds)"; 
    9291        private final static String GET_HARVEST_HISTORY = "from HarvestLog p where p.reqId IN (:processIds)"; 
     
    395394        public ProviderCommon getProviderCommon(int commonId) { 
    396395                        return em.find(ProviderCommon.class, commonId); 
    397                         /* 
    398                         Query query = em.createQuery(GET_PROVIDER_COMMON_BY_ID); 
    399                         query.setParameter("id", commonId); 
    400                         List<ProviderCommon> values = query.getResultList(); 
    401                         if (values == null || values.size() == 0) { 
    402                                 return null; 
    403                         } 
    404                         return values.get(0); 
    405                         */ 
    406         } 
    407  
     396        } 
     397 
     398        public IngestCommand getIngestCommand(int commandId) { 
     399                return em.find(IngestCommand.class, commandId); 
     400        } 
     401         
    408402        @SuppressWarnings("unchecked") 
    409403        public String getConfigurationParameter(ServiceConfigurationParameter param) { 
     
    484478        } 
    485479         
     480         
     481        @Override 
     482        public void deleteIngestCommand(int commandID) throws NdgExecutionException { 
     483                IngestCommand command = getIngestCommand(commandID); 
     484                em.remove(command);      
     485        } 
     486 
     487        @Override 
     488        public IngestCommand createIngestCommand(IngestCommand command) 
     489                        throws NdgExecutionException { 
     490                em.persist(command); 
     491                return command; 
     492        } 
     493 
    486494        public List<ProviderStatistic> getProviderStatistic(List<Integer> providerID) throws NdgExecutionException { 
    487495 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/discovery/CommonMethods.java

    r7925 r7982  
    1313import ndg.common.exception.NdgSQLException; 
    1414import ndg.common.exception.ResourceNotAvailable; 
    15 import ndg.services.discovery.basic.DiscoveryBasic; 
     15import ndg.services.discovery.basic.DiscoveryBasicDPWS; 
    1616import ndg.services.discovery.basic.DiscoveryDictionary; 
    1717import ndg.services.schemas.revitalization.discovery.OrderByType; 
     
    2323abstract class CommonMethods<T> { 
    2424         
    25         private NdgLogger logHelper = DiscoveryBasic.getInstance().getNdgInstance(CommonMethods.class.getName()); 
     25        private NdgLogger logHelper = DiscoveryBasicDPWS.getInstance().getNdgInstance(CommonMethods.class.getName()); 
    2626         
    2727        /** 
     
    148148 
    149149        MessageFormatter getMsgFormatter() { 
    150                 return DiscoveryBasic.getInstance().getFormatter(); 
     150                return DiscoveryBasicDPWS.getInstance().getFormatter(); 
    151151        } 
    152152         
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/discovery/Discovery.java

    r7925 r7982  
    3737import ndg.services.revitalization.ejb.interfaces.DiscoveryLocal; 
    3838import ndg.services.revitalization.ejb.interfaces.DiscoveryRemote; 
    39 import ndg.services.revitalization.ejb.interfaces.DiscoveryServiceLocal; 
    4039import ndg.services.revitalization.executor.DiscoveryServiceExecutor; 
    4140import ndg.services.schemas.revitalization.discovery.DoPresentReturnType; 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/discovery/DiscoveryInterface.java

    r7925 r7982  
    3535import javax.jws.WebParam; 
    3636import javax.jws.WebService; 
    37 import javax.jws.soap.SOAPBinding; 
    38 import javax.jws.soap.SOAPBinding.ParameterStyle; 
    39 import javax.jws.soap.SOAPBinding.Style; 
    40 import javax.xml.ws.RequestWrapper; 
    4137 
    4238import ndg.services.schemas.revitalization.discovery.DoPresentReturnType; 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/discovery/PresentHelper.java

    r7925 r7982  
    2222import ndg.common.exception.NdgSQLException; 
    2323import ndg.common.exception.ResourceNotAvailable; 
    24 import ndg.services.discovery.basic.DiscoveryBasic; 
     24import ndg.services.discovery.basic.DiscoveryBasicDPWS; 
    2525import ndg.services.discovery.basic.DiscoveryDictionary; 
    2626import ndg.services.discovery.basic.DiscoveryDictionary.OriginalDocumentToTable; 
     
    4949        private final static String temporalRangeSQL = "SELECT start_time, end_time FROM temporal_data WHERE original_document_id = ?"; 
    5050 
    51         private NdgLogger logHelper = DiscoveryBasic.getInstance().getNdgInstance(SearchHelper.class.getName()); 
     51        private NdgLogger logHelper = DiscoveryBasicDPWS.getInstance().getNdgInstance(SearchHelper.class.getName()); 
    5252 
    5353        private List<String> documentsId = new ArrayList<String>(); 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/ejb/interfaces/ModelManagerRemote.java

    r7868 r7982  
    4444import ndg.services.revitalization.jpa.HarvestLog; 
    4545import ndg.services.revitalization.jpa.HiProcess; 
     46import ndg.services.revitalization.jpa.IngestCommand; 
    4647import ndg.services.revitalization.jpa.IngestSearchLogging; 
    4748import ndg.services.revitalization.jpa.ProviderCommon; 
     
    182183         
    183184        public List<ProviderStatistic> getProviderStatistic(List<Integer> providerID) throws NdgExecutionException; 
     185         
     186        /** 
     187         * Returns a single {@link IngestCommand} 
     188         * @param ingestCommandID the IngestCommand ID 
     189         * @return an IngestCommand or <code>null</code> if not exists 
     190         * */ 
     191        public IngestCommand getIngestCommand(int ingestCommandID);      
     192         
     193        public void deleteIngestCommand(int commandID) throws NdgExecutionException; 
     194         
     195        public IngestCommand createIngestCommand(IngestCommand command) throws NdgExecutionException; 
    184196} 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/DiscoveryServiceExecutor.java

    r7925 r7982  
    77import ndg.common.NdgMessage; 
    88import ndg.common.exception.NdgException; 
    9 import ndg.services.discovery.basic.DiscoveryBasic; 
     9import ndg.services.discovery.basic.DiscoveryBasicDPWS; 
    1010import ndg.services.discovery.basic.DiscoveryDictionary; 
    1111import ndg.services.discovery.basic.DiscoveryDictionary.OrderByField; 
     
    3131import ndg.services.schemas.revitalization.discovery.ReturnSimpleType; 
    3232import ndg.services.schemas.revitalization.discovery.ReturnSummaryType; 
    33 import net.opengis.csw._202.SummaryRecordType; 
    3433 
    3534/** 
     
    7372                                                        .getTermSearch().size() == 0))) { 
    7473                                msg = new NdgMessage("empty.searchcriteria", new Object[] {}); 
    75                                 statusMsg = DiscoveryBasic.getInstance().getFormatter().getFormattedText(msg); 
     74                                statusMsg = DiscoveryBasicDPWS.getInstance().getFormatter().getFormattedText(msg); 
    7675                        } else { 
    7776                                try {                                    
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/ExecuteDoIngest.java

    r7907 r7982  
    3434                        throw new NdgExecutionException("The ProcessID cannot be empty"); 
    3535                 
    36                 IngestRequest request = new IngestRequest(doRequest.getProcessID().getId(), doRequest.getEmailReportID());               
     36                IngestRequest request = new IngestRequest(doRequest.getProcessID().getId(),  
     37                                doRequest.getEmailReportID(), doRequest.getIngestCommandId());           
    3738                 
    3839                ModelManagerRemote mmr = EJBBeanFactory.getModelManager(); 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/ExecuteGetIngestHistory.java

    r7505 r7982  
    7070                historyType.setRecordsProcessedSuccessfully(item.getTotalFilesProcessedSuccessfully()); 
    7171                historyType.setRecordsProcessedUnsuccessfully(item.getTotalFilesProcessedUnsuccessfully()); 
     72                historyType.setIngestCommand(item.getIngestCommand());           
    7273                historyType.setProviderID(provLog.getProviderID()); 
    7374                 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/executor/IngesterImpl.java

    r7907 r7982  
    2727import ndg.services.revitalization.harvest.Ingester; 
    2828import ndg.services.revitalization.jpa.HiProcess; 
     29import ndg.services.revitalization.jpa.IngestCommand; 
    2930 
    3031import org.apache.commons.io.FileUtils; 
     
    5051        } 
    5152 
    52         public HiProcess getHiProcess() { 
    53                 HiProcess hiProcess = null; 
     53        public HiProcess getHiProcess() {                
    5454                try { 
    5555                        return EJBBeanFactory.getModelManager().getHiProcess(ingestRequest.getProcessID()); 
     
    5757                        e.printStackTrace(); 
    5858                }  
    59                 return hiProcess;                         
     59                return null;                      
    6060        } 
    6161 
     62        private IngestCommand getIngestCommand() { 
     63                try { 
     64                        return EJBBeanFactory.getModelManager().getIngestCommand(ingestRequest.getIngestCommand()); 
     65                } catch (NdgExecutionException e) { 
     66                        e.printStackTrace(); 
     67                }  
     68                return null;                      
     69        } 
     70         
    6271        private void setHiProcess(HiProcess hiProcess) { 
    6372                try { 
     
    7483                HiProcess hiProcess = null; 
    7584                try { 
     85                        /* Sets the default ingest command */ 
    7686                        String cmd = EJBBeanFactory.getModelManager().getConfigurationParameter( 
    7787                                        ServiceConfigurationParameter.DO_INGEST_CMD); 
     
    8292                                String msg = EJBBeanFactory.getModelManager().getConfigurationParameter(ServiceConfigurationParameter.PROCESS_UNAVAILABLE_EMAIL); 
    8393                                throw new NdgExecutionException(new NdgMessage(msg, new Object[] {hiProcess.getId(), hiProcess.getHiStatus().getId()}, null));   
     94                        } 
     95                         
     96                        /* If defined override the default ingest command */ 
     97                        IngestCommand icmd = getIngestCommand(); 
     98                        if (icmd != null && icmd.getCommand() != null) { 
     99                                cmd = icmd.getCommand(); 
    84100                        } 
    85101                         
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/harvest/IngestRequest.java

    r7389 r7982  
    3030        private final int processID; 
    3131         
     32        private final int ingestCommandID; 
     33         
    3234        private final List<Integer> emailIDs; 
    3335 
    34         public IngestRequest(int processID, List<Integer> emailIDs) { 
     36        public IngestRequest(int processID, List<Integer> emailIDs, int ingestCommandID) { 
    3537                super(); 
    3638                this.processID = processID; 
    3739                this.emailIDs = emailIDs; 
     40                this.ingestCommandID = ingestCommandID; 
    3841        } 
    3942 
     
    4245        } 
    4346 
     47        public int getIngestCommand() { 
     48                return ingestCommandID; 
     49        } 
     50         
    4451        public List<Integer> getEmailIDs() { 
    4552                return emailIDs; 
  • RevitalizationWS/ws/DPWS/trunk/src/main/java/ndg/services/revitalization/jpa/IngestSearchLogging.java

    r7393 r7982  
    3333        private Timestamp startIngest; 
    3434        private Timestamp stopIngest; 
     35        private String ingestCommand;    
    3536        private List<IngestLoggingProblemFile> ingestLoggingProblemFile; 
    3637 
     
    145146                this.totalFilesProcessedUnsuccessfully = totalFilesProcessedUnsuccessfully; 
    146147        } 
     148         
     149        @Column(name="ingest_command")   
     150        public String getIngestCommand() { 
     151                return ingestCommand; 
     152        } 
     153 
     154        public void setIngestCommand(String ingestCommand) { 
     155                this.ingestCommand = ingestCommand; 
     156        } 
    147157 
    148158        @OneToMany(mappedBy="id", cascade={CascadeType.ALL}, fetch=FetchType.EAGER) 
Note: See TracChangeset for help on using the changeset viewer.