Project

General

Profile

« Previous | Next » 

Revision 7439

limit /log and /object calls to configurable maximum count for paging. defaults to existing Metacat value of 7000

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
690 690
        ObjectList objectList = null;
691 691

  
692 692
        try {
693
        	// safeguard against large requests
694
            if (count == null || count > MAXIMUM_DB_RECORD_COUNT) {
695
            	count = MAXIMUM_DB_RECORD_COUNT;
696
            }
693 697
            objectList = IdentifierManager.getInstance().querySystemMetadata(startTime, endTime, objectFormatId, replicaStatus, start, count);
694 698
        } catch (Exception e) {
695 699
            throw new ServiceFailure("1580", "Error querying system metadata: " + e.getMessage());
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
1621 1621
      
1622 1622
      ObjectList objectList = null;
1623 1623
        try {
1624
        	if (count == null || count > MAXIMUM_DB_RECORD_COUNT) {
1625
            	count = MAXIMUM_DB_RECORD_COUNT;
1626
            }
1624 1627
            objectList = IdentifierManager.getInstance().querySystemMetadata(startTime, endTime, formatid, replicaStatus, start, count);
1625 1628
        } catch (Exception e) {
1626 1629
            throw new ServiceFailure("1580", "Error querying system metadata: " + e.getMessage());
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
31 31
import java.io.OutputStream;
32 32
import java.sql.SQLException;
33 33
import java.util.ArrayList;
34
import java.util.Arrays;
35 34
import java.util.Calendar;
36 35
import java.util.Date;
37 36
import java.util.Hashtable;
38 37
import java.util.List;
39 38
import java.util.Set;
40 39
import java.util.Timer;
41
import java.util.Vector;
42 40

  
43 41
import javax.servlet.http.HttpServletRequest;
44 42

  
45

  
46 43
import org.apache.commons.io.IOUtils;
47 44
import org.apache.log4j.Logger;
48 45
import org.dataone.client.CNode;
49 46
import org.dataone.client.D1Client;
50 47
import org.dataone.client.ObjectFormatCache;
51
import org.dataone.service.util.Constants;
52
import org.dataone.service.util.DateTimeMarshaller;
53 48
import org.dataone.service.exceptions.BaseException;
54 49
import org.dataone.service.exceptions.IdentifierNotUnique;
55 50
import org.dataone.service.exceptions.InsufficientResources;
......
64 59
import org.dataone.service.types.v1.AccessRule;
65 60
import org.dataone.service.types.v1.DescribeResponse;
66 61
import org.dataone.service.types.v1.Event;
62
import org.dataone.service.types.v1.Group;
67 63
import org.dataone.service.types.v1.Identifier;
68
import org.dataone.service.types.v1.Group;
69 64
import org.dataone.service.types.v1.Log;
70
import org.dataone.service.types.v1.LogEntry;
71 65
import org.dataone.service.types.v1.Node;
72 66
import org.dataone.service.types.v1.NodeReference;
73 67
import org.dataone.service.types.v1.NodeType;
......
79 73
import org.dataone.service.types.v1.SystemMetadata;
80 74
import org.dataone.service.types.v1.util.AuthUtils;
81 75
import org.dataone.service.types.v1.util.ChecksumUtil;
76
import org.dataone.service.util.Constants;
82 77

  
83 78
import edu.ucsb.nceas.metacat.AccessionNumberException;
84 79
import edu.ucsb.nceas.metacat.DocumentImpl;
......
92 87
import edu.ucsb.nceas.metacat.dataone.hazelcast.HazelcastService;
93 88
import edu.ucsb.nceas.metacat.properties.PropertyService;
94 89
import edu.ucsb.nceas.metacat.replication.ForceReplicationHandler;
95
import edu.ucsb.nceas.metacat.util.DocumentUtil;
96 90
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
97 91

  
98 92
public abstract class D1NodeService {
......
109 103
  private Hashtable<String, String[]> params;
110 104
  
111 105
  /**
106
   * limit paged results sets to a configured maximum
107
   */
108
  protected static int MAXIMUM_DB_RECORD_COUNT = 7000;
109
  
110
  static {
111
		try {
112
			MAXIMUM_DB_RECORD_COUNT = Integer.valueOf(PropertyService.getProperty("database.webResultsetSize"));
113
		} catch (Exception e) {
114
			logMetacat.warn("Could not set MAXIMUM_DB_RECORD_COUNT", e);
115
		}
116
	}
117
  
118
  /**
112 119
   * out-of-band session object to be used when not passed in as a method parameter
113 120
   */
114 121
  protected Session session;
......
487 494
    if ( count == null ) {
488 495
    	count = 1000;
489 496
    }
497
    
498
    // safeguard against large requests
499
    if (count > MAXIMUM_DB_RECORD_COUNT) {
500
    	count = MAXIMUM_DB_RECORD_COUNT;
501
    }
490 502

  
491 503
    String[] filterDocid = null;
492 504
    if (pidFilter != null) {

Also available in: Unified diff