Project

General

Profile

« Previous | Next » 

Revision 6241

Implement [MN|CN]Storage.create() in D1NodeService. Since MetacatHandler requires an IP for event logging, we pass in the metacat URL (hold over from CrudService). To do this in the abstract D1NodeService, change the constructors to take metacatUrl as a parameter and get the URL from the metacat properties file in getInstance() of the subclasses. Needs testing.

View differences:

CNodeService.java
66 66
import edu.ucsb.nceas.metacat.EventLog;
67 67
import edu.ucsb.nceas.metacat.IdentifierManager;
68 68
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
69
import edu.ucsb.nceas.metacat.properties.PropertyService;
69 70
import edu.ucsb.nceas.metacat.replication.ForceReplicationSystemMetadataHandler;
71
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
70 72

  
71 73
/**
72 74
 * Represents Metacat's implementation of the DataONE Coordinating Node 
......
87 89
  /**
88 90
   * singleton accessor
89 91
   */
90
  public static CNodeService getInstance() 
91
  {
92
  public static CNodeService getInstance() { 
92 93
    if (instance == null) {
93
      instance = new CNodeService();
94
    	String metacatUrl = "";
95
      String server;
96
      String port;
97
      String context;
98
      String serviceName;
99
      
100
      try {
101
        server = PropertyService.getProperty("server.name");
102
        port = PropertyService.getProperty("server.httpPort");
103
        context = PropertyService.getProperty("application.context");
104
        serviceName = PropertyService.getProperty("dataone.serviceName");
105
      
106
      } catch (PropertyNotFoundException e) {
107
        throw new RuntimeException("Error getting the servlet url in MNodeService: " + 
108
        	e.getMessage());
109
        
110
      }
111
      metacatUrl = "http://" + server + ":" + port + "/" + context + "/" + serviceName;
112
    
113
      instance = new CNodeService(metacatUrl);
114
      
94 115
    }
95
    
116
  
96 117
    return instance;
97 118
  }
98 119
  
99 120
  /**
100 121
   * Constructor, private for singleton access
122
   * 
123
   * @param metacatUrl - the URL of the metacat service, including the context
124
   *                     and serviceName (/d1)
101 125
   */
102
  private CNodeService() {
103
  	super();
126
  private CNodeService(String metacatUrl) {
127
  	super(metacatUrl);
104 128
    logMetacat = Logger.getLogger(CNodeService.class);
105 129
        
106 130
  }

Also available in: Unified diff