PageRenderTime 13ms CodeModel.GetById 8ms app.highlight 3ms RepoModel.GetById 0ms app.codeStats 1ms

/protocols/ss7/m3ua/impl/src/main/java/org/mobicents/protocols/ss7/m3ua/impl/as/AsTransActToActNtfyInsAsp.java

http://mobicents.googlecode.com/
Java | 73 lines | 35 code | 10 blank | 28 comment | 5 complexity | ffcc39a12b87424a1ed9cfd72bdf7c82 MD5 | raw file
 1/*
 2 * JBoss, Home of Professional Open Source
 3 * Copyright 2011, Red Hat, Inc. and individual contributors
 4 * by the @authors tag. See the copyright.txt in the distribution for a
 5 * full listing of individual contributors.
 6 *
 7 * This is free software; you can redistribute it and/or modify it
 8 * under the terms of the GNU Lesser General Public License as
 9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */
22
23package org.mobicents.protocols.ss7.m3ua.impl.as;
24
25import javolution.util.FastList;
26
27import org.apache.log4j.Logger;
28import org.mobicents.protocols.ss7.m3ua.impl.Asp;
29import org.mobicents.protocols.ss7.m3ua.impl.AspState;
30import org.mobicents.protocols.ss7.m3ua.impl.TransitionState;
31import org.mobicents.protocols.ss7.m3ua.impl.fsm.FSM;
32import org.mobicents.protocols.ss7.m3ua.impl.fsm.State;
33import org.mobicents.protocols.ss7.m3ua.impl.fsm.TransitionHandler;
34import org.mobicents.protocols.ss7.m3ua.impl.fsm.UnknownTransitionException;
35
36/**
37 * 
38 * @author amit bhayani
39 *
40 */
41public class AsTransActToActNtfyInsAsp implements TransitionHandler {
42
43    private static final Logger logger = Logger.getLogger(AsTransActToActNtfyInsAsp.class);
44
45    private AsImpl as = null;
46    private FSM fsm;
47
48    public AsTransActToActNtfyInsAsp(AsImpl as, FSM fsm) {
49        this.as = as;
50        this.fsm = fsm;
51    }
52
53    public boolean process(State state) {
54
55        // Iterate through all the ASP for this AS and activate if they are
56        // inactive
57        for (FastList.Node<Asp> n = this.as.getAspList().head(), end = this.as.getAspList().tail(); (n = n
58                .getNext()) != end;) {
59            Asp aspTemp = n.getValue();
60            LocalAspFactory factory = (LocalAspFactory) aspTemp.getAspFactory();
61            if (aspTemp.getState() == AspState.INACTIVE && factory.getStatus()) {
62                factory.sendAspActive(this.as);
63                try {
64                    aspTemp.getFSM().signal(TransitionState.ASP_ACTIVE_SENT);
65                } catch (UnknownTransitionException e) {
66                	logger.error(e.getMessage(), e);
67                }
68            }
69        }
70
71        return true;
72    }
73}