2626import javax .naming .ConfigurationException ;
2727import javax .xml .parsers .DocumentBuilderFactory ;
2828
29- import org .apache .log4j .Logger ;
3029import org .w3c .dom .Document ;
3130import org .w3c .dom .Element ;
3231
3837
3938@ Local (value = Processor .class )
4039public class OVAProcessor extends AdapterBase implements Processor {
41- private static final Logger s_logger = Logger .getLogger (OVAProcessor .class );
4240
4341 StorageLayer _storage ;
4442
4543 @ Override
4644 public FormatInfo process (String templatePath , ImageFormat format , String templateName ) throws InternalErrorException {
4745 if (format != null ) {
48- if (s_logger .isInfoEnabled ()) {
49- s_logger .info ("We currently don't handle conversion from " + format + " to OVA." );
46+ if (logger .isInfoEnabled ()) {
47+ logger .info ("We currently don't handle conversion from " + format + " to OVA." );
5048 }
5149 return null ;
5250 }
5351
54- s_logger .info ("Template processing. templatePath: " + templatePath + ", templateName: " + templateName );
52+ logger .info ("Template processing. templatePath: " + templatePath + ", templateName: " + templateName );
5553 String templateFilePath = templatePath + File .separator + templateName + "." + ImageFormat .OVA .getFileExtension ();
5654 if (!_storage .exists (templateFilePath )) {
57- if (s_logger .isInfoEnabled ()) {
58- s_logger .info ("Unable to find the vmware template file: " + templateFilePath );
55+ if (logger .isInfoEnabled ()) {
56+ logger .info ("Unable to find the vmware template file: " + templateFilePath );
5957 }
6058 return null ;
6159 }
6260
63- s_logger .info ("Template processing - untar OVA package. templatePath: " + templatePath + ", templateName: " + templateName );
61+ logger .info ("Template processing - untar OVA package. templatePath: " + templatePath + ", templateName: " + templateName );
6462 String templateFileFullPath = templatePath + File .separator + templateName + "." + ImageFormat .OVA .getFileExtension ();
6563 File templateFile = new File (templateFileFullPath );
6664
67- Script command = new Script ("tar" , 0 , s_logger );
65+ Script command = new Script ("tar" , 0 , logger );
6866 command .add ("--no-same-owner" );
6967 command .add ("-xf" , templateFileFullPath );
7068 command .setWorkDir (templateFile .getParent ());
7169 String result = command .execute ();
7270 if (result != null ) {
73- s_logger .info ("failed to untar OVA package due to " + result + ". templatePath: " + templatePath + ", templateName: " + templateName );
71+ logger .info ("failed to untar OVA package due to " + result + ". templatePath: " + templatePath + ", templateName: " + templateName );
7472 return null ;
7573 }
7674
@@ -91,7 +89,7 @@ public long getVirtualSize(File file) {
9189 long size = getTemplateVirtualSize (file .getParent (), file .getName ());
9290 return size ;
9391 } catch (Exception e ) {
94- s_logger .info ("[ignored]"
92+ logger .info ("[ignored]"
9593 + "failed to get virtual template size for ova: " + e .getLocalizedMessage ());
9694 }
9795 return file .length ();
@@ -105,7 +103,7 @@ public long getTemplateVirtualSize(String templatePath, String templateName) thr
105103 String ovfFileName = getOVFFilePath (templateFileFullPath );
106104 if (ovfFileName == null ) {
107105 String msg = "Unable to locate OVF file in template package directory: " + templatePath ;
108- s_logger .error (msg );
106+ logger .error (msg );
109107 throw new InternalErrorException (msg );
110108 }
111109 try {
@@ -130,7 +128,7 @@ public long getTemplateVirtualSize(String templatePath, String templateName) thr
130128 return virtualSize ;
131129 } catch (Exception e ) {
132130 String msg = "Unable to parse OVF XML document to get the virtual disk size due to" + e ;
133- s_logger .error (msg );
131+ logger .error (msg );
134132 throw new InternalErrorException (msg );
135133 }
136134 }
0 commit comments