IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Services and service-related functions > Access external services with adapters > Configure and using adapters > IBM WebSphere Adapters > Adapter Toolkit > Implementing code from the IBM WebSphere Adapter Toolkit > Enterprise metadata discovery general interfaces and implementation for application adapters > Enterprise metadata discovery implementation samples

WBIOutboundConnectionConfigurationImpl samples

You use this class to specify outbound connection configuration properties, including those for ResourceAdapter and ManangedConnectionFactory, for your enterprise metadata discovery implementation.

Extending WBIOutboundConnectionConfigurationImpl requires that you implement the methods described below. If that all methods that create instances of property groups should initialize them with the applied properties. You can do this with a utility method provided in the EMDUtil class as shown below after successfully constructing the property group.

if (getAppliedProperties() != null)
             EMDUtil.copyValues(getAppliedProperties(), adapterProp);


Constructor

The constructor accepts ConnectionType.

public EISSAOutboundConnectionConfiguration(WBIOutboundConnectionTypeImpl connType, PropertyNameHelper helper)
throws MetadataException {
		super(connType, helper);
		this.helper = helper;	
	}


createUnifiedProperties

The createUnifiedProperties() method returns an instance of property group that represents ManagedConnectionFactory and ResourceAdapter properties together in a consolidated property group. Property groups required for discovery might differ from those needed at run time. Accordingly, this method can check isSupportedInMetadataService and then create the corresponding property groups. IBM Integration Designer uses this method to display the first connection configuration screen for enterprise metadata discovery.

	public PropertyGroup createUnifiedProperties() {
		
		WBIPropertyGroupImpl propGroup = null;
		try {
			if (this.getOutboundConnectionType().isSupportedInMetadataService()) {

				propGroup = new WBIPropertyGroupImpl("Connection Properties");
				propGroup.setDisplayName(helper.getPropertyName("ConnectionProperties"));
				propGroup.setDescription(helper.getPropertyDescription("ConnectionProperties"));
				
				WBIFolderProperty propFolder = new WBIFolderProperty("XSDFolder",  java.io.File.class);
				propFolder.setRequired(true);
				propFolder.setMustExist(true);
				propFolder.setDisplayName(helper.getPropertyName("XSDFolder"));

				propFolder.setDescription(helper.getPropertyDescription("XSDFolder"));
				
				propGroup.addProperty(propFolder);
				
			} else {
				propGroup = (WBIPropertyGroupImpl) createManagedConnectionFactoryProperties();
				
				PropertyGroup adapterProp = createResourceAdapterProperties();

				if(adapterProp != null){
					WBISingleValuedPropertyImpl logProp = (WBISingleValuedPropertyImpl)
 adapterProp.getProperties()[0];
					if (logProp != null)
					{
						logProp.setValue(EISSAConstants.VTA_ADAPTERID);
					} 					propGroup.addProperty(adapterProp);
				} 
			} 			if (this.getOutboundConnectionType().isSupportedInMetadataService() && 
(getAppliedProperties() != null)) {
				EMDUtil.copyValues(getAppliedProperties(), propGroup);
			} 
		} catch (Exception e) {
			
			throw new RuntimeException(e.getMessage(), e);
		} 		
		
		return propGroup;
	}


createResourceAdapterProperties

The createResourceAdapterProperties method returns an instance of PropertyGroup that represents properties you can configure for the ResourceAdapter bean. The getPropertyGroup() method, provided in the EMDUtil class, fetches the properties for the base class WBIResourceAdapter bean. Then the enterprise metadata discovery implementation can add its own specific properties to the ResourceAdapter bean class.

public PropertyGroup createResourceAdapterProperties() {
		WBIPropertyGroupImpl propGroup = null;
		try {
			EISSAResourceAdapter ra = new EISSAResourceAdapter();
			EMDUtil util = new EMDUtil();
			propGroup = (WBIPropertyGroupImpl) util.getPropertyGroup(ra, helper);

			propGroup.setExpert(true);
			if (getAppliedProperties() != null && propGroup != null)
				EMDUtil.copyValues(getAppliedProperties(), propGroup);
		} catch (Exception e) {
			throw new RuntimeException(e.getMessage(), e);
		} 
		
		return propGroup;
	}


createManagedConnectionFactoryProperties

The createManagedConnectionFactoryProperties method returns an instance of PropertyGroup that represents properties that you can configure for the ManagedConnectionFactory bean. The getPropertyGroup() method, provided in the EMDUtil class, fetches the properties for the base class WBIManagedConnectionFactory bean. As with the ResourceAdapter bean, the enterprise metadata discovery implementation can add its own specific properties to the ManagedConnectionFactory bean class.

	public PropertyGroup createManagedConnectionFactoryProperties() {
		
		WBIPropertyGroupImpl propGroup = null;
		try {
			propGroup = new WBIPropertyGroupImpl("Connection Properties");
			propGroup.setDisplayName(helper.getPropertyName("ConnectionProperties"));
			propGroup.setDescription(helper.getPropertyDescription("ConnectionProperties"));

			WBIPropertyGroupImpl mcPG = new WBIPropertyGroupImpl("MachineCredentials",  helper); 
			mcPG.setDisplayName(helper.getPropertyName("MachineCredentials"));
			mcPG.setDescription(helper.getPropertyDescription("MachineCredentials")); 

			WBISingleValuedPropertyImpl prop = new WBISingleValuedPropertyImpl
("Hostname", String.class);
			prop.setRequired(true);
			prop.setDisplayName(helper.getPropertyName("HostName"));  
			prop.setDescription(helper.getPropertyDescription("HostName"));
			prop.setValue("localhost");
			mcPG.addProperty(prop);
			prop = new WBISingleValuedPropertyImpl("Portnumber", String.class);
			prop.setRequired(true);
			prop.setDisplayName(helper.getPropertyName("Port"));  
			prop.setDescription(helper.getPropertyDescription("Port"));
			prop.setValue("9000");
			mcPG.addProperty(prop);
			
			propGroup.addProperty(mcPG);

			
			if (getAppliedProperties() != null)
				EMDUtil.copyValues(getAppliedProperties(), propGroup);

		} catch (Exception e) {
			
			throw new RuntimeException(e.getMessage(), e);
		} 		return propGroup;
	}

Enterprise metadata discovery implementation samples