generalize exception handling -- add cause detail
Changes to setReplicationStatus and isNodeAuthorized(), working out minor bugs in replication.
include exception cause when throwing new exception (combine RuntimeException in Exception handling -- they are almst identical)
throw InvalidToken when session is null
correct typo
Send the correct node id (the target node) when calling setReplicationStatus()
get pid from normal params, not the URL -- the client should include them in the params -- and not as a serialized "object" since it is just a string value
check obsoletes and obsoletedBy PIDs when updating objects
delete system metadata when MN.delete() is called.
throw InvalidToken when there is no session (certificate) provided in update() and delete() methods.
Calls to setReplicationStatus() can only be made by a CN or the MN that is the target replica node. Implement this service restriction in CNodeService using CertificateManager's equalsDN() method.
The ReplicationStatus parameter is 'status', not 'replicationStatus', in the architecture documentation.
Although parameters for setReplicationStatus() are expected as multipart/form-data fields, they seem to be added to the HttpServletRequest as URL parameters during the proxy forwarding in d1_cn_rest_proxy. Test for their existence as multipart fields, but fall back to request params, otherwise, throw an InvalidRequest exception.
lookup stylesheet from metacat.properties for CN list objects and list formats. This is used in conjunction with the CN rest service deployment where the xslt is actually kept.
actually persist the MN id value to the properties file
set the newly assigned MN id after we call CN.register().
Added stack trace debugging for CNodeService.isNodeAuthorized() for tracking down replication issues.
DataONE MN registration/configuration is now its own configuration page in the admin interface.http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5531
Since we're using a multipart form to encode parameters, extract the params out of the multipart form prior to doing a get() from the multipartparams map in setReplicationStatus(). Likewise, do the same in updateReplicationMetadata() and setReplicationPolicy().
Use a session object that is set to null when calling CNode.setReplicationStatus()
Add debugging code to MNodeService.getReplica().
Set a new Session object to null, to be overwritten by the CertificateManager session information from the X.509 certificate.
more changes for http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5527
get server param only when it is expected
check replication table (not keystore) for trusted server host name match
Fix cast to List<Node> in isNodeAuthorized().
List the correct REST endpoints for replication in the documentation.
upgrade to 1.0.1-SNAPSHOT DataONE jars
started replication unit test
Keep /dirtySystemMetadata as the REST endpoint for systemMetadataChanged() for now.
add note about alternative methods for getting cert/key
use prepared statement place holder (?)
use DateTimeMarshaller for all replication date transfers
print the stacktrace when there is an error -- debuggin!
use SSL to get content from stream
Update methods in MNodeService to reflect they modifications of the MN API with regard to exceptions being raised. Largely removed InvalidRequest from a number of methods, and instead threw an appropriate NotFound or ServiceFailure instead.
D1NodeService get(), getSystemMetadata(), and isAuthorized() no longer throw InvalidRequest.
uses prepared statement instead of plain old statement.deprecated the DBConnection.createStatement() method to discourage direct parameter value use in favor of parameter binding.http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5527
Fix getReplica() handling code for getReplica() and systemMetadataChanged(). Calls to getReplica() in MNode were calling get(), so the lack of resource handling was being missed.
Handle multipart params where the libclient methods are using them.
uses prepared statement parameter binding for querieshttp://bugzilla.ecoinformatics.org/show_bug.cgi?id=5527
Add in the systemMetadataChanged() method in MNodeService to respond to notifications. Only allow subjects from CNs listed in the node list to make the call. Update the local copy of the system metadata document for the given pid.
Include the serialVersion in the call to CN.setReplicationStatus() after replicating data.
correctly set the prepared statement parameters for start and end date
make MNodeServiceTest pass JUnit testing
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5527
Update CNodeService to use the serialVersion parameter and compare it to the current serialVersion of the system metadata found in the hzSystemMetadata map. Throw an InvalidRequest exception if they are not equal. This affects updateReplicationMetadata(), setReplicationStatus(), setReplicationPolicy(), setAccessPolicy(), and setOwner().
Handle calls to CNReplication REST services. Modify handle() to field calls to /replicaPolicies, /replicaMetadata, /replicaAuthorizations, and /replicaNotifications. Add the isNodeAuthorized(), setReplicationPolicy(), setReplicationStatus(), and updateReplicationMetadata() methods to parse and pass multipart form data and params on to the CNodeService implementing class....
Add support for the various CNReplication calls. Add collectReplicationPolicy() to parse the policy out of the multipart form, and collectReplicaMetadata() to parse out the replica to be updated.
skip verification -- remaining TODO
verify certificate
inspect keystore entries for matching client certificate
lookup the correct property for keystore file
use HttpClient to set up SSL connection when doing replication calls -- this will use the server's configured certificate as the client certificate on the request. The server it is calling can then inspect that certificate and decide whether or not it trusts the caller.
check client-provided certificate when servicing ReplicationServlet requests.
Add updateReplicationMetadata() to the CN service implementation. This was missing from the API, and likely never called. It fully replaces the given replica item in the list of replicas in system metadata.
getReplica() should log replication events as DataONE Types.Event.replicate (vs 'getreplica')
Minor indentation cleanup.
Modify isAuthorized() to get the most up to date system metadata from the hzSystemMetadata map.
Add a placeholder setAccessPolicy() method in MNodeService that throws NotImplemented since this method is being deprecated. Note: need to confirm that this shouldn't be calling D1Client.getCN().setAccessPolicy().
Update getSystemMetadata() to lock(); get(); unlock() to ensure we have the latest version of system metadata from the hzSystemMetadata map. Remove the setAccessPolicy() method since it is being deprecated in the MNAuthorization API.change insertSystemMetadata() to use a finer grained Date object on insertion. Locking of the pid happens in the subclass prior to the insert.
Add setAccessPolicy() to CNodeService since the CN should only make changes to access policies for objects registered with the D1 system. Increment the serial version after locling and getting the most up to fdate system metadata. Note: CCIT meeting decision says the serial version of the system metadata (during the change) should equal the current serial version, but setAccessPolicy() does not pass in the entire system metadata object, so there's no way to check. For now, increment the latest system metadata from the hzSystemMetadata map.
In CNodeService, separate the CN.create() functionality from the MN.create() functionality while still using the superclass to call create(). Deal with Hazelcast locks and setting serial versions only in the CN implementation.
Change updateSystemMetadata() to evaluate the incoming system metadata serial version against that found in the hzSystemMetadata map. If they are the same, do the update. If not, throw an InvalidRequest explaining that they need the most current version.
Modify CNodeService's registerSystemMetadata() with support for SystemMetadata's serialVersion field. Also, use the hzSystemMetadata map for all system metadata reads using a lock on the pid in order to get the very latest version. This affected isNodeAuthorized(), getChecksum(), and assertRelation(). Since we're using Hazelcast, exceptions are masked as RuntimeException, so throw a ServiceFailure with the underlying message.
Modify CNodeService's updateSystemMetadata(), setReplicationStatus(), setReplicationPolicy(), and setOwner() with support for SystemMetadata's serialVersion field. Other methods still pending an update. Use the hzSystemMetadata map for all system metadata reads using a lock on the pid in order to get the very latest version.
SystemMetadataManager's functionality is handled by IdentifierManager. Removing it and it's test.
MetadataTypeRegister is now replaced by ObjectFormatService. Removing it and it's test.
include clearer error message when UPDATE action is requested on a replicated document and we fail to successfully get a lock from the source Metacat serverhttp://bugzilla.ecoinformatics.org/show_bug.cgi?id=4907
move the DataONE 1.0.0-SNAPSHOT
correctly check for missing config values during geoserver configuration
Configure and use CertificateManager in order to act as the MN when performing replicate() and getReplica() mthods.
use logging, not system.out
change upgrade scripts/routines to use 2.0.0 version number instead of 1.10.0
make sure we close the prepared statement always
The incoming source node param is just a string, not XML, so don't attempt to deserialize it. Rather, just make a new NodeReference object and set it's value to the value of the incoming param.
add User-Agent logging to support D1 requirements
remove old RestServlet handler -- not used now
Add debugging output to MNodeService.
use default fmtid if we can't find the user-supplied data mime type in our list
including newer d1 libclient that uses Foresite (and Jena) to construct/parse ORE resource maps for DataONE
delete the xml access rules by either docid or guid to make sure we have the most up to date information
Fix a data-typing issue when pulling replicationAllowed from postgres. Use getBoolean(), not getString().
cleaned up to use for populating a DataONE MN using the D1 api. Retrieves packages from a Metacat and generates system metadata for them before calling MN.create() for both data and metadata.NOTE: you need a client certificate that the target server accepts (either DataONE-generated for testing or a CILogon one for more official use). I was only able to get the former certificate type to work with our existing MN servers
IdentifierManager.getSystemMetadata() was missing the number_replicas and replication_allowed fields when building a ReplicationPolicy section of a SystemMetadata document being returned. Add in these two attributes.
update D1 jars to include recent SubjectList -> SubjectInfo refactoring and the SUBJECT_PUBLIC constant
include SystemMetadata when replicating data and metadata documents -- this allows us to establish the guid-to-docid mapping that is crucial for being able to read the replicated document by guid (d1 api)
throw InvalidToken when the Session parameter is null for create()https://redmine.dataone.org/issues/1850
Once a CN calls replicate() on an MN, the MN needs to call getReplica() on the source MN (not get()). Once the bytes are retrieved, the MN must then call back to the CN with setReplicationStatus() to indicate that the replication status is complete. Modify MNodeService to do so.
Bug fix for access control rules coming in from the dataone system metadata. Previously, the code used getLocalId() to get the docid to insert into the XML access table, but that docid included the revision number (e.g., foo.1.1), which it shouldn't. Now use the AccessionNumber class to strip off the rev to get a real docid for insertion into the table.
allow the XML namespace to be given in both double and single quotes. The regex pattern was only looking for xmlns values that were in double quotes. This was brought to light by LTER:http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5497
set date uploaded and date system metadata updated date to current time when calling MN.create() and MN.update()
do not allow system metadata to have obsoletes or obsoletedBy fields when calling the create() method -- these are only allowed for updates so that we do not subvert object versioning by [un]knowingly submitting system metadata that directs one id to another.
set the originating member node on update()
set the originating member node on create()
-use whatever object format id is stored in the DB-only set originating node and authoritative node if we have non-null values for them
set sysmeta submitter based on the subject given in the certificate
skip Objects that have null format ids are invalid checksums
MN.setAccess() is a PUT