Supprimer le code inutilisé
This commit is contained in:
@@ -79,19 +79,19 @@ public class Device
|
|||||||
|
|
||||||
private Path deviceFile;
|
private Path deviceFile;
|
||||||
private Path deviceKeyFile;
|
private Path deviceKeyFile;
|
||||||
|
|
||||||
protected byte[] deviceKey = new byte[DEVICE_KEY_SIZE];
|
protected byte[] deviceKey = new byte[DEVICE_KEY_SIZE];
|
||||||
protected String deviceClass;
|
protected String deviceClass;
|
||||||
protected String deviceSerial;
|
protected String deviceSerial;
|
||||||
protected String deviceName;
|
protected String deviceName;
|
||||||
protected String deviceType = "standalone";
|
protected String deviceType = "standalone";
|
||||||
protected String fingerprint;
|
protected String fingerprint;
|
||||||
|
|
||||||
private Map<String, String> versions = new HashMap<>(); // Stores device properties
|
private Map<String, String> versions = new HashMap<>(); // Stores device properties
|
||||||
protected final Logger LOGGER = Logger.getLogger( Device.class.getName() );
|
protected final Logger LOGGER = Logger.getLogger( Device.class.getName() );
|
||||||
|
|
||||||
protected Device() {}
|
protected Device() {}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Main Device constructor.
|
* Main Device constructor.
|
||||||
*
|
*
|
||||||
@@ -265,7 +265,7 @@ public class Device
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
InetAddress localHost = InetAddress.getLocalHost();
|
InetAddress localHost = InetAddress.getLocalHost();
|
||||||
|
|
||||||
// Get the hostname from the InetAddress object
|
// Get the hostname from the InetAddress object
|
||||||
deviceName = localHost.getHostName();
|
deviceName = localHost.getHostName();
|
||||||
}
|
}
|
||||||
@@ -332,38 +332,6 @@ public class Device
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *
|
|
||||||
* Static method to create and manage a common.Device instance, handling file existence.
|
|
||||||
*
|
|
||||||
* @param dirName Directory where to put files (.adept)
|
|
||||||
* @param hobbesVersion Hobbes (client version) to set
|
|
||||||
* @param randomSerial Create a random serial (new device each time) or not (serial computed from machine specs)
|
|
||||||
* @return A new or existing common.Device instance.
|
|
||||||
* @throws DeviceException if directory creation or file operations fail.
|
|
||||||
* @ param processor Instance of DRMProcessor
|
|
||||||
*/
|
|
||||||
// public static Device createDevice( String dirName, String hobbesVersion, boolean randomSerial )
|
|
||||||
// throws NoSuchAlgorithmException, UnknownHostException
|
|
||||||
// {
|
|
||||||
// // TODO: this can probably be moved to the device constructor, eliminating the need for
|
|
||||||
// // a factory method.
|
|
||||||
// Path dirPath = Paths.get( dirName );
|
|
||||||
// if (!Files.exists( dirPath ))
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// Files.createDirectories( dirPath ); // mkdir_p equivalent
|
|
||||||
// }
|
|
||||||
// catch (IOException e)
|
|
||||||
// {
|
|
||||||
// throw new DeviceException( DeviceException.DEV_MKPATH, "Unable to create directory: " + dirName, e );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return new Device( dirPath.resolve( "device.xml" ),
|
|
||||||
// dirPath.resolve( "devicesalt" ),
|
|
||||||
// hobbesVersion, randomSerial );
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the device key.
|
* Returns the device key.
|
||||||
*
|
*
|
||||||
@@ -413,7 +381,7 @@ public class Device
|
|||||||
deviceName = deviceInfo.getElementsByTagName( "adept:deviceName" ).item( 0 ).getTextContent();
|
deviceName = deviceInfo.getElementsByTagName( "adept:deviceName" ).item( 0 ).getTextContent();
|
||||||
deviceType = deviceInfo.getElementsByTagName( "adept:deviceType" ).item( 0 ).getTextContent();
|
deviceType = deviceInfo.getElementsByTagName( "adept:deviceType" ).item( 0 ).getTextContent();
|
||||||
fingerprint = deviceInfo.getElementsByTagName( "adept:fingerprint" ).item( 0 ).getTextContent();
|
fingerprint = deviceInfo.getElementsByTagName( "adept:fingerprint" ).item( 0 ).getTextContent();
|
||||||
|
|
||||||
NodeList elements = deviceInfo.getElementsByTagName( "adept:version" );
|
NodeList elements = deviceInfo.getElementsByTagName( "adept:version" );
|
||||||
for (int i = 0; i < elements.getLength(); i++)
|
for (int i = 0; i < elements.getLength(); i++)
|
||||||
{
|
{
|
||||||
@@ -472,42 +440,42 @@ public class Device
|
|||||||
{
|
{
|
||||||
return versions.get( "clientLocale" );
|
return versions.get( "clientLocale" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getClientOS()
|
public String getClientOS()
|
||||||
{
|
{
|
||||||
return versions.get( "clientOS" );
|
return versions.get( "clientOS" );
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getHobbes()
|
public String getHobbes()
|
||||||
{
|
{
|
||||||
return versions.get( "hobbes" );
|
return versions.get( "hobbes" );
|
||||||
}
|
}
|
||||||
|
|
||||||
String getDeviceSerial()
|
String getDeviceSerial()
|
||||||
{
|
{
|
||||||
return deviceSerial;
|
return deviceSerial;
|
||||||
}
|
}
|
||||||
|
|
||||||
String getDeviceName()
|
String getDeviceName()
|
||||||
{
|
{
|
||||||
return deviceName;
|
return deviceName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getFingerprint()
|
public String getFingerprint()
|
||||||
{
|
{
|
||||||
return fingerprint;
|
return fingerprint;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeviceType()
|
public String getDeviceType()
|
||||||
{
|
{
|
||||||
return deviceType;
|
return deviceType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeviceClass()
|
public String getDeviceClass()
|
||||||
{
|
{
|
||||||
return deviceClass;
|
return deviceClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDeviceFiles( Path deviceFile, Path deviceKeyFile )
|
public void updateDeviceFiles( Path deviceFile, Path deviceKeyFile )
|
||||||
throws NoSuchAlgorithmException
|
throws NoSuchAlgorithmException
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user