Skip to content

Commit

Permalink
some code optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
darkv committed Nov 9, 2012
1 parent eda50a5 commit 21a7322
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 44 deletions.
10 changes: 5 additions & 5 deletions Frameworks/Ajax/Ajax/Sources/er/ajax/Ajax.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ public Ajax() {
* This is called directly only for when ERXApplication is sub-classed.
*/
public void finishInitialization() {
if ( ! AjaxRequestHandler.useAjaxRequestHandler())
{
WOApplication.application().registerRequestHandler(new AjaxRequestHandler(), AjaxRequestHandler.AjaxRequestHandlerKey);
WOApplication application = WOApplication.application();
if (!AjaxRequestHandler.useAjaxRequestHandler()) {
application.registerRequestHandler(new AjaxRequestHandler(), AjaxRequestHandler.AjaxRequestHandlerKey);
log.debug("AjaxRequestHandler installed");
}
WOApplication.application().registerRequestHandler(new AjaxPushRequestHandler(), AjaxPushRequestHandler.AjaxCometRequestHandlerKey);
application.registerRequestHandler(new AjaxPushRequestHandler(), AjaxPushRequestHandler.AjaxCometRequestHandlerKey);

// Register the AjaxResponseDelegate if you're using an ERXAjaxApplication ... This allows us
// to fix some weird border cases caused by structural page changes.
WOApplication application = WOApplication.application();
if (application instanceof ERXAjaxApplication) {
((ERXAjaxApplication)application).setResponseDelegate(new AjaxResponse.AjaxResponseDelegate());
}
log.debug("Ajax loaded");
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Frameworks/Ajax/Ajax/Sources/er/ajax/FocusTextField.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public static void _appendAttributesFromAssociationsToResponse(WOResponse respon
}
response.appendContentString(id + "SubmitOnEnter(event);");
}
response.appendContentString("\"");
response.appendContentCharacter('"');
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ public void setDelegate(Delegate delegate) {
@Override
public void finishInitialization() {
initializeFrameworkFromSystemProperties();
log.debug("ERJavaMail loaded");
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,39 +1,36 @@
package er.attributeextension;

import org.apache.log4j.Logger;
import java.lang.reflect.Method;

import er.extensions.ERXExtensions;
import er.extensions.ERXFrameworkPrincipal;

@SuppressWarnings("unchecked")
public class ERAttributeExtension extends ERXFrameworkPrincipal {

public static final Class<?>[] REQUIRES = new Class[] { ERXExtensions.class };

private static final Logger log = Logger.getLogger(ERAttributeExtension.class);

protected static ERAttributeExtension sharedInstance;

// Registers the class as the framework principal
static {
log.debug("Static Initializer for ERAttributeExtension");
setUpFrameworkPrincipalClass(ERAttributeExtension.class);
}

static {
java.lang.reflect.Method valueFactoryClassNameMethod = null;
try {
Class eoAttributeClass = Class.forName("com.webobjects.eoaccess.EOAttribute");
valueFactoryClassNameMethod = eoAttributeClass.getMethod("valueFactoryClassName", (java.lang.Class[])null);
} catch (java.lang.ClassNotFoundException cnfe) {
log.error("Cannot find EOAttribute class. Something is very wrong.");
} catch (java.lang.NoSuchMethodException nsme) {
valueFactoryClassNameMethod = null;
}
if (valueFactoryClassNameMethod == null)
log.error("The ERAttributeExtension framework requires the Project Wonder version of the EOAttribute class and "+
"that does not seem to be the version of the class which is loaded first in the classpath. Examine your build "+
"path to ensure that the Project Wonder frameworks occur before the Apple frameworks.");
@Override
protected void initialize() {
super.initialize();
Method valueFactoryClassNameMethod = null;
try {
Class eoAttributeClass = Class.forName("com.webobjects.eoaccess.EOAttribute");
valueFactoryClassNameMethod = eoAttributeClass.getMethod("valueFactoryClassName", (java.lang.Class[])null);
} catch (ClassNotFoundException cnfe) {
log.error("Cannot find EOAttribute class. Something is very wrong.");
} catch (NoSuchMethodException nsme) {
valueFactoryClassNameMethod = null;
}
if (valueFactoryClassNameMethod == null)
log.error("The ERAttributeExtension framework requires the Project Wonder version of the EOAttribute class and "+
"that does not seem to be the version of the class which is loaded first in the classpath. Examine your build "+
"path to ensure that the Project Wonder frameworks occur before the Apple frameworks.");
}

public static ERAttributeExtension sharedInstance() {
Expand All @@ -44,5 +41,7 @@ public static ERAttributeExtension sharedInstance() {
}

@Override
public void finishInitialization() {}
public void finishInitialization() {
log.debug("ERAttributeExtension loaded");
}
}
18 changes: 1 addition & 17 deletions Frameworks/Misc/ERXiss/Sources/main/er/xiss/ERXiss.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package er.xiss;

import org.apache.log4j.Logger;

import er.extensions.ERXFrameworkPrincipal;

public class ERXiss extends ERXFrameworkPrincipal {

/** ログ・サポート */
private static Logger _log; // まだロッガーが初期化していない

//********************************************************************
// フレームワーク情報
//********************************************************************
Expand All @@ -28,18 +23,7 @@ public static String frameworkName() {
setUpFrameworkPrincipalClass(ERXiss.class);
}

@Override
protected void initialize() {
// 念のためにログに書き出す
System.out.println("doing now " + frameworkName() + ".initialize() for setup the Framework.");
}

public void finishInitialization() {
// ログ・サポート
_log = Logger.getLogger(ERXiss.class);
if(_log.isDebugEnabled())
_log.debug("doing now " + frameworkName() + ".finishInitialization() for setup the Framework.");

log.debug("ERXiss loaded");
}

}

0 comments on commit 21a7322

Please sign in to comment.