01: package com.sun.portal.search.admin.model;
02:
03: import java.lang.*;
04: import java.util.*;
05: import java.util.logging.Logger;
06: import java.util.logging.Level;
07: import java.io.*;
08:
09: import javax.servlet.http.HttpServletRequest;
10:
11: import com.iplanet.jato.view.*;
12: import com.iplanet.jato.view.html.*;
13: import com.iplanet.jato.model.*;
14: import com.iplanet.jato.util.*;
15:
16: import com.sun.portal.search.soif.*;
17: import com.sun.portal.search.rdm.RDMSchema;
18: import com.sun.portal.search.rdmserver.*;
19: import com.sun.portal.search.util.SearchConfig;
20: import com.sun.portal.search.admin.CSConfig;
21:
22: import com.sun.portal.search.admin.model.*;
23: import com.sun.portal.log.common.PortalLogger;
24:
25: public class PartitionModel extends DefaultModel {
26: private static final int MAX_PART = 15;
27: private static final String MAX_PART_REACHED = "Last Partition Can Not be Deleted ... Abort";
28: private static final String MIN_PART_REACHED = "Maximum Number of Partitions Already Exist ...Abort";
29:
30: private String serverRoot = null;
31:
32: private StringBuffer minidba_part;
33: private StringBuffer minidba_reindex;
34: private StringBuffer minidba_reorg;
35:
36: private String[] partitions = new String[MAX_PART];
37:
38: // Create a Logger for this class
39: private static Logger debugLogger = PortalLogger
40: .getLogger(PartitionModel.class);
41:
42: public PartitionModel() {
43: super ();
44: serverRoot = CSConfig.getServerRoot();
45: }
46:
47: public PartitionModel(String name) {
48: super (name);
49: serverRoot = CSConfig.getServerRoot();
50: }
51:
52: private void doInit() {
53: String defaultCSID = "";
54: String dbname = "";
55: String schema = "";
56: String logdir = "";
57: String rootdb = "";
58:
59: // Get server root and some db related parameters
60: try {
61: RDMConfig rdmconfig = new RDMConfig(serverRoot);
62: } catch (Exception e) {
63: debugLogger.finer("PSSH_CSPSAM0028");
64: }
65:
66: defaultCSID = SearchConfig.getSearchConfig().getDefault();
67: dbname = SearchConfig.getValue(SearchConfig.DBNAME);
68: schema = SearchConfig.getValue(SearchConfig.SCHEMA);
69: logdir = SearchConfig.getValue(SearchConfig.LOGDIR);
70: rootdb = serverRoot + File.separator + "db" + File.separator
71: + "root.db";
72: debugLogger.log(Level.FINER, "PSSH_CSPSAM0029", new String[] {
73: defaultCSID, dbname, schema, logdir, rootdb });
74:
75: minidba_part = new StringBuffer();
76: minidba_part.append("minidba -r ");
77: minidba_part.append(rootdb);
78: minidba_part.append(" -d rootdb dump 2>> logs/minidba.log");
79:
80: minidba_reorg = new StringBuffer();
81: minidba_reindex = new StringBuffer();
82: }
83:
84: public void doWork(String loc1, String loc2) throws Exception {
85: int partitionCount = 0, change = 0;
86:
87: if (partitionCount >= MAX_PART) {
88: debugLogger.log(Level.FINER, "PSSH_CSPSAM0030",
89: MAX_PART_REACHED);
90: throw new Exception(MAX_PART_REACHED);
91: }
92:
93: partitions[change] = loc2;
94: }
95:
96: public void doUpdate() {
97: }
98: }
|