Create a SpringApplicationContext service for legacy code

Guillaume applied changes to "Delete WebCryptography. Have all code use the EncryptionService instead. Also create a SpringApplicationContext service so that legacy code (where instances are not created by spring) can access the spring application context and lookup beans."

hal-ejb/src/main/java/com/hal/sf/service/SpringApplicationContext.java

SpringApplicationContext.java

Code using the above legacy class, need the following:

Declarations

import com.hal.sf.service.SpringApplicationContext;
import com.hollandamerica.common.encryption.EncryptionService;
private EncryptionService encryptionService;

Inside Construction

encryptionService =(EncryptionService) SpringApplicationContext.getBean("encryptionService");

Sample Code Usage

String newCCN = encryptionService.decrypt(encrypted);
String previousCCN = encryptionService.decrypt(previous);

Delete the merge info, when problems with integration

Real World Fix (See below for original email with details)

Three steps to accomplish the task, the first one shows you are in the right place, the second actually deletes all merge info and the final step reverts back the merge info for the root folder:

Use this to see if there is a problem:

svn propget -R svn:mergeinfo .

And then the following to fix it:

[~/tmp/trunk]$  svn status
[~/tmp/trunk]$  svn propdel svn:mergeinfo -R .
[~/tmp/trunk]$  svn revert .

Example:

svn pd svn:mergeinfo halwebsite/js/jquery/date.js

From subversion Wiki:

Reintegration Problem

At certain times, you get the following error, even though you have merged trunk changes to branch:

svn: Cannot reintegrate from 'https://some.server/branches/branch' yet:
Some revisions have been merged under it that have not been merged into the reintegration target; merge them first, then retry.

Older versions of subversion seem to cause mergeinfo problems with mergeinfo properties for individual files. This problem can be detected by recursively listing properties in the branch:

svn pl -R $SVN/branches/branch/|egrep -B 4 svn:mergeinfo

If individual files and subdirectories have mergeinfos, you can delete them:

svn pd -R svn:mergeinfo branch/subdirectory_with_mergeinfo/

and commit the changes.

-----Original Message-----
From: Guillaume Radde [mailto:guillaume.radde@redhat.com]
Sent: Tuesday, July 10, 2012 9:26 AM
To: Ruckman, Maurice (HAL)
Cc: Fillman, Eric (HAL); Thompson, Sonya (HAL)
Subject: Deleting mergeinfo

To delete svn:mergeinfo from all files and folder except the parent folder:

-----------------------------------------------------------------
[jboss1@haldevjbs05 ~/tmp/trunk]$  svn status
[jboss1@haldevjbs05 ~/tmp/trunk]$  svn propdel svn:mergeinfo -R .
property 'svn:mergeinfo' deleted from '.'.
property 'svn:mergeinfo' deleted from 'hal-ejb/src/main/java/com/sbn/shx/util/SbnShxIconUtil.java'.
svn: Attempting to delete nonexistent property 'svn:mergeinfo'
[jboss1@haldevjbs05 ~/tmp/trunk]$  svn revert .
Reverted '.'
[jboss1@haldevjbs05 ~/tmp/trunk]$  svn status
M      hal-ejb/src/main/java/com/sbn/shx/util/SbnShxIconUtil.java
[jboss1@haldevjbs05 ~/tmp/trunk]$
-----------------------------------------------------------------

-------------------------------------
Guillaume Radde
Senior Consultant, Red Hat Consulting
guillaume.radde@redhat.com
http://www.redhat.com
-------------------------------------

How to make your VM think it is www.hollandamerica.com

From: Mario Hartman [mailto:mhartman@hexacta.com]
Sent: Tuesday, May 29, 2012 10:44 AM
To: Ruckman, Maurice (HAL); Augustine, Anila (HAL); Mirza, Masood (HAL Contractor); Fillman, Eric (HAL)
Cc: Sankar, Kousalya (HAL); Brace, Jannette (HAL Contractor); Florencia Castro; Thompson, Sonya (HAL); Daniela Greca
Subject: RE: Sample JSP with IFrame to Bazaar Voice on the network server

Hi,
These are the changes I made to trick my server into thinking that we are under the domain www.hollandamerica.com

1 - Go to /etc/httpd/conf/httpd.conf file and change your virtual host in this way

### Section 3: Virtual Hosts
NameVirtualHost www.hollandamerica.com:80
<VirtualHost www.hollandamerica.com:80>
DocumentRoot "/home/jboss1/HAL/halwebsite"
ServerName www.hollandamerica.com:80
ErrorLog logs/error.log
JkMountFile conf/uriworkermap.properties
SSLEngine off
</VirtualHost>

NameVirtualHost www.hollandamerica.com:443
<VirtualHost www.hollandamerica.com:443>
DocumentRoot "/home/jboss1/HAL/halwebsite"
ServerName www.hollandamerica.com:443
ErrorLog logs/ssl_error.log
JkMountFile conf/uriworkermap.properties
#CustomLog logs/ssl_access.logcombined
SSLEngine on
SSLCertificateFile "/etc/httpd/conf/ssl/hq.halw.com.crt"
SSLCertificateKeyFile "/etc/httpd/conf/ssl/hollandamerica.com.key"
</VirtualHost>

Also in this file change your server name to: ServerName www.hollandamerica.com.com:80

2 - Change the following line in your hosts file (/etc/hosts) to looks like the following line
127.0.0.1             www.hollandamerica.com localhost

3 - Change your /etc/sysconfig/network file  and set the hostname as:
HOSTNAME=www.hollandamerica.com

After that, restart your network service, restart your apache instance and your jboss server.

If everything  went well, you will be able to access your local server using www.hollandamerica.com in your webbrowser.
If anyone think that we can reach the same goal with less changes or with a better configuration please let me know.

Thanks

Mario

Mario Andres Hartman
Phone 54+343+423 6141
San Martín 902, E3100AAT, Paraná, Argentina
Think Green - Please do not print this email unless you really need to

Fixing serialization Errors – Example

Refer: com/hollandamerica/checkin/action/EdocsHelper.java

Please see the following code stubs for example coding changes required:

import com.halw.util.SerializableByteArrayOutputStream;

* <li>mlr 03-12.2012
* <ul>
* <li>Marking several class variables transient in attempt to fix serialization
* error when converting to JBoss with session persistance.</li>
* </ul>
* </li>

private transient boolean checkinComplete = false;

from:
private transient ByteArrayOutputStream baosFinal = new ByteArrayOutputStream();

to:
private transient SerializableByteArrayOutputStream baosFinal = new SerializableByteArrayOutputStream();

New pattern to toggle features in JSP

From: Thompson, Sonya (HAL)
Sent: Thursday, May 24, 2012 9:19 AM
To: Ruckman, Maurice (HAL); Fillman, Eric (HAL); Phatak, Sheetal (HAL); Klein, Brian (HAL); Bojja, Sridhar (HAL Contractor)
Cc: Augustine, Anila (HAL)
Subject: RE: New feature to toggle features in JSP

I've also created a FeatureToggleHelper.java with getFeatureToggle() and getFeatureToggleAsString() methods.
This helper knows where the featureToggles.xml file is located & appends the "toggles.{environment}." To the front of whatever key is passed in.
However, this will not be avail until I merge it into 12.23

From: Ruckman, Maurice (HAL)
Sent: Thursday, May 24, 2012 7:31 AM
To: Fillman, Eric (HAL); Thompson, Sonya (HAL); Phatak, Sheetal (HAL); Klein, Brian (HAL); Bojja, Sridhar (HAL Contractor)
Cc: Augustine, Anila (HAL)
Subject: RE: New feature to toggle features in JSP

To supplement this effort, here is an example of how to access our XML in the back-end Java code to drive logic:
Refer: hal-ejb/src/main/java/com/hal/sf/olci/page/AcceptPrintTermsPage.java

if ( StaticXmlDataList.getInstance().getStaticXmlFileMap().get(
"web.copy.olci.acceptTerms_logic.xml" ).get(
"page.EUTerms." + guestCountry ) != null )
{
setEuropeanUnion( true );
}
else
{
setEuropeanUnion( false );
}
From: Fillman, Eric (HAL)
Sent: Friday, May 18, 2012 4:09 PM
To: Thompson, Sonya (HAL); Phatak, Sheetal (HAL); Ruckman, Maurice (HAL); Klein, Brian (HAL); Bojja, Sridhar (HAL Contractor)
Cc: Augustine, Anila (HAL)
Subject: New feature to toggle features in JSP

Hi.

Sonya and I put together a little process that will allow you to control when a new feature or new code will be used.
It starts with a  file in Teamsite called featureToggles.xml, and it's in the web/copy/features directory.

Here's a very condensed sample of what the file looks like:

<toggles>

<!-- Use the following section to control how features will be enabled in the non-production environments -->

<nonProd>
<displayGroupExcursions><![CDATA[true]]></displayGroupExcursions>
</nonProd>

<!-- Use the following section to control how features will be enabled in the PRODUCTION environment -->

<prod>
<displayGroupExcursions><![CDATA[false]]></displayGroupExcursions>
</prod>

</toggles>

Essentially there are two sections - <nonProd> and <prod>.  <prod> would be used for production, <nonProd> will be used for everything else.  Within each you define an element and indicate whether that feature will be used/displayed/etc. within the JSP.  In the example above, <displayGroupExcursions> can be used to control the group excursion functionality.  It's currently set to true for nonProd so group excursion features will display there, but false for prod.

This way we can push code to dev, test, and prod, and have the features available in dev and test, but not prod.  Once the OK is given for prod, we just need to change the XML and push that through Teamsite.  If we need to shut a feature off for some reason in prod, we can do that too.

To use the featureToggles.xml, you just need to include a reference to it in the JSP like we do for all the static content XML files:

<s:set var="featureMap" value="#application.staticXmlDataList.staticXmlFileMap['web.copy.features.featureToggles.xml']"/>

Then in the JSP code, add an if statement to check the value of your feature name:

<s:if test="#featureMap['toggles.' + featureEnv + '.displayGroupExcursions'] == 'true'">
<!-- These are Group Excursions!-->
<s:if test="%{!getShxGroupTourBizList().isEmpty()}">

// Do something here

</s:if>
</s:if>

Notice the featureEnv variable in the highlighted line above.  We added a method to the BaseAction class called getFeatureEnv() that will return a string value of either nonProd or prod depending on the environment variable set in the System Properties.  If environment is prd, it returns prod, otherwise it returns nonProd.  As long as your JSP is called from an Action that extends BaseAction (which I think everything is the new flows do), your JSP should have access to featureEnv.

You should also be capable of accessing the XML file directly from an action if you want to control which methods are being called from a service or something, but we didn't get that far with it.

The code is in 12.21-RC, so it should go to prod next week.

Let me or Sonya know if you have any questions.

Thanks.

Eric

256 bit encryption for Safenet

-----Original Message-----
From: Guillaume Radde [mailto:guillaume.radde@redhat.com]
Sent: Tuesday, May 22, 2012 6:11 PM
To: Ruckman, Maurice (HAL)
Cc: Hoggard, Chad (HAL); Augustine, Anila (HAL); HAL DistList: IS UNIX
Subject: 256 bit encryption for Safenet

(Added missing link)

Below are the steps to enable 256 bits encryption. This would need to be done on all JBoss servers and developer-vms.

1) Don't listen to instruction from non-RedHat sources, they pretty much all make you break your RHEL java rpm install, which will cause problem during the next java update.

2) Download the "Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files" from [1]. Accept the license on the page and download jce_policy-6.zip.

3) Unzip the zip content into /opt. Your folder structure should look like this:

/opt/jce
/opt/jce/local_policy.jar
/opt/jce/US_export_policy.jar

3a) After you copy the files into /opt/jce you should change the ownership to root
chown -R root.root jce

4) Run the following command as root:
sudo su -
rm -f /usr/lib/jvm/jre-1.6.0-sun.x86_64/lib/security/{local,US_export}_policy.jar && update-alternatives --install /usr/lib/jvm/jre-1.6.0-sun.x86_64/lib/security/local_policy.jar jce_1.6.0_sun_local_policy.x86_64 /opt/jce/local_policy.jar 160200 --slave /usr/lib/jvm/jre-1.6.0-sun.x86_64/lib/security/US_export_policy.jar jce_1.6.0_sun_us_export_policy.x86_64 /opt/jce/US_export_policy.jar

5) Now update to the new links, choose option 2:

update-alternatives --config jce_1.6.0_sun_local_policy.x86_64

6) That's it :-)

[1] http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html

-------------------------------------
Guillaume Radde
Senior Consultant, Red Hat Consulting
guillaume.radde@redhat.com
http://www.redhat.com
-------------------------------------

Notes: You are updating the links with step #4.  For example, before changes:

[root@haldevjbs04 /opt/jce]$  ls -l /etc/alternatives | grep -i jce
lrwxrwxrwx 1 root root 71 Feb  1 12:41 jce_1.6.0_sun_local_policy.x86_64 -> /usr/lib/jvm-private/java-1.6.0-sun.x86_64/jce/vanilla/local_policy.jar
lrwxrwxrwx 1 root root 75 Feb  1 12:41 jce_1.6.0_sun_us_export_policy.x86_64 -> /usr/lib/jvm-private/java-1.6.0-sun.x86_64/jce/vanilla/US_export_policy.jar