Search in sources :

Example 11 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class HSSClientChildSbb method updatePSIActivation.

public String updatePSIActivation(String publicIdentity, String data, String destinationRealm, String destinationHost) throws IOException {
    UserIdentityAvp publicIdentityAvp = createUserIdentityAvp(publicIdentity, null);
    ProfileUpdateRequest pur = diameterShClientMessageFactory.createProfileUpdateRequest(publicIdentityAvp, DataReferenceType.PSI_ACTIVATION, data.getBytes());
    pur.setAuthSessionState(AuthSessionStateType.NO_STATE_MAINTAINED);
    // Set destination -- Realm is mandatory, host is optional
    pur.setDestinationRealm(new DiameterIdentity(destinationRealm));
    if (destinationHost != null) {
        pur.setDestinationHost(new DiameterIdentity(destinationHost));
    }
    ShClientActivity activity = getShClientActivity();
    activity.sendProfileUpdateRequest(pur);
    // Store request for future matching
    storeRequestInACI(activity, pur);
    // Return Session-Id, may be used as identifier
    return activity.getSessionId();
}
Also used : ShClientActivity(net.java.slee.resource.diameter.sh.client.ShClientActivity) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) DiameterIdentity(net.java.slee.resource.diameter.base.events.avp.DiameterIdentity) UserIdentityAvp(net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)

Example 12 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class HSSClientChildSbb method updateRepositoryData.

public String updateRepositoryData(String publicIdentity, String data, String destinationRealm, String destinationHost) throws IOException {
    UserIdentityAvp publicIdentityAvp = createUserIdentityAvp(publicIdentity, null);
    ProfileUpdateRequest pur = diameterShClientMessageFactory.createProfileUpdateRequest(publicIdentityAvp, DataReferenceType.REPOSITORY_DATA, data.getBytes());
    pur.setAuthSessionState(AuthSessionStateType.NO_STATE_MAINTAINED);
    // Set destination -- Realm is mandatory, host is optional
    pur.setDestinationRealm(new DiameterIdentity(destinationRealm));
    if (destinationHost != null) {
        pur.setDestinationHost(new DiameterIdentity(destinationHost));
    }
    ShClientActivity activity = getShClientActivity();
    activity.sendProfileUpdateRequest(pur);
    // Store request for future matching
    storeRequestInACI(activity, pur);
    // Return Session-Id, may be used as identifier
    return activity.getSessionId();
}
Also used : ShClientActivity(net.java.slee.resource.diameter.sh.client.ShClientActivity) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) DiameterIdentity(net.java.slee.resource.diameter.base.events.avp.DiameterIdentity) UserIdentityAvp(net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)

Example 13 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShServerActivityImpl method createProfileUpdateAnswer.

/*
   * (non-Javadoc)
   * @see net.java.slee.resource.diameter.sh.server.ShServerActivity#createProfileUpdateAnswer()
   */
public ProfileUpdateAnswer createProfileUpdateAnswer() {
    // Fetch the session stored request
    ProfileUpdateRequest req = (ProfileUpdateRequest) getSessionMessage(ProfileUpdateRequest.commandCode);
    ProfileUpdateAnswer answer = null;
    if (req != null) {
        // Create answer from it
        answer = this.messageFactory.createProfileUpdateAnswer(req);
        // Add any extra session data
        addSessionData(answer);
    // Store request data FIXME: Commented by Alex. Is this needed?
    // ((DiameterShMessageImpl)answer).setData(req);
    }
    return answer;
}
Also used : ProfileUpdateAnswer(net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)

Example 14 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShClientActivityImpl method sendProfileUpdateRequest.

public void sendProfileUpdateRequest(ProfileUpdateRequest message) throws IOException {
    try {
        DiameterMessageImpl msg = (DiameterMessageImpl) message;
        clientSession.sendProfileUpdateRequest(new ProfileUpdateRequestImpl((Request) msg.getGenericData()));
    } catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
        throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
    } catch (Exception e) {
        throw new IOException("Failed to send message, due to: " + e.getLocalizedMessage());
    }
}
Also used : ProfileUpdateRequestImpl(org.jdiameter.common.impl.app.sh.ProfileUpdateRequestImpl) Request(org.jdiameter.api.Request) ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest) SubscribeNotificationsRequest(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest) UserDataRequest(net.java.slee.resource.diameter.sh.events.UserDataRequest) IOException(java.io.IOException) DiameterMessageImpl(org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException) IOException(java.io.IOException) AvpNotAllowedException(net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)

Example 15 with ProfileUpdateRequest

use of net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest in project jain-slee.diameter by RestComm.

the class ShClientMessageFactoryImpl method createProfileUpdateRequest.

public ProfileUpdateRequest createProfileUpdateRequest(UserIdentityAvp userIdentity, DataReferenceType reference, byte[] userData) {
    ProfileUpdateRequest pur = this.createProfileUpdateRequest();
    pur.setUserIdentity(userIdentity);
    pur.setDataReference(reference);
    pur.setUserData(userData);
    return pur;
}
Also used : ProfileUpdateRequest(net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)

Aggregations

ProfileUpdateRequest (net.java.slee.resource.diameter.sh.events.ProfileUpdateRequest)17 Test (org.junit.Test)8 BaseFactoriesTest (org.mobicents.slee.resource.diameter.base.tests.factories.BaseFactoriesTest)8 ProfileUpdateAnswer (net.java.slee.resource.diameter.sh.events.ProfileUpdateAnswer)7 UserIdentityAvp (net.java.slee.resource.diameter.sh.events.avp.UserIdentityAvp)4 DiameterIdentity (net.java.slee.resource.diameter.base.events.avp.DiameterIdentity)2 ShClientActivity (net.java.slee.resource.diameter.sh.client.ShClientActivity)2 SubscribeNotificationsRequest (net.java.slee.resource.diameter.sh.events.SubscribeNotificationsRequest)2 UserDataRequest (net.java.slee.resource.diameter.sh.events.UserDataRequest)2 ApplicationId (org.jdiameter.api.ApplicationId)2 DiameterShMessageImpl (org.mobicents.slee.resource.diameter.sh.events.DiameterShMessageImpl)2 IOException (java.io.IOException)1 AvpNotAllowedException (net.java.slee.resource.diameter.base.events.avp.AvpNotAllowedException)1 PushNotificationRequest (net.java.slee.resource.diameter.sh.events.PushNotificationRequest)1 Request (org.jdiameter.api.Request)1 ProfileUpdateRequestImpl (org.jdiameter.common.impl.app.sh.ProfileUpdateRequestImpl)1 DiameterMessageImpl (org.mobicents.slee.resource.diameter.base.events.DiameterMessageImpl)1 ShClientMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.client.ShClientMessageFactoryImpl)1 UserIdentityAvpImpl (org.mobicents.slee.resource.diameter.sh.events.avp.UserIdentityAvpImpl)1 ShServerMessageFactoryImpl (org.mobicents.slee.resource.diameter.sh.server.ShServerMessageFactoryImpl)1