Commit a5a37cfd authored by chiaming2000's avatar chiaming2000
Browse files

Removed incompatible API due to protocol 3.0.0 changes.

parent 485b72ad
Loading
Loading
Loading
Loading
+5 −53
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
 */
package com.seagate.kinetic.admin.impl;

import java.util.ArrayList;
import java.util.List;

import kinetic.admin.ACL;
@@ -26,15 +25,13 @@ import kinetic.admin.Domain;
import kinetic.admin.KineticAdminClient;
import kinetic.admin.KineticLog;
import kinetic.admin.KineticLogType;
import kinetic.admin.Role;

import kinetic.client.ClientConfiguration;
//import kinetic.client.KineticClient;
//import kinetic.client.KineticClientFactory;

import kinetic.client.KineticException;

import com.google.protobuf.ByteString;
//import com.google.protobuf.Message;
//import com.google.protobuf.Message.Builder;

import com.seagate.kinetic.client.internal.MessageFactory;
import com.seagate.kinetic.client.internal.p2p.DefaultKineticP2pClient;
import com.seagate.kinetic.common.lib.HMACAlgorithmUtil;
@@ -222,7 +219,7 @@ public class DefaultAdminClient extends DefaultKineticP2pClient implements Kinet
        }
    }

    @Override
    
    public void setSecurity(List<ACL> acls, byte[] oldLockPin,
           byte[] newLockPin, byte[] oldErasePin, byte[] newErasePin) throws KineticException {

@@ -318,51 +315,6 @@ public class DefaultAdminClient extends DefaultKineticP2pClient implements Kinet

    }
     
    
    private void setPinsWithDeafultAcl(byte[] oldLockPin, byte[] newLockPin,
            byte[] oldErasePin, byte[] newErasePin) throws KineticException {
        
        List<Role> roles = new ArrayList<Role>();
        roles.add(Role.DELETE);
        roles.add(Role.GETLOG);
        roles.add(Role.READ);
        roles.add(Role.RANGE);
        roles.add(Role.SECURITY);
        roles.add(Role.SETUP);
        roles.add(Role.WRITE);
        roles.add(Role.P2POP);

        Domain domain = new Domain();
        domain.setRoles(roles);

        List<Domain> domains = new ArrayList<Domain>();
        domains.add(domain);

        List<ACL> acls = new ArrayList<ACL>();
        ACL acl1 = new ACL();
        acl1.setDomains(domains);
        acl1.setUserId(1);
        acl1.setKey("asdfasdf");

        acls.add(acl1);

        this.setSecurity(acls, oldLockPin, newLockPin, oldErasePin, newErasePin);
    }

    @Override
    public void setup(byte[] oldErasePin, byte[] newErasePin, long newClusterVersion,
            boolean secureErase) throws KineticException {
        
        this.setPinsWithDeafultAcl(null, null, oldErasePin, newErasePin);
        
        if (secureErase) {
            this.instantErase(newErasePin);
        }
        
        this.setClusterVersion(newClusterVersion);
        
    }
    
    @Override
    public void setClusterVersion (long newClusterVersion) throws KineticException {
        
+10 −64
Original line number Diff line number Diff line
@@ -44,31 +44,6 @@ import kinetic.client.p2p.KineticP2pClient;
 */
public interface KineticAdminClient extends KineticP2pClient {

    /**
     * Setup the Kinetic drive.
     * 
     * @param pin
     *            Compare the pin with drive's pin. If equal, can setup the
     *            information for the drive, if not, drive will reject the setup
     *            request.
     * 
     * @param setPin
     *            new pin will replace the pin in the drive.
     * 
     * @param newClusterVersion
     *            set the new cluster version for the drive.
     * 
     * @param secureErase
     *            If secureErase is set true, all data in database will be
     *            deleted.
     * 
     * @throws KineticException
     *             if any internal error occurred.
     * @deprecated
     */
    public void setup(byte[] pin, byte[] setPin, long newClusterVersion,
            boolean secureErase) throws KineticException;

    /**
     * Load firmware byte[] to the drive.
     * <p>
@@ -156,34 +131,6 @@ public interface KineticAdminClient extends KineticP2pClient {
     */
    public Device getVendorSpecificDeviceLog (byte[] name) throws KineticException;

    /**
     * Set the access control list to the Kinetic drive.  
     * <p>
     * This API only supports setting ACL or LOCK Pin or Erase PIn one at a time.
     * <p>
     * Lock Enable: Will be utilized to enable lock on power cycle. 
     * <p>
     * If the Client sets a non-empty value for the lock pin, device will be locked after a power cycle. 
     * Access to the data is not immediately impacted, but a subsequent power cycle will result in a locked drive.
     * <p>
     * Lock Disable: If the Client sets an empty value for the lock pin, lock enable feature is turned off. 
     * This provides the Client with a mechanism for turning off the locking feature after previously enabling it.
     * <p>
     * A device must be in unlock mode before a Security operation can be performed.
     * <p>
     *  
     * @param acls
     *            ACL information needs to be set.
     * 
     * @throws KineticException
     *             if any internal error occurred.
     * @see ACL
     * @see Domain
     * @see Role
     * 
     * @deprecated
     */
    public void setSecurity(List<ACL> acls, byte[] oldLockPin, byte[] newLockPin, byte[] oldErasePin, byte[] newErasePin) throws KineticException;
    
    /**
     * Set Security ACL list.
@@ -238,7 +185,7 @@ public interface KineticAdminClient extends KineticP2pClient {
     * 
     * @throws KineticException if unable to perform the pin operation.
     * 
     * @see #setSecurity(List, byte[], byte[], byte[], byte[])
     * @see #setErasePin(byte[], byte[])
     */
    public void secureErase (byte[] pin) throws KineticException;
    
@@ -252,7 +199,7 @@ public interface KineticAdminClient extends KineticP2pClient {
     *
     * @throws KineticException if any internal error occurred.
     * 
     * @see #setSecurity(List, byte[], byte[], byte[], byte[])
     * @see #setLockPin(byte[], byte[])
     */
    public void lockDevice (byte[] pin) throws KineticException;
    
@@ -265,7 +212,7 @@ public interface KineticAdminClient extends KineticP2pClient {
     * 
     * @throws KineticException if any internal error occurred.
     * 
     * @see #setSecurity(List, byte[], byte[], byte[], byte[])
     * @see #lockDevice(byte[])
     */
    public void unLockDevice (byte[] pin) throws KineticException;
    
@@ -286,17 +233,16 @@ public interface KineticAdminClient extends KineticP2pClient {
     * @return kinetic response message.
     * @throws KineticException if any internal error occurred
     * 
     * @see BackOpType
     * @see Priority
     */
    public KineticMessage mediaScan (Range range, Priority priority) throws KineticException;
    
    /**
     * 
     * @param range
     * @param priority
     * @return
     * @throws KineticException
     * Perform media optimize with the specified range and priority.
     * <p>
     * @param range range of the optimization
     * @param priority priority of this task
     * @return response message.
     * @throws KineticException if any internal error occurred.
     */
    public KineticMessage mediaOptimize(Range range, Priority priority) throws KineticException;
}