Project

General

Profile

« Previous | Next » 

Revision 6803

new jars with many changes -- including new CN methods: ping, describe, listChecksumAlgorithm. Removed MN.setAccessPolicy. Refactored CN.setOwner() to CN.setRightsHolder().

View differences:

D1NodeService.java
57 57
import org.dataone.service.exceptions.UnsupportedType;
58 58
import org.dataone.service.types.v1.AccessPolicy;
59 59
import org.dataone.service.types.v1.AccessRule;
60
import org.dataone.service.types.v1.DescribeResponse;
60 61
import org.dataone.service.types.v1.Event;
61 62
import org.dataone.service.types.v1.Identifier;
62 63
import org.dataone.service.types.v1.Group;
......
79 80
import edu.ucsb.nceas.metacat.IdentifierManager;
80 81
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
81 82
import edu.ucsb.nceas.metacat.MetacatHandler;
83
import edu.ucsb.nceas.metacat.database.DBConnection;
84
import edu.ucsb.nceas.metacat.database.DBConnectionPool;
82 85
import edu.ucsb.nceas.metacat.dataone.hazelcast.HazelcastService;
83 86
import edu.ucsb.nceas.metacat.properties.PropertyService;
84 87
import edu.ucsb.nceas.metacat.replication.ForceReplicationHandler;
......
108 111
	}
109 112
  
110 113
  /**
114
   * This method provides a lighter weight mechanism than 
115
   * getSystemMetadata() for a client to determine basic 
116
   * properties of the referenced object.
117
   * 
118
   * @param session - the Session object containing the credentials for the Subject
119
   * @param pid - the identifier of the object to be described
120
   * 
121
   * @return describeResponse - A set of values providing a basic description 
122
   *                            of the object.
123
   * 
124
   * @throws InvalidToken
125
   * @throws ServiceFailure
126
   * @throws NotAuthorized
127
   * @throws NotFound
128
   * @throws NotImplemented
129
   * @throws InvalidRequest
130
   */
131
  public DescribeResponse describe(Session session, Identifier pid) 
132
      throws InvalidToken, ServiceFailure, NotAuthorized, NotFound, NotImplemented {
133

  
134
    // get system metadata and construct the describe response
135
      SystemMetadata sysmeta = getSystemMetadata(session, pid);
136
      DescribeResponse describeResponse = 
137
      	new DescribeResponse(sysmeta.getFormatId(), sysmeta.getSize(), 
138
      			sysmeta.getDateSysMetadataModified(),
139
      			sysmeta.getChecksum(), sysmeta.getSerialVersion());
140

  
141
      return describeResponse;
142

  
143
  }
144
  
145
  /**
146
   * Low level, "are you alive" operation. A valid ping response is 
147
   * indicated by a HTTP status of 200.
148
   * 
149
   * @return true if the service is alive
150
   * 
151
   * @throws NotImplemented
152
   * @throws ServiceFailure
153
   * @throws InsufficientResources
154
   */
155
  public Date ping() 
156
      throws NotImplemented, ServiceFailure, InsufficientResources {
157

  
158
      // test if we can get a database connection
159
      int serialNumber = -1;
160
      DBConnection dbConn = null;
161
      try {
162
          dbConn = DBConnectionPool.getDBConnection("MNodeService.ping");
163
          serialNumber = dbConn.getCheckOutSerialNumber();
164
      } catch (SQLException e) {
165
      	ServiceFailure sf = new ServiceFailure("", e.getMessage());
166
      	sf.initCause(e);
167
          throw sf;
168
      } finally {
169
          // Return the database connection
170
          DBConnectionPool.returnDBConnection(dbConn, serialNumber);
171
      }
172

  
173
      return Calendar.getInstance().getTime();
174
  }
175
  
176
  /**
111 177
   * Adds a new object to the Node, where the object is either a data 
112 178
   * object or a science metadata object. This method is called by clients 
113 179
   * to create new data objects on Member Nodes or internally for Coordinating

Also available in: Unified diff