- cleanup logger use in ProjectAssetManager and ProjectExtensionManager

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@10095 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 12 years ago
parent aa8866e92e
commit 6dacfd56b3
  1. 14
      sdk/jme3-core/src/com/jme3/gde/core/assets/ProjectAssetManager.java
  2. 16
      sdk/jme3-core/src/com/jme3/gde/core/j2seproject/ProjectExtensionManager.java

@ -75,7 +75,7 @@ import org.openide.util.lookup.Lookups;
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public class ProjectAssetManager extends DesktopAssetManager { public class ProjectAssetManager extends DesktopAssetManager {
private static final Logger logger = Logger.getLogger(ProjectAssetManager.class.getName());
private Project project; private Project project;
private List<String> folderNames = new LinkedList<String>(); private List<String> folderNames = new LinkedList<String>();
private final List<AssetEventListener> assetEventListeners = Collections.synchronizedList(new LinkedList<AssetEventListener>()); private final List<AssetEventListener> assetEventListeners = Collections.synchronizedList(new LinkedList<AssetEventListener>());
@ -105,7 +105,7 @@ public class ProjectAssetManager extends DesktopAssetManager {
this.project = new DummyProject(this, path); this.project = new DummyProject(this, path);
} }
String string = project.getProjectDirectory().getPath(); String string = project.getProjectDirectory().getPath();
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Add locator: {0}", string); logger.log(Level.INFO, "Add locator: {0}", string);
registerLocator(string, "com.jme3.asset.plugins.FileLocator"); registerLocator(string, "com.jme3.asset.plugins.FileLocator");
for (AssetManagerConfigurator di : Lookup.getDefault().lookupAll(AssetManagerConfigurator.class)) { for (AssetManagerConfigurator di : Lookup.getDefault().lookupAll(AssetManagerConfigurator.class)) {
di.prepareManager(this); di.prepareManager(this);
@ -123,13 +123,13 @@ public class ProjectAssetManager extends DesktopAssetManager {
} }
Logger.getLogger(ProjectAssetManager.class.getName()).log(Level.INFO, "Clear {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()}); Logger.getLogger(ProjectAssetManager.class.getName()).log(Level.INFO, "Clear {0} classpath entries and {1} url locators for project {2}", new Object[]{classPathItems.size(), jarItems.size(), project.toString()});
for (FileObject fileObject : jarItems) { for (FileObject fileObject : jarItems) {
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Remove locator:{0}", fileObject.toURL()); logger.log(Level.FINE, "Remove locator:{0}", fileObject.toURL());
unregisterLocator(fileObject.toURL().toExternalForm(), unregisterLocator(fileObject.toURL().toExternalForm(),
com.jme3.asset.plugins.UrlLocator.class); com.jme3.asset.plugins.UrlLocator.class);
} }
jarItems.clear(); jarItems.clear();
for (ClassPathItem fileObject : classPathItems) { for (ClassPathItem fileObject : classPathItems) {
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Remove classpath:{0}", fileObject.object); logger.log(Level.FINE, "Remove classpath:{0}", fileObject.object);
fileObject.object.removeRecursiveListener(fileObject.listener); fileObject.object.removeRecursiveListener(fileObject.listener);
} }
classPathItems.clear(); classPathItems.clear();
@ -156,12 +156,12 @@ public class ProjectAssetManager extends DesktopAssetManager {
for (FileObject fileObject : roots) { for (FileObject fileObject : roots) {
if (!fileObject.equals(getAssetFolder())) { if (!fileObject.equals(getAssetFolder())) {
fileObject.addRecursiveListener(listener); fileObject.addRecursiveListener(listener);
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Add classpath:{0}", fileObject); logger.log(Level.FINE, "Add classpath:{0}", fileObject);
classPathItems.add(new ClassPathItem(fileObject, listener)); classPathItems.add(new ClassPathItem(fileObject, listener));
urls.add(fileObject.toURL()); urls.add(fileObject.toURL());
} }
if (fileObject.toURL().toExternalForm().startsWith("jar")) { if (fileObject.toURL().toExternalForm().startsWith("jar")) {
Logger.getLogger(this.getClass().getName()).log(Level.FINE, "Add locator:{0}", fileObject.toURL()); logger.log(Level.FINE, "Add locator:{0}", fileObject.toURL());
jarItems.add(fileObject); jarItems.add(fileObject);
registerLocator(fileObject.toURL().toExternalForm(), registerLocator(fileObject.toURL().toExternalForm(),
"com.jme3.asset.plugins.UrlLocator"); "com.jme3.asset.plugins.UrlLocator");
@ -267,7 +267,7 @@ public class ProjectAssetManager extends DesktopAssetManager {
*/ */
public void addFolderLocator(String relativePath) { public void addFolderLocator(String relativePath) {
String string = project.getProjectDirectory().getPath() + "/" + relativePath + "/"; String string = project.getProjectDirectory().getPath() + "/" + relativePath + "/";
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Add locator:{0}", string); logger.log(Level.INFO, "Add locator:{0}", string);
registerLocator(string, registerLocator(string,
"com.jme3.asset.plugins.FileLocator"); "com.jme3.asset.plugins.FileLocator");
folderNames.add(relativePath); folderNames.add(relativePath);

@ -64,7 +64,7 @@ import org.openide.util.Exceptions;
* @author normenhansen * @author normenhansen
*/ */
public class ProjectExtensionManager { public class ProjectExtensionManager {
private static final Logger logger = Logger.getLogger(ProjectExtensionManager.class.getName());
private String extensionName; private String extensionName;
private String extensionVersion; private String extensionVersion;
private String extensionTargets; private String extensionTargets;
@ -447,7 +447,7 @@ public class ProjectExtensionManager {
//XXX: deleting old (beta) files here //XXX: deleting old (beta) files here
FileObject fo = projectRoot.getFileObject(entry.getName()); FileObject fo = projectRoot.getFileObject(entry.getName());
if (fo != null && entry.getSize() != -1 && entry.getSize() == fo.getSize()) { if (fo != null && entry.getSize() != -1 && entry.getSize() == fo.getSize()) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old folder " + fo.getNameExt()); logger.log(Level.INFO, "Deleting old folder " + fo.getNameExt());
fo.delete(); fo.delete();
} }
FileUtil.createFolder(projectRoot, fileName); FileUtil.createFolder(projectRoot, fileName);
@ -455,7 +455,7 @@ public class ProjectExtensionManager {
//XXX: deleting old (beta) files here //XXX: deleting old (beta) files here
FileObject fo = projectRoot.getFileObject(entry.getName()); FileObject fo = projectRoot.getFileObject(entry.getName());
if (fo != null && !fo.equals(projectRoot)) { if (fo != null && !fo.equals(projectRoot)) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old file " + fo.getNameExt()); logger.log(Level.INFO, "Deleting old file " + fo.getNameExt());
fo.delete(); fo.delete();
} }
fo = projectRoot.getFileObject(fileName); fo = projectRoot.getFileObject(fileName);
@ -463,7 +463,7 @@ public class ProjectExtensionManager {
fo = FileUtil.createData(projectRoot, fileName); fo = FileUtil.createData(projectRoot, fileName);
writeFile(str, fo); writeFile(str, fo);
} else { } else {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Not overwriting existing file " + fo.getNameExt()); logger.log(Level.INFO, "Not overwriting existing file " + fo.getNameExt());
} }
} }
} }
@ -485,7 +485,7 @@ public class ProjectExtensionManager {
//XXX: deleting old (beta) files here //XXX: deleting old (beta) files here
FileObject old = projectRoot.getFileObject(entry.getName()); FileObject old = projectRoot.getFileObject(entry.getName());
if (old != null && !old.equals(projectRoot)) { if (old != null && !old.equals(projectRoot)) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting old file " + old.getNameExt()); logger.log(Level.INFO, "Deleting old file " + old.getNameExt());
if (entry.getSize() != -1 && entry.getSize() == old.getSize()) { if (entry.getSize() != -1 && entry.getSize() == old.getSize()) {
old.delete(); old.delete();
} }
@ -494,11 +494,11 @@ public class ProjectExtensionManager {
FileObject obj = projectRoot.getFileObject(fileName); FileObject obj = projectRoot.getFileObject(fileName);
if (obj != null && !obj.equals(projectRoot) && !obj.isFolder()) { if (obj != null && !obj.equals(projectRoot) && !obj.isFolder()) {
if (entry.getSize() != -1 && entry.getSize() == obj.getSize()) { if (entry.getSize() != -1 && entry.getSize() == obj.getSize()) {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Deleting file " + obj.getNameExt()); logger.log(Level.INFO, "Deleting file " + obj.getNameExt());
obj.delete(); obj.delete();
} else { } else {
kept = true; kept = true;
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Keeping file " + obj.getNameExt()); logger.log(Level.INFO, "Keeping file " + obj.getNameExt());
} }
} }
} }
@ -518,7 +518,7 @@ public class ProjectExtensionManager {
private void writeFile(ZipInputStream str, FileObject fo) throws IOException { private void writeFile(ZipInputStream str, FileObject fo) throws IOException {
OutputStream out = fo.getOutputStream(); OutputStream out = fo.getOutputStream();
try { try {
Logger.getLogger(this.getClass().getName()).log(Level.INFO, "Creating file " + fo.getNameExt()); logger.log(Level.INFO, "Creating file " + fo.getNameExt());
FileUtil.copy(str, out); FileUtil.copy(str, out);
} finally { } finally {
out.close(); out.close();

Loading…
Cancel
Save