Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts

Wednesday, July 27, 2016

MEC repository functions

Repository Functions are reusable Java and Boolean functions stored in Function Repository that is part of a Mapper database. Usage of repository function in MEC reduce the development time and increases the reusability.

For an example we can write a java function to send emails and add it to the mapper database as repository function. Then that function can be used in every maps those are in same mapper database.

Create repository function.

Step 1: First create your java or Boolean function.

image

Step 2: right click on function and press add to repository.

clip_image003

Step 3:

Select the location(MEC mapper database) where, repository function need be saved and click finish.

clip_image004

Now you repository function has been successfully added to mapper database and it ready to use.

Use repository functions:

Step 1:

From the Palette tab, select the Repository function element. Drag and drop it to the space between the input and output document trees. After that new reusable function window is displayed.

Select the Mapper Database location to use.

clip_image005

Step 2: Select a reusable function.

clip_image006

Once you clicked the finish the selected function is inserted to the mapping

Wednesday, May 11, 2016

MEC Custom properties file .

There are some scenarios where we need to get constant configurable values to the MEC mapper. For example sometime we have to get email addresses, database schema, user name PW like that.

For such a scenario we have few possible options

· Hard Code.

· Read From table

· Read from external text file (referred as java properties file /in .net config file ).

Hard coding is not good option because when change is needed have to modify the map and restart the MEC environment and need to seek help from technical consultant. Reading from table also good option and need to maintain separate table and all.

But reading from external file is very easy and implementation time also short.

Step 1.

Create a text file with the information that you require. In my case I want to add some email address .So my text will be like below.I will name this file as M3Properties.properties. properties will be the ext.

Then copy this file to the MEC central file location . you can keep this file anyware but when it added to the central file location its easy to access file . Other wise we have to hard code the file location .

 

image

Using below java code you can access properties file. Use this code place where you want information from properties .

String centralFileFolder = com.intentia.ec.server.DocServer.getEcProperties().getProperty("mec.central.file.path");

String PropertiesFile = centralFileFolder+"/Properties/M3Interface";
System.out.println(getClass().getName() + "[:] PropertiesFile: '" + PropertiesFile + "'");
cat.info(strUUID + "[:] PropertiesFile: '" + PropertiesFile + "'");


// Read properties file if it exists
boolean propertiesOK = false;
java.util.Properties properties = new java.util.Properties();
try {
properties.load(new java.io.FileInputStream(PropertiesFile + ".properties"));
    propertiesOK = true;
}
catch(java.io.IOException ioe){
      System.out.println("IO Error occurred reading properties file for " + getClass() + ".\n");
      System.out.println("Default values will be used.");
}

// If properties ok then get each one
if(propertiesOK){
    oemailAddress = properties.getProperty("EMAIL.FROM");   
}

com.intentia.ec.server.DocServer.getEcProperties().getProperty("mec.central.file.path") can be used to get MEC central file location path .

Tuesday, February 2, 2016

Enable log in streamserve(dsrv.log)

In some senarios control center application log file (dsrv.log) missing . dsrv.log is very important to the mom developer as it contains the all the project related errors, warning and information .without that very hard to do the developments .
image
In order to display dsrv log we should activate logging  in the relevent platform file .
Go the relevent platform in the design center .
image
right click on the platform and go to the configure platform option.
image
Here after below dialog will be displayed . under log tab check the enable logging check box and there are fiew other options whci you can configure .
image
You can define the name for log file and specifiy the log level as well.
If these setting are ok drsv log should be diplayed on your control center .
Apart from above fact there may be few another cases where dsrv log not displayed in the control center . please refer the below url for that .(from steamshare forum)
http://streamshare.streamserve.com/Forum/Topic/?topicID=4313