What does this attribute array do in this java code snippet?

What does this attribute array do in this Java Snippet?
public Attribute[] writeSessionLog(Session session) throws ManagementSupportException {

            TEServiceStub.SaveSession request = new TEServiceStub.SaveSession();

            //create Attribute from the session
            TEServiceStub.AttributeArray array = new TEServiceStub.AttributeArray();

            TEServiceStub.Attribute hwVersion = new TEServiceStub.Attribute();

            TEServiceStub.Attribute startTime = new TEServiceStub.Attribute();
            //FIXME: what format the time should be?
            startTime.setValue(session.getStartTime() == null ? new Date().toString() : session.getStartTime().toString());

            TEServiceStub.Attribute finishTime = new TEServiceStub.Attribute();
            finishTime.setValue(session.getFinishTime() == null ? new Date().toString() : session.getFinishTime().toString());

            TEServiceStub.Attribute tester = new TEServiceStub.Attribute();

            TEServiceStub.Attribute testEvent = new TEServiceStub.Attribute();

            TEServiceStub.Attribute testOrg = new TEServiceStub.Attribute();


            TEServiceStub.RequestStatus status = null;
            TEServiceStub.SaveSessionResponse response = null;
                  response = stub.saveSession(request);
                  status = response.getStatus();
            } catch(Exception e) {
                  logger.warn("Fail to call TEService :" + e);
                  throw new ManagementSupportException("Fail to call TEService :" + e);

            if(!status.getSuccess()) {
                  logger.warn("TEService return failure while call saveSession()");
                  throw new ManagementSupportException("TEService return failure while call saveSession()");

            return cast(response.getAttributes());
Who is Participating?
elfe69Connect With a Mentor Commented:
I do not know what TEServiceStub does, but as I see, array is used to store an array of attributes in the HTTP session (in order to retrieve those attributes later).
zzynxConnect With a Mentor Software engineerCommented:
1. All kind of attributes are stored in the array

>> array.addAttributes(hwVersion);
>> ...
>> array.addAttributes(startTime);
>> ...
>> ...
>> array.addAttributes(testOrg);

2. Then the array is set as an attribute on 'request'
    That way all the attributes are passed to the party that made the request

>> request.setAttributes(array);
zzynxSoftware engineerCommented:
thanx 4 axxepting
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.