cancel
Showing results for 
Search instead for 
Did you mean: 

Port Status via Java API

Former Member
0 Kudos

Hi,

Is there a way to retrieve the status of MDM Port using Java API? I could find only the possible values for a port but not to retrieve the status for a port.

Any help is appreciated.

Regards,

Dev.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi barathi,

I guess your requirement is to find status of perticular repository which is bound for particular port;

There is no provision to know port status in MDM JAVA API directly;

instead , since every port is bound to one Repository , you can look for Repository status; ( every repository will have its own and unique Port number)

the following code may help you , how to get the status

GetRepositoryStatusCommand command;

try {

command = new GetRepositoryStatusCommand ( get connection here ); // need to get rep connection

command.setSession(get autunticated user session ); // get Authenticated user session here

command.execute();

System.out.println (" Rep/Port Status Description = " +repStatus.getDescription() ) ;

System.out.println (" Rep/Port Status = " +repStatus.getStatus() ) ;

} catch (ConnectionException e) {

e.printStackTrace();

} catch (CommandException e) {

e.printStackTrace();

}

}

Note : - the above code is to give an Idea how to get the status ;

the method repStatus.getStatus() will return one of the following status codes;

static int DELETED

DELETED indicates the repository was deleted.

static int INVALID

INVALID indicates the repository in a invalid state.

static int LOADING

LOADING indicates the repository is in the process of loading.

static int MODIFYING

MODIFYING indicates the repository being modified.

static int NEWER

NEW indicates the repository newer than the current version of the server.

static int OLDER

OLDER indicates the repository is out of date.

static int PRELOADED

PRELOAD indicates the repository was preloaded.

static int RUNNING

RUNNING indicates the repository loaded.

static int STOPPED

STOPPED indicates the repository is not loaded.

if you need furthur help , please let me know;

Rajasekhar K

Former Member
0 Kudos

Thanks Raja for your inputs. But my query was related to status for a port. I can have PortStatuses such as Blocked, Locked, Has Exception etc... Can I achieve this using Java API?

I understand that we can get status of a rep. But am more interested in Port...

Former Member
0 Kudos

Barati,

I understand now that you are looking for the Port Status related to InBound & OutBound Ports ( Import&Syndication);

I think you need to deal some thing as follows;

1- implement com.sap.mdm.notification.RepositoryListener

2- importProcessed(ImportEvent event) method should be able to help; // This method will be Triggered when ever Event is changed

3- using ImportEvent object , you can check for the status using the folowing boolean methods

boolean isPortBlocked()

Indicate if the port is blocked

boolean isPortHasException()

Indicate if the port has files in Exception directory

boolean isPortHasReady()

Indicate if the port has files in Ready directory

boolean isPortLocked()

Indicate if the port is locked

As I didt work on this scenario , I dont have exact code with me;

I hope the above approach should solve the case;

once you are done with the case , could you please let me know?

Thanks

Rajasekhar K

Former Member
0 Kudos

Thanks... that did the trick. Am able to retrieve the statuses.

Answers (0)