/** * @return */ private ServerTransaction getRegisterTransactionToReply() { ActivityContextInterface[] acis = this.sbbContextExt.getActivities(); Object activity = null; for (ActivityContextInterface aci : acis) { activity = aci.getActivity(); if (activity instanceof ServerTransaction) { // detach to not handle the activity end aci.detach(sbbContextExt.getSbbLocalObject()); return (ServerTransaction) activity; } } return null; }
public Object getActivity() { return this.aci.getActivity(); }
public void onStartServiceEvent( javax.slee.serviceactivity.ServiceStartedEvent event, ActivityContextInterface aci) { tracer.info("Retreiving www.telestax.com..."); try { HttpClientNIORequestActivity activity = httpClientRA.execute( new HttpGet("http://www.telestax.com"), null, System.currentTimeMillis()); httpClientACIF.getActivityContextInterface(activity).attach( sbbContext.getSbbLocalObject()); } catch (Exception e) { tracer.severe("failed to retrieve webpage", e); } }
public void onAnnouncementComplete(MsLinkEvent evt, ActivityContextInterface aci) { try { ChildRelation childRelation = this.getLoopbackSbb(); Conversation loopback = (Conversation) childRelation.create(); logger.info("Starting loopback"); sbbContext.getActivities()[0].attach(loopback); loopback.startConversation(this.getUserEndpoint()); } catch (CreateException e) { MsConnection connection = (MsConnection) sbbContext.getActivities()[0].getActivity(); connection.release(); } }
setSubscribeRequestTypeCMP(SubscribeRequestType.NEW); aci.attach(this.sbbContext.getSbbLocalObject()); aci.detach(this.sbbContext.getSbbLocalObject()); ((DialogActivity) aci.getActivity()).delete();
public void onAppUsageAddedEvent(AppUsageAddedEvent event, ActivityContextInterface aci) { aci.detach(sbbContext.getSbbLocalObject()); if (!event.getAuid().equals(XCAPCapsAppUsage.ID)) { // update xcap caps global doc try { updateXCAPCapsGlobalDoc(); } catch (InternalServerErrorException e) { tracer.severe("failed to update xcap caps global doc", e); } } }
public Object getActivity() { return this.aci.getActivity(); }
/** * Simple method to create JDBC activity and execute given task. * * @param queryJDBCTask */ private void executeTask(DataSourceJdbcTask jdbcTask) { JdbcActivity jdbcActivity = jdbcRA.createActivity(); ActivityContextInterface jdbcACI = jdbcACIF .getActivityContextInterface(jdbcActivity); jdbcACI.attach(sbbContextExt.getSbbLocalObject()); jdbcActivity.execute(jdbcTask); }
private void finishMediaSessionSetup( ActivityContextInterface networkConnectionAci) throws MsControlException { NetworkConnection connection = (NetworkConnection) networkConnectionAci .getActivity(); MediaSession session = connection.getMediaSession(); MediaGroup mediaGroup = session .createMediaGroup(MediaGroup.PLAYER_RECORDER_SIGNALDETECTOR); connection.joinInitiate(Direction.DUPLEX, mediaGroup, "context"); ActivityContextInterface mediaGroupACI = mscRaAciFactory .getActivityContextInterface(mediaGroup); mediaGroupACI.attach(sbbContext.getSbbLocalObject()); setMediaGroupACI(mediaGroupACI); }
public void onAppUsageRemovedEvent(AppUsageRemovedEvent event, ActivityContextInterface aci) { aci.detach(sbbContext.getSbbLocalObject()); if (!event.getAuid().equals(XCAPCapsAppUsage.ID)) { // update xcap caps global doc try { updateXCAPCapsGlobalDoc(); } catch (InternalServerErrorException e) { tracer.severe("failed to update xcap caps global doc", e); } } }
private void releaseMediaConnectionAndDialog() { ActivityContextInterface[] activities = sbbContext.getActivities(); SbbLocalObject sbbLocalObject = getSbbContext().getSbbLocalObject(); MsConnection msConnection = null; for (ActivityContextInterface attachedAci : activities) { if (attachedAci.getActivity() instanceof Dialog) { attachedAci.detach(sbbLocalObject); attachedAci.detach(this.getParentCmp()); } if (attachedAci.getActivity() instanceof MsConnection) { attachedAci.detach(sbbLocalObject); msConnection = (MsConnection) attachedAci.getActivity(); attachedAci.detach(this.getParentCmp()); } } if (msConnection != null) { msConnection.release(); } }
public Object getActivity() { return this.aci.getActivity(); }
/** * Simple method to create JDBC activity and execute given task. * * @param jdbcTask */ private void executeTask(SimpleJdbcTask jdbcTask) { JdbcActivity jdbcActivity = jdbcRA.createActivity(); ActivityContextInterface jdbcACI = jdbcACIF.getActivityContextInterface(jdbcActivity); jdbcACI.attach(sbbContextExt.getSbbLocalObject()); jdbcActivity.execute(jdbcTask); }
private void finishMediaSessionSetup( ActivityContextInterface networkConnectionAci) throws MsControlException { NetworkConnection connection = (NetworkConnection) networkConnectionAci .getActivity(); MediaSession session = connection.getMediaSession(); MediaGroup mediaGroup = session .createMediaGroup(MediaGroup.PLAYER_RECORDER_SIGNALDETECTOR); connection.joinInitiate(Direction.DUPLEX, mediaGroup, "context"); ActivityContextInterface mediaGroupACI = mscRaAciFactory .getActivityContextInterface(mediaGroup); mediaGroupACI.attach(sbbContext.getSbbLocalObject()); setMediaGroupACI(mediaGroupACI); }
public void onOrderCancelled(CustomEvent event, ActivityContextInterface ac) { logger.info("======== OrderDeliverDateSbb ORDER_CANCELLED ========"); if (this.getTimerID() != null) { timerFacility.cancelTimer(this.getTimerID()); ac.detach(getSbbContext().getSbbLocalObject()); } }
public void onTimerEvent(TimerEvent timer, ActivityContextInterface aci) { // detach from this activity, we don't want to handle any other event on it aci.detach(this.sbbContextExt.getSbbLocalObject()); if (tracer.isInfoEnabled()) { tracer.info("[--] " + sidString + " Forcing Activity Termination '" + aci.getActivity() + "' due to timeout expire."); } // TODO: allow for different options, such as sending a RAR request. ((RoServerSessionActivity) aci.getActivity()).endActivity(); }
private ServerTransaction getServerTransaction() { ActivityContextInterface[] activities = sbbContext.getActivities(); for (ActivityContextInterface activity : activities) { if (activity.getActivity() instanceof ServerTransaction) { return (ServerTransaction) activity.getActivity(); } } return null; }
/** * Init the xmpp connection to GOOGLE TALK when the service is activated by * SLEE * * @param event * @param aci */ public void onStartServiceEvent( javax.slee.serviceactivity.ServiceStartedEvent event, ActivityContextInterface aci) { try { // connect to google talk xmpp server XmppConnection connection = xmppSbbInterface.connectClient( connectionID, serviceHost, servicePort, serviceName, username, password, resource, Arrays .asList(packetsToListen)); xmppActivityContextInterfaceFactory.getActivityContextInterface( connection).attach(sbbContext.getSbbLocalObject()); } catch (XMPPException e) { tracer.severe("Connection to server failed!",e); } }
/** * Starts dialog. * * @param endpointName the user's endpoint. * @param aci the user's activity context interface. */ public void startConversation(String endpointName) { logger.info("Joining " + endpointName + " with " + LOOP_ENDPOINT); MsConnection connection = (MsConnection) sbbContext.getActivities()[0].getActivity(); MsSession session = connection.getSession(); MsLink link = session.createLink(MsLinkMode.FULL_DUPLEX); ActivityContextInterface linkActivity = null; try { linkActivity = mediaAcif.getActivityContextInterface(link); } catch (UnrecognizedActivityException ex) { } linkActivity.attach(sbbContext.getSbbLocalObject()); link.join(endpointName, LOOP_ENDPOINT); }
public void on4xxResponse(javax.sip.ResponseEvent event, ActivityContextInterface aci) { Response response = event.getResponse(); if(tracer.isInfoEnabled()) { tracer.info("Received SIP 4xx >> " + response.getStatusCode()); } // Is it a 404? if(response.getStatusCode() == 404) { // Let's see from whom to whom String to = ((ToHeader) response.getHeader("To")).getAddress().toString(); String from = ((FromHeader) response.getHeader("From")).getAddress().toString(); if(tracer.isInfoEnabled()) { tracer.info("From[" + from + "], To [" + to + "]"); } String toAddress = to.substring(to.indexOf("sip:"), to.indexOf(">")); // Create the MissedCall object MissedCall mC = new MissedCall(from, new Date()); Collection<MissedCall> mCs = missedCalls.get(toAddress); if(mCs == null) { mCs = new ArrayList<MissedCall>(); missedCalls.put(toAddress, mCs); } if(!mCs.contains(mC)) { mCs.add(mC); } } aci.detach(this.getSbbContext().getSbbLocalObject()); }