3535import org .apache .cloudstack .storage .service .model .ProtocolType ;
3636import org .apache .logging .log4j .LogManager ;
3737import org .apache .logging .log4j .Logger ;
38- import org .springframework .stereotype .Component ;
3938import org .springframework .util .Base64Utils ;
4039
4140import javax .inject .Inject ;
4241import java .net .URI ;
4342import java .util .Map ;
4443
45- @ Component
4644public class Utility {
4745
4846 private static final Logger s_logger = LogManager .getLogger (Utility .class );
49- @ Inject private OntapStorage ontapStorage ;
50- @ Inject private PrimaryDataStoreDao storagePoolDao ;
51- @ Inject private StoragePoolDetailsDao storagePoolDetailsDao ;
47+ @ Inject private static OntapStorage ontapStorage ;
48+ @ Inject private static PrimaryDataStoreDao storagePoolDao ;
49+ @ Inject private static StoragePoolDetailsDao storagePoolDetailsDao ;
5250
5351 private static final String BASIC = "Basic" ;
5452 private static final String AUTH_HEADER_COLON = ":" ;
@@ -60,17 +58,17 @@ public class Utility {
6058 * @param password -->> normal decoded password of the storage backend
6159 * @return
6260 */
63- public String generateAuthHeader (String username , String password ) {
61+ public static String generateAuthHeader (String username , String password ) {
6462 byte [] encodedBytes = Base64Utils .encode ((username + AUTH_HEADER_COLON + password ).getBytes ());
6563 return BASIC + StringUtils .SPACE + new String (encodedBytes );
6664 }
6765
68- public URI generateURI (String path ) {
66+ public static URI generateURI (String path ) {
6967 String uriString = Constants .HTTPS + ontapStorage .getManagementLIF () + path ;
7068 return URI .create (uriString );
7169 }
7270
73- public CloudStackVolume createCloudStackVolumeRequestByProtocol (StoragePoolVO storagePool , Map <String , String > details , DataObject dataObject ) {
71+ public static CloudStackVolume createCloudStackVolumeRequestByProtocol (StoragePoolVO storagePool , Map <String , String > details , DataObject dataObject ) {
7472 CloudStackVolume cloudStackVolumeRequest = null ;
7573
7674 String protocol = details .get (Constants .PROTOCOL );
@@ -108,7 +106,7 @@ public CloudStackVolume createCloudStackVolumeRequestByProtocol(StoragePoolVO st
108106 }
109107 }
110108
111- public StorageStrategy getStrategyByStoragePoolDetails (Map <String , String > details ) {
109+ public static StorageStrategy getStrategyByStoragePoolDetails (Map <String , String > details ) {
112110 if (details == null || details .isEmpty ()) {
113111 s_logger .error ("getStrategyByStoragePoolDetails: Storage pool details are null or empty" );
114112 throw new CloudRuntimeException ("getStrategyByStoragePoolDetails: Storage pool details are null or empty" );
0 commit comments