Project

General

Profile

« Previous | Next » 

Revision 5015

Added by daigle almost 15 years ago

Create database and shared directories for database management code and shared code respectively.

View differences:

DocumentImpl.java
53 53
import java.util.regex.Matcher;
54 54
import java.util.regex.Pattern;
55 55

  
56
import edu.ucsb.nceas.metacat.service.DatabaseService;
56
import edu.ucsb.nceas.metacat.database.DBConnection;
57
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
58
import edu.ucsb.nceas.metacat.database.DatabaseService;
59
import edu.ucsb.nceas.metacat.replication.ForceReplicationHandler;
60
import edu.ucsb.nceas.metacat.replication.ReplicationService;
57 61
import edu.ucsb.nceas.metacat.service.PropertyService;
58 62
import edu.ucsb.nceas.metacat.service.XMLSchema;
59 63
import edu.ucsb.nceas.metacat.service.XMLSchemaService;
64
import edu.ucsb.nceas.metacat.shared.MetacatUtilException;
60 65
import edu.ucsb.nceas.metacat.spatial.SpatialHarvester;
61 66
import edu.ucsb.nceas.metacat.util.AuthUtil;
62 67
import edu.ucsb.nceas.metacat.util.MetacatUtil;
63 68
import edu.ucsb.nceas.metacat.util.SystemUtil;
64
import edu.ucsb.nceas.metacat.util.MetacatUtilException;
65 69
import edu.ucsb.nceas.utilities.FileUtil;
66 70
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
67 71
import edu.ucsb.nceas.utilities.StringUtil;
......
157 161
    private TreeSet<NodeRecord> nodeRecordList = null;
158 162
  
159 163
    private static Logger logMetacat = Logger.getLogger(DocumentImpl.class);
164
    private static Logger logReplication = Logger.getLogger("ReplicationLogging");
160 165

  
161 166
    /**
162 167
     * Default constructor
......
696 701
         {
697 702
           logMetacat.error("Local rev for docid "+ docid + " could not "+
698 703
                                  " be found because " + e.getMessage());
699
           MetacatReplication.replErrorLog("Docid "+ docid + " could not be "+
704
           logReplication.error("Docid "+ docid + " could not be "+
700 705
                   "written because error happend to find it's local revision");
701 706
           throw new Exception (e.getMessage());
702 707
         }
......
762 767
            //saying that he/she needs to download a new copy of the file and
763 768
            //merge the differences manually.
764 769

  
765
            String server = MetacatReplication
770
            String server = ReplicationService
766 771
                    .getServerNameForServerCode(serverCode);
767
            MetacatReplication.replLog("attempting to lock " + accnum);
772
            logReplication.info("attempting to lock " + accnum);
768 773
            URL u = new URL("https://" + server + "?server="
769 774
                    + MetacatUtil.getLocalReplicationServerName()
770 775
                    + "&action=getlock&updaterev=" + rev + "&docid=" + docid);
771 776
            //System.out.println("sending message: " + u.toString());
772
            String serverResStr = MetacatReplication.getURLContent(u);
777
            String serverResStr = ReplicationService.getURLContent(u);
773 778
            String openingtag = serverResStr.substring(0, serverResStr
774 779
                    .indexOf(">") + 1);
775 780
            if (openingtag.equals("<lockgranted>")) {
776 781
                //the lock was granted go ahead with the insert
777 782
                //System.out.println("In lockgranted");
778
                MetacatReplication.replLog("lock granted for " + accnum
783
            	logReplication.info("lock granted for " + accnum
779 784
                        + " from " + server);
780 785
                flag = true;
781 786
                return flag;
......
788 793
                // and try
789 794
                //again.
790 795
                //System.out.println("file locked");
791
                MetacatReplication.replLog("lock denied for " + accnum + " on "
796
            	logReplication.error("lock denied for " + accnum + " on "
792 797
                        + server + " reason: file already locked");
793 798
                throw new Exception(
794 799
                        "The file specified is already locked by another "
......
802 807
                                                             // copy of the
803 808
                //file and merge his version with the new version.
804 809
                //System.out.println("outdated file");
805
                MetacatReplication.replLog("lock denied for " + accnum + " on "
810
            	logReplication.error("lock denied for " + accnum + " on "
806 811
                        + server + " reason: local file outdated");
807 812
                throw new Exception(
808 813
                        "The file you are trying to update is an outdated"
......
2566 2571
            //DocumentIdentifier id = new DocumentIdentifier(accnum);
2567 2572
            int revision = MetacatUtil.getRevisionFromAccessionNumber(accnum);
2568 2573
            String updaterev = (new Integer(revision)).toString();
2569
            String server = MetacatReplication
2574
            String server = ReplicationService
2570 2575
                    .getServerNameForServerCode(serverCode);
2571
            MetacatReplication.replLog("attempting to lock " + accnum);
2576
            logReplication.info("attempting to lock " + accnum);
2572 2577
            URL u = new URL("https://" + server + "?server="
2573 2578
                    + MetacatUtil.getLocalReplicationServerName()
2574 2579
                    + "&action=getlock&updaterev=" + updaterev + "&docid="
2575 2580
                    + docid);
2576 2581
            //System.out.println("sending message: " + u.toString());
2577
            String serverResStr = MetacatReplication.getURLContent(u);
2582
            String serverResStr = ReplicationService.getURLContent(u);
2578 2583
            String openingtag = serverResStr.substring(0, serverResStr
2579 2584
                    .indexOf(">") + 1);
2580 2585
            if (openingtag.equals("<lockgranted>")) {//the lock was granted go
......
2582 2587
                XMLReader parser = null;
2583 2588
                try {
2584 2589
                    //System.out.println("In lockgranted");
2585
                    MetacatReplication.replLog("lock granted for " + accnum
2590
                	logReplication.info("lock granted for " + accnum
2586 2591
                            + " from " + server);
2587 2592
                    /*
2588 2593
                     * XMLReader parser = initializeParser(conn, action, docid,
......
2636 2641
                // the file is currently locked by another user notify our
2637 2642
                // user to wait a few minutes, check out a new copy and try
2638 2643
                // again.
2639
                MetacatReplication.replLog("lock denied for " + accnum + " on "
2644
            	logReplication.error("lock denied for " + accnum + " on "
2640 2645
                        + server + " reason: file already locked");
2641 2646
                throw new Exception(
2642 2647
                        "The file specified is already locked by another "
......
2647 2652
                // our file is outdated. notify our user to check out a new
2648 2653
                // copy of the file and merge his version with the new version.
2649 2654
                //System.out.println("outdated file");
2650
                MetacatReplication.replLog("lock denied for " + accnum + " on "
2655
            	logReplication.info("lock denied for " + accnum + " on "
2651 2656
                        + server + " reason: local file outdated");
2652 2657
                throw new Exception(
2653 2658
                        "The file you are trying to update is an outdated"
......
2910 2915
                // we need to delete the nodes in xml_ndoes.
2911 2916
                deleteXMLNodes(conn, rootId);
2912 2917
            }
2913
            MetacatReplication.replErrorLog("Failed to " + "create access "
2918
            logReplication.error("Failed to " + "create access "
2914 2919
                    + "rule for package: " + accnum + " because "
2915 2920
                    + ee.getMessage());
2916 2921
            logMetacat.error("Failed to  " + "create access "

Also available in: Unified diff