Archive for January, 2006

Layers

Monday, January 30th, 2006


Layers
Originally uploaded by CTPEKO3A.

This is one of my best photos. I made it more than two years ago, 11th October 2003, on Lincoln road, Miami.

I like that this image has at least three layers of reflections and still is not that messy.

Insecure Screen Saver

Wednesday, January 25th, 2006

The corporate policy setting on my work notebook always sets the screen saver to 15 minutes and require login password. I don’t mind to have a screen save 15 minutes, but that login requirement… I just hate it! And I hate it mostly because the screen saver tab in the Display Properties dialog is disabled by the same policy!

Now I found the way to cheat on corporate policy - I created a simple .reg file, which will change one DWORD value:

HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop\ScreenSaverIsSecure = “0″

Ahh, back to work…

, , ,

Rational Software Architect: simple guide

Wednesday, January 25th, 2006

Everybody, who worked with Rational tools could think that there is nothing rational in them. And frustration mounts when you’ll try to read the supplied documentation. The documentation is structured, but some pages are very shallow and others do not explain topics in undestandable language.

This article is very helpful. It actually shows how to structure design files, so the design will be understandable by anyone in the project.

At the end of page is a little gem: Software Architecture Document for the project, described in the article. Very very helpful!

, , ,

Creating WebSphere 6 application MBeans

Friday, January 20th, 2006

This is a little step by step guide on how to create and register custom service with JMX interface on WebSphere:

1. Create class, which implements two interfaces:

JAVA:
  1. com.ibm.websphere.runtime.CustomService
  2. com.ibm.websphere.management.JMXManageable

2. Implement "initialize" method (inherited from CustomService)
This method has a parameter, Properties, which will contain properties defined via WS Administration console. We are interested in one property: externalConfigURLKey. This property contains path to external configuration file (if any is needed).

This is how to get the path:

JAVA:
  1. public void initialize(Properties configProperties) throws Exception {
  2.  readConfig(configProperties.getProperty(externalConfigURLKey));
  3. }

3. shutdown() method may be left blank.

4. implement getType() method (inherited from JMXManageable):

JAVA:
  1. public String getType() {
  2.  return "MyMBean";
  3. }

Remember the name you returned here!

5. implement getMBeanProperties:

JAVA:
  1. public Properties getMBeanProperties() {
  2.  Properties props = new Properties();
  3.  props.put("SpecialProperty", "value");
  4.  return props;
  5. }

I think this will return a list of properties, not declared in MBean descriptor. Read only, of course, since there is no setMBeanProperties() method.

6. implement getters and setters for properties you want to expose:

JAVA:
  1. public String getUserName() {
  2.  return this.userName;
  3. }
  4.  
  5. public void setUserName(String param) {
  6.  this.userName = param;
  7. }

7. Create MBean descriptor file, for example myTest.xml.

XML:
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE MBean SYSTEM "MBeanDescriptor.dtd">
  3. <MBean type="MyMBean">
  4.     <attribute name="UserName" type="java.lang.String" getMethod="getUserName" setMethod="setUserName" />
  5. </MBean>

IMPORTANT: Make sure that type matches the value you remembered on the step 4!

8. Compile and package. Create .jar, having descriptor in the root. Place .jar somewhere accesible for WebSphere.

9. Start WebSphere and open Administration console.

10. Go to Servers - Application Servers - yourserver - Server Infrastructure - Administration - Administration Services

11. Click on "Extension MBean providers"

12. Click on "New"

13. In the "Classpath" entry type the full path and name of your jar (created on step 8)

14. Type something memorable in two other fields and click Apply.

15. Click on "Extension MBeans" (on the left)

16. Click on "New"

17. Enter the name of MBean descriptor file (see step 7.)

for example:
myTest.xml

18. Enter the type name of your MBean. IMPORTANT: must be the same name as it was on steps 4 and 7.

19. Click Apply.

20. Go to Servers - Application Servers - yourserver - Server Infrastructure - Administration - Custom Services

21. Click New

22. Place check on "Enable service at server startup".

23. Enter full class name (with package) of your MBean class (the one we created on step 1) into "Classname" field.

24. Enter something memorable in "Display Name"

25. Enter fill path and file name of the jar file (step 8) into "Classpath".

26. If your service requires configuration file (step 2) enter full path to it into " External Configuration URL"

27. Click on Apply.

28. Click on Save (on top)

29. Click Save.

30. Restart the server.

Here are the commands, used to verify MBean from admin console:

To run console:
wsadmin.bat -conntype SOAP -port 8881

To make sure that MBean started:
$AdminControl queryNames *:*,type=>

Store MBean in Tcl variable:
set mybean [$AdminControl queryNames *:*,type=MBeanName]

See MBean description:
$Help all $mybean

See MBean attributes and values:
$AdminControl getAttributes $mybean

Set specific attribute:
$AdminControl setAttribute $mybean UserName mike

Bad Behavior has blocked 45 access attempts in the last 7 days.