skin: added some log
authorgiwoong.kim <giwoong.kim@samsung.com>
Mon, 7 Jan 2013 08:33:53 +0000 (17:33 +0900)
committergiwoong.kim <giwoong.kim@samsung.com>
Mon, 7 Jan 2013 10:04:15 +0000 (19:04 +0900)
added some log

Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java
tizen/src/skin/client/src/org/tizen/emulator/skin/config/EmulatorConfig.java
tizen/src/skin/client/src/org/tizen/emulator/skin/image/ImageRegistry.java

index c90cd65..c162bdd 100644 (file)
@@ -82,7 +82,7 @@ public class EmulatorSkinMain {
        /**
         * @param args
         */
-       public static void main( String[] args ) {
+       public static void main(String[] args) {
 
                String simpleMsg = getSimpleMsg(args);
                if (simpleMsg != null) {
@@ -102,15 +102,16 @@ public class EmulatorSkinMain {
                try {
 
                        /* get vm path from startup argument */
-                       String vmPath = getVmPath( args );
-                       if ( StringUtil.isEmpty( vmPath ) ) {
-                               throw new IllegalArgumentException( ArgsConstants.VM_PATH + " in arguments is null." );
+                       String vmPath = getVmPath(args);
+                       if (StringUtil.isEmpty(vmPath)) {
+                               throw new IllegalArgumentException(
+                                               ArgsConstants.VM_PATH + " in arguments is null.");
                        }
 
-                       SkinLogger.init( SkinLogLevel.DEBUG, vmPath );
+                       SkinLogger.init(SkinLogLevel.DEBUG, vmPath);
 
-                       logger = SkinLogger.getSkinLogger( EmulatorSkinMain.class ).getLogger();
-                       logger.info( "!!! Start Emualtor Skin !!!" );
+                       logger = SkinLogger.getSkinLogger(EmulatorSkinMain.class).getLogger();
+                       logger.info("!!! Start Emualtor Skin !!!");
 
                        /* startup arguments parsing */
                        Map<String, String> argsMap = parsArgs(args);
@@ -125,7 +126,6 @@ public class EmulatorSkinMain {
                        String skinPath = ImageRegistry.getSkinPath(
                                        (String) argsMap.get(ArgsConstants.SKIN_PATH));
 
-                       
                        /* get maxtouchpoint from startup argument */
                        int maxtouchpoint;
                        if(argsMap.containsKey(ArgsConstants.MAX_TOUCHPOINT)) {
@@ -138,6 +138,7 @@ public class EmulatorSkinMain {
                                logger.info(ArgsConstants.MAX_TOUCHPOINT +
                                                " does not exist set maxtouchpoint info to " + maxtouchpoint);
                        }
+
                        /* set skin information */
                        String skinInfoFilePath = skinPath + File.separator + SKIN_INFO_FILE_NAME;
                        Properties skinInfoProperties = loadProperties(skinInfoFilePath, false);
@@ -190,23 +191,23 @@ public class EmulatorSkinMain {
 
                        /* load dbi file */
                        EmulatorUI dbiContents = loadDbi(skinPath);
-                       if ( null == dbiContents ) {
-                               logger.severe( "Fail to load dbi file." );
+                       if (null == dbiContents) {
+                               logger.severe("Fail to load dbi file.");
 
                                Shell temp = new Shell(Display.getDefault());
-                               MessageBox messageBox = new MessageBox( temp, SWT.ICON_ERROR );
-                               messageBox.setText( "Emulator" );
-                               messageBox.setMessage( "Fail to load \"" + DBI_FILE_NAME + "\" file\n" +
+                               MessageBox messageBox = new MessageBox(temp, SWT.ICON_ERROR);
+                               messageBox.setText("Emulator");
+                               messageBox.setMessage("Fail to load \"" + DBI_FILE_NAME + "\" file\n" +
                                                "Check if the file is corrupted or missing from the following path.\n" +
                                                skinPath);
                                messageBox.open();
                                temp.dispose();
 
-                               System.exit( -1 );
+                               System.exit(-1);
                        }
 
-                       EmulatorConfig config = new EmulatorConfig( argsMap, dbiContents, skinProperties, skinPropFilePath,
-                                       configProperties );
+                       EmulatorConfig config = new EmulatorConfig(argsMap,
+                                       dbiContents, skinProperties, skinPropFilePath, configProperties);
 
                        /* load image resource */
                        ImageRegistry.getInstance().initialize(config);
index 44e08fc..489e4ad 100644 (file)
@@ -55,7 +55,8 @@ import org.tizen.emulator.skin.util.StringUtil;
  */
 public class EmulatorConfig {
 
-       private static Logger logger = SkinLogger.getSkinLogger( EmulatorConfig.class ).getLogger();
+       private static Logger logger =
+                       SkinLogger.getSkinLogger(EmulatorConfig.class).getLogger();
 
        public static final int DEFAULT_WINDOW_SCALE = Scale.SCALE_50.value();
        public static final short DEFAULT_WINDOW_ROTATION = RotationInfo.PORTRAIT.id();
@@ -372,7 +373,7 @@ public class EmulatorConfig {
                properties.put( key, Integer.toString( value ) );
        }
 
-       // skin properties //
+       /* skin properties */
 
        public String getSkinProperty( String key ) {
                return getProperty( skinProperties, key );
@@ -406,7 +407,7 @@ public class EmulatorConfig {
                setProperty( skinProperties, key, value );
        }
 
-       // config properties //
+       /* config properties */
 
        public String getConfigProperty( String key ) {
                return getProperty( configProperties, key );
index d633c28..7e77c00 100644 (file)
@@ -57,8 +57,8 @@ import org.tizen.emulator.skin.util.SkinRotation;
  *
  */
 public class ImageRegistry {
-       
-       private Logger logger = SkinLogger.getSkinLogger( ImageRegistry.class ).getLogger();
+       private static Logger logger =
+                       SkinLogger.getSkinLogger(ImageRegistry.class).getLogger();
 
        public static final String SKINS_FOLDER = "skins";
        public static final String GENERAL_FOLDER = "emul-general";
@@ -117,12 +117,14 @@ public class ImageRegistry {
        private static boolean isInitialized;
 
        private ImageRegistry() {
+               /* do nothing */
        }
 
        public static ImageRegistry getInstance() {
-               if ( null == instance ) {
+               if (null == instance) {
                        instance = new ImageRegistry();
                }
+
                return instance;
        }
 
@@ -139,41 +141,47 @@ public class ImageRegistry {
                this.skinImageMap = new HashMap<String, Image>();
                this.iconMap = new HashMap<String, Image>();
 
-               init( this.argSkinPath );
+               init(this.argSkinPath);
 
        }
 
        public static String getSkinPath(String argSkinPath) {
-               /* When emulator has a invalid skin path,
+               /* When emulator receive a invalid skin path,
                 emulator uses default skin path instead of it */
                String defaultSkinPath = ".." + //TODO:
                                File.separator + SKINS_FOLDER + File.separator + GENERAL_FOLDER;
 
                if (argSkinPath == null) {
+                       logger.info("Emulator uses default skin path (" + defaultSkinPath +
+                                       ") instead of invalid skin path (null).");
+
                        return defaultSkinPath;
                }
 
                File f = new File(argSkinPath);
                if (f.isDirectory() == false) {
+                       logger.info("Emulator uses default skin path (" + defaultSkinPath +
+                                       ") instead of invalid skin path (" + argSkinPath + ").");
+
                        return defaultSkinPath;
                }
 
                return argSkinPath;
        }
 
-       private void init( String argSkinPath ) {
+       private void init(String argSkinPath) {
 
                RotationsType rotations = dbiContents.getRotations();
 
-               if ( null == rotations ) {
-                       logger.severe( "Fail to loading rotations element from dbi." );
+               if (null == rotations) {
+                       logger.severe("Fail to loading rotations element from dbi.");
                        return;
                }
 
                List<RotationType> rotationList = rotations.getRotation();
 
-               for ( RotationType rotation : rotationList ) {
-                       SkinRotation.put( rotation );
+               for (RotationType rotation : rotationList) {
+                       SkinRotation.put(rotation);
                }
 
        }
@@ -231,7 +239,7 @@ public class ImageRegistry {
                }
        }
 
-       private String makeKey( Short id, ImageType imageType ) {
+       private String makeKey(Short id, ImageType imageType) {
                return id + ":" + imageType.ordinal();
        }