Avatar
😀

Organizations

  • I ran into some fun while trying to unit test my annotated entities as some of the annotations were on private fields.

    Rather than create constructors to do the injection for me, or change the access type on the fields, I came up with this little framework that people might be interested in. (Or be able to help improve)

    Temporary home: http://www.stvconsultants.com/community/easygloss/

    Permanent home: hopefully on dev.java.net

    Has anyone any comments?

    Created Tue, 11 Apr 2006 00:00:00 +0000
  • Here are my initial thoughts (which I posted as a forum comment elsewhere)

    Layer 0. Test the entity beans are deployable (You’ll need some of the framework from Layer 4 for this). Basically, you need to know that all your annotations work. Things to watch out for are multiple @Id fields in one class or @EmbeddedID or @IdClass in conjunction with @ManyToOne, @ManyToMany, @OneToMany, @OneToOne and fun with @JoinTable, @JoinColumn and @JoinColumns. Once you know how these are supposed to work with the specification, it’s not too bad to write it correctly each time. But there are some gotchas that will break things later on.

    Created Fri, 07 Apr 2006 00:00:00 +0000
  • From the spec:

    The deployment tool must first read the Java EE application deployment descriptor from the application .ear file (META-INF/application.xml). If the deployment descriptor is present, it fully specifies the modules included in the application. If no deployment descriptor is present, the deployment tool uses the following rules to determine the modules included in the application.

    It would be nice if glassfish gave some warning that your application.xml might not be completely specified!

    Created Mon, 20 Mar 2006 02:00:00 +0000
  • I have been going nuts trying to trace problems with deployment ofenterprise applications and resource injection.
    I think the issue is around the application.xml file in a .ear! Without an application.xml file, everything is fine and dandy. As soon as you add an application.xml file, things start breaking… it seems that when you have defined an application.xml file only those modules that are defined in the application.xml file are loaded. Without an application.xml file, all the .jar files are scanned for @Stateless and @Statefull annotations and the modules are inferred. It would help if there was some notification that maybe your application.xml file was incomplete, or else some way of restoring the scanning behaviour if you want it. Now to go digging through the spec to see if I’m just stupidly missing something or if I need to file a bug report.

    Created Mon, 20 Mar 2006 01:00:00 +0000
  • ELResolvers are where you get to extend the new unified EL for your own pages. They are not that difficult to extend, it’s just a case of:

    1. Have your class extend from ELResolver
    2. Implement the abstract methods
    3. Add an <el-resolver> element to your <application> section in faces-config.xml
    4. Start using your resolver!

    OK, so why would you want to do this? Well, for one it can make some things a lot easier. I was driven to find this solution in order to dynamically generate h:dataTables with variable numbers of columns.  Ordinarily you would need to bind the h:dataTable to a backing bean and have the backing bean add in the extra columns, but with c:forEach now being compatible with JSF, we have an alternative.

    Created Wed, 08 Mar 2006 03:00:00 +0000
  • The path to the solution to authorization woes could start here http://www.thoughtsabout.net/blog/archives/000033.html

    Created Fri, 03 Mar 2006 00:00:00 +0000
  • Are you keeping up with the latest glassfish builds? Are you running windows 2k or higher? Are you fed up having to manually reinstall the server whenever a new weekly build comes out?

    Well I was, so here’s a very basic Windows NT command script.

    @ECHO OFF
    REM Change these environment variables to your own config
    
    SET GLASSFISH_DOWNLOADS=c:\java\downloads
    SET GLASSFISH_DRIVE=c:
    SET GLASSFISH_PARENT_DIR=c:\java
    
    REM Make sure we are in the correct location
    
    %GLASSFISH_DRIVE%
    CD %GLASSFISH_PARENT_DIR%
    
    REM Find the latest build that has been downloaded
    
    SET BUILD=aaa
    FOR %%i IN (%GLASSFISH_DOWNLOADS%\glassfish-installer-9.0-*.jar) DO IF %%i GTR %BUILD% SET BUILD=%%i
    
    IF A%BUILD%A==AaaaA GOTO no_build
    
    CLS
    ECHO .
    ECHO .
    ECHO Newest build found is:   %BUILD%
    IF EXIST glassfish.bld (TYPE glassfish.bld) ELSE (ECHO Current installed build: I don't know)
    ECHO .
    ECHO .
    ECHO .
    ECHO [%0] About to remove current installation of Glassfish...
    ECHO .
    ECHO This will delete any currently deployed applications, so you would want to
    ECHO either not care about them or have made a backup already!
    ECHO .
    ECHO .
    ECHO This is your last chance to press Ctrl+C to abort otherwise
    ECHO press any other key to continue...
    PAUSE >> NUL
    ECHO .
    ECHO .
    ECHO .
    ECHO [%0] Stopping domain1...
    ECHO .
    CALL ASADMIN stop-domain domain1
    ECHO .
    ECHO .
    ECHO .
    ECHO [%0] Removing current installation...
    ECHO .
    RMDIR /S /Q %GLASSFISH_PARENT_DIR%\glassfish
    ECHO .
    ECHO .
    ECHO .
    ECHO [%0] Starting installer...
    ECHO .JAVA -Xmx256m -jar %BUILD%
    ECHO Current installed build: %BUILD% > glassfish.bld
    ECHO .
    ECHO .
    ECHO .
    ECHO [%0] Setting up domain1...
    ECHO .
    CD glassfish
    CALL ANT -f setup.xml
    ECHO .
    ECHO .
    ECHO .
    ECHO [%0] Starting domain1...
    ECHO .
    CALL ASADMIN start-domain domain1
    ECHO .
    ECHO .
    ECHO .
    ECHO [%0] Glassfish reinstalled!
    ECHO .
    GOTO end
    
    :no_build
    ECHO .
    ECHO .
    ECHO .
    ECHO Cannot find any glassfish builds in %GLASSFISH_DOWNLOADS%
    ECHO .
    
    :end
    ECHO .
    ECHO .
    ECHO .
    ECHO [%0] I'm done, press a key and I'll be out of here...
    ECHO .
    PAUSE >> NUL
    

    Save it as, e.g. REINSTALL-GLASSFISH.CMD and all you need to do is run it every time you download a new build!

    Created Wed, 01 Feb 2006 00:00:00 +0000