Upgrading Projects to 1.4/2.0 From Previous Versions

Some changes have been made in the 1.4 and 2.0 releases that require the user to modify their existing projects to work correctly.

Convert Project Nature

All ESB and Service Assembly projects that are imported into the 1.4 or 2.0 workspace must be converted to the latest project nature. This is done by right clicking on the project after it is imported and selecting "Convert Project Nature" -> "Convert to Project of Latest Version". This step will make modifications to some of the files in the project to make them compatible with the current version. An example is all password settings are now encrypted, so unencrypted passwords from pre-1.4 files are encrypted and saved during this step.
Convert Project Nature

Custom Code Modifications

If your existing projects contain any custom code (UPOC, Script, User Map Operation, etc), then you will need to make a small change to each custom class. The interface to these has changed to include two new methods that must be added to existing code:
public String getName()
public String getDescription()
These methods can be added by Eclipse automatically by opening the java file and clicking on the red X on the left that indicates the error. This will give the choice to "Add unimplemented methods". When this is selected, Eclipse will add these two methods to the class. You may then fill in name and description text for these methods to return, or leave them blank.
Eclipse Autofix for custom code

Map Filters in the Default Java Package

Custom Map Filters that are defined in the default java package (no package declaration) are no longer supported. If your project contains map filter classes that are in the default package, you must move them to a named package (such as com.bostechcorp.cbesb.map.filter). Then modify all maps that reference these filters to select the new location of the class. If this is not done, you will receive a build error on the maps that reference the affected filters.

Custom Component Modifications

Any custom component that was created prior to 1.4 M2 will require changes in order for it to work properly with the ChainBuilder ESB Admin Console. After importing the existing Custom Component project into the 1.4 or 2.0 workspace, the component's endpoint class will have an error that it needs to implement three methods. These new methods that need to be added are:
public CbEndpointProperty[] getGetableProperties() 
public String getPropertyValue(int index)
void setPropertyValue(int index, String value)
Eclipse can automatically add these methods to the endpoint class by clicking on the red X on the left the same way as for custom code in the previous section. Select "Add unimplemented methods" and Eclipse will add the three missing methods to the class.
Eclipse Autofix for Custom Component Endpoint class

Next, a new Java Enumeration needs to be created in the same package as the endpoint class. This enumeration will have a constant for each endpoint property exposed in the Admin Console. Here is an example that contains three properties, a text property, an enum property and a boolean property. Use this as a template and modify it to include all of the properties for your component.

package com.bostech.corporation.component.examplecomponent;

import com.bostechcorp.cbesb.runtime.ccsl.jbi.messaging.CbEndpointProperty;

public enum ExampleComponentPropertiesEnumeration {

	MyProperty1 {
		//This is an example Text type property
		
		String getValue(ExampleComponentEndpoint endpoint) {
			return endpoint.getMyProperty1();
		}

		void setValue(ExampleComponentEndpoint endpoint, Object value) {
			if (isSetable()) {
				String val = ((String)value).trim();
				endpoint.setMyProperty1(val);
			}
		}

		public boolean isSetable() {
			return true;
		}
		
		public String getType(){
			return CbEndpointProperty.TYPE_TEXT;
		}

		public String[] getValues() {
			return null;
		}

		public String getName() {
			return "MyProperty1";
		}

	},
	MyProperty2 {
		//This is an example Enum type property
		
		String getValue(ExampleComponentEndpoint endpoint) {
			return endpoint.getMyProperty2();
		}

		void setValue(ExampleComponentEndpoint endpoint, Object value) {
			if (isSetable()) {
				String val = ((String)value).trim();
				endpoint.setMyProperty1(val);
			}
		}

		public boolean isSetable() {
			return true;
		}
		
		public String getType(){
			return CbEndpointProperty.TYPE_ENUM;
		}

		public String[] getValues() {
			return new String[]{"EnumValA","EnumValB","EnumValC"};
		}

		public String getName() {
			return "MyProperty2";
		}
	},
	MyProperty3 {
		//This is an example Boolean type property
		
		String getValue(ExampleComponentEndpoint endpoint) {
			//Use this form if endpoint property is a String
			return endpoint.getMyProperty3();
			
			//Use this form if endpoint property is a boolean
			// return (endpoint.isMyProperty3()) ? "TRUE" : "FALSE";
		}

		void setValue(ExampleComponentEndpoint endpoint, Object value) {
			//Use this form if endpoint property is a String
			if (isSetable()) {
				String val = ((String)value).trim();

				//Use this form if endpoint property is a String
				endpoint.setMyProperty1(val);
				
				//Use this form if endpoint property is a boolean
				// endpoint.setMyProperty3("TRUE".equalsIgnoreCase(val));
				
			}
		}

		public boolean isSetable() {
			return true;
		}
		
		public String getType(){
			return CbEndpointProperty.TYPE_BOOLEAN;
		}

		public String[] getValues() {
			return null;
		}

		public String getName() {
			return "MyProperty3";
		}
	}
	;
	
	 abstract String getValue(ExampleComponentEndpoint endpoint);

	 abstract void setValue(ExampleComponentEndpoint endpoint, Object value);

	 abstract public boolean isSetable();

	 abstract public String getType();

	 abstract public String[] getValues();
	 
	 abstract public String getName();	
	 
	 public CbEndpointProperty convertToEndpointProperty(ExampleComponentEndpoint endpoint){
			CbEndpointProperty property=new CbEndpointProperty();
			property.setName(getName());
			property.setSetable(isSetable());
			property.setType(getType());
			property.setValue(getValue(endpoint));
			property.setValues(getValues());
			return property;
	}

}

Now, you can add the logic in the three methods that were added to the endpoint class. Here is an example of the logic.

	@Override
	public CbEndpointProperty[] getGetableProperties() {
  		List<CbEndpointProperty> result = new Vector<CbEndpointProperty>();

   		ExampleComponentPropertiesEnumeration[] properties = ExampleComponentPropertiesEnumeration.values();
   		for (int i = 0; i < properties.length; i++) {
   			result.add(properties[i].convertToEndpointProperty(this));
   		}
   		return result.toArray(new CbEndpointProperty[] {});
	}

	@Override
	public String getPropertyValue(int index) {
		return ExampleComponentPropertiesEnumeration.values()[index].getValue(this);
	}

	@Override
	public void setPropertyValue(int index, String value) {
		ExampleComponentPropertiesEnumeration.values()[index].setValue(this,value);
	}

Once these changes are made, you should be able to rebuild the custom component and use it in Chainbuilder ESB 1.4 or 2.0.

  Page Info My Prefs Log in
This page (revision-13) last changed on 13:58 01-Oct-2008 by MarkPreston.
 
JSPWiki v2.4.100