Tuesday, April 24, 2012

Return List of Dynamic object types from Method

Sometimes we want to convert the list of objects into a desired data type list. Here is one simple example which returns a list of objects into list of Strings, assuming that all the objects will be of type String.


// method with generic return type
public <T> List<T> getMyList(Class<T> elementType, List objList)
{
    List<T> list = new ArrayList<T>();
    
    for(Object obj : objList)
    list.add(elementType.cast(obj));
    
    return list;
}

// calling the method
getMyList(String.class, objList);

Monday, April 9, 2012

Creating 10.3.4 WebLogic Portal domain with different port number


Follow the steps below after Domain Configuration Wizard is completed:

1. add the following two lines in setDomainEnv.cmd with appropriate port number.
@REM Following line customized to change the port for derby
set DERBY_CMD_LINE_ARGS=-p=1529

2. Start the derby database with different port number as follows:
C:\portal-10.3.4\wlserver_10.3\common\bin\startDerby.cmd -p=1529

3. Modify database.properites with new port as follows:
derby.url=jdbc:derby://localhost:1529/weblogic_eval;create=true
derby.driver=org.apache.derby.jdbc.ClientDriver

4. Run the db script C:\portal-10.3.4\user_projects\domains\ngx_domain01\create_db.cmd

5. Modify startWeblogic.cmd as follows:
@REM Start Derby

set DERBY_DEBUG_LEVEL=0
echo #############################################################
echo DERBY_CMD_LINE_ARGS=%DERBY_CMD_LINE_ARGS%
echo #############################################################
if "%DERBY_FLAG%"=="true" (
call "%WL_HOME%\common\derby\bin\startNetworkServer.cmd" %DERBY_CMD_LINE_ARGS% >"%DOMAIN_HOME%\derby.log" 2>&1

)

6. Modify stopWeblogic.cmd as follows:
echo #############################################################
echo DERBY_CMD_LINE_ARGS=%DERBY_CMD_LINE_ARGS%
echo #############################################################
if "%DERBY_FLAG%"=="true" (
call "%WL_HOME%\common\derby\bin\stopNetworkServer.cmd" %DERBY_CMD_LINE_ARGS% >"%DOMAIN_HOME%\derbyShutdown.log" 2>&1
echo Derby server stopped.
)

7. Change the following line in config.xml for the appropriate port
jdbc:derby://localhost:1529/weblogic_eval

This is optional:
8. Change the port number in jdbc/p13nProfileDataSource-jdbc.xml folder

WebLogic Portal 10.3.4 vs WebLogic Portal 10.3.2

Few differences between WLP 10.3.4 & WLP 10.3.2:
1. First and foremost, its seems its a minor change in the version but its not. You need to install the entire WebLogic Portal 10.3.4 version and create new portal domains in 10.3.4 version to deploy your upgraded portal applications.

2. 10.3.4 uses Apache Derby database as default while 10.3.2 uses pointbase as default

3. Domain configuration wizard in 10.3.4 version is not a 100% wizard, meaning you need to start the derby database manually before checking the box "Run Scripts" while going through wizard - and Oracle is still calling this a wizard.

4. Creating two or more portal domains in WLP 10.3.4 cannot be simply achieved by changing the port numbers for Derby database, as changing port number for db configuration in wizard will not change the server start/stop scripts to listed to different port for Derby database - lot of changes are needed.
Note: Watch for upcoming postings for creating more than one portal domains.

5. Spring 3.0 version is recommended how ever applications can still use 2.5.x versions.

6. A new datasource p13nProfileDataSource-jdbc.xml is created as part of domain creation, which is not at all used - as per Oracle.

7. Eclipse has a new version 3.6.1

8. So many new types of project can be created using Eclipse "New" wizard.

9. Few ui issues are fixed in WebLogic Server Console e.g. "Ordering Authentication Providers"
and more to discover...

Good to know about these when using TFS


These points are helpful when using Microsoft TFS as enterprise repository:

1. We need to specify different labels for different projects i.e. more than one projects cannot be labelled with same label.
(TFS Eclipse client in windows doesn't throw any error while labelling different projects with same label and it works in windows however while trying to get labelled code in Linux,  it does not work)

2. Checking in code - While updating any code in TFS, make sure that the code with right label has been checked out. And after checking in, make sure the new code is labelled with the right label.

3. Deleting files from TFS - Even if the files can be deleted from TFS, they stay no matter what.
If a file XYZ is labelled and need to be deleted then label has to be removed from file XYZ and then deleted.
(File XYZ will still be available to labels other than for what it is deleted)

4. Adding and deleting folder structure is not straight forward - so take more time in designing and finalizing the folder structure. Once it is finalized then only add to TFS.

5. Adding multiple files to an existing label is again not straight forward, take more time and it requires more concentration to avoid any mistake by missing a required file to apply label. Its always better to apply label to the parent folder and then remove label from unwanted files.

6. Using "Microsoft Visual Studio 2010" has some advantages and is flexible to work with when comparing with Eclipse plugin for TFS.