Project

General

Profile

« Previous | Next » 

Revision 6254

At Ben's suggestion, add metacatUrl to D1NodeService and make it available to subclasses. Set the metacatUrl in the constructor using SystemUtil rather than all roll your own PropertyService calls. More concise. Also, log the delete event in MNodeService.delete().

View differences:

CNodeService.java
91 91
   */
92 92
  public static CNodeService getInstance() { 
93 93
    if (instance == null) {
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 94
    
113
      instance = new CNodeService(metacatUrl);
95
      instance = new CNodeService();
114 96
      
115 97
    }
116 98
  
......
119 101
  
120 102
  /**
121 103
   * Constructor, private for singleton access
122
   * 
123
   * @param metacatUrl - the URL of the metacat service, including the context
124
   *                     and serviceName (/d1)
125 104
   */
126
  private CNodeService(String metacatUrl) {
127
  	super(metacatUrl);
105
  private CNodeService() {
106
  	super();
128 107
    logMetacat = Logger.getLogger(CNodeService.class);
129 108
        
130 109
  }

Also available in: Unified diff