亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? topologymanagerbean.java

?? Sun公司Dream項目
?? JAVA
字號:
/*
 * The contents of this file are subject to the terms
 * of the Common Development and Distribution License
 * (the "License").  You may not use this file except
 * in compliance with the License.
 *
 * You can obtain a copy of the license at
 * http://www.opensource.org/licenses/cddl1.php
 * See the License for the specific language governing
 * permissions and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL
 * HEADER in each file and include the License file at
 * http://www.opensource.org/licenses/cddl1.php.  If 
 * applicable, add the following below this CDDL HEADER, 
 * with the fields enclosed by brackets "[]" replaced 
 * with your own identifying information: 
 * Portions Copyright [yyyy]
 * [name of copyright owner]
 */ 

/*
 * $(@)TopologyManagerBean.java $Revision: 1.1.1.1 $ $Date: 2006/03/15 13:12:10 $
 * 
 * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
 */
/**

 *

 * @version: 1.0

 * @date: Jan 28, 2003

 * 

 * Modified: Kelly.Kishore@sun.com

 *

 */

package com.sun.sjc.idtv.vod.server.topologymanager;



import java.util.*;

import java.sql.*;

import javax.ejb.*;

import javax.sql.*;

import javax.naming.*;

import java.rmi.*;



import com.sun.sjc.idtv.vod.shared.data.*;



/**

 * Implementation bean for the <code>TopologyManager</code> interface, <code>TopologyManager</code>

 * defines all possible business methods for the bean.

 *

 * @see TopologyManager

 * @see TopologyManagerHome

 */

public class TopologyManagerBean implements SessionBean {



    private  javax.ejb.SessionContext m_ctx = null; 

    public static final int QUERYTIMEOUT = 60;

    private DataSource dataSource;

   

    /**

     * Sets the session context. Required by EJB spec.

     * @param ctx A SessionContext object.

     */

    public void setSessionContext(javax.ejb.SessionContext ctx) { 

        m_ctx = ctx; 

	try {

	    InitialContext ic = new InitialContext();

	    //dataSource = (DataSource) ic.lookup("java:comp/env/jdbc/vod");

	    dataSource = (DataSource) ic.lookup("jdbc/sample");

	} catch (Exception ex) {

	    throw new EJBException("Unable to connect to database. " +

				   ex.getMessage());

	}

    } 



    /**

     * Creates a bean. Required by EJB spec.

     * @exception throws CreateException.

     */

    public void ejbCreate() throws java.rmi.RemoteException, javax.ejb.CreateException { 

    } 



    /**

     * Removes the bean. Required by EJB spec.

     */

    public void ejbRemove() { 

    } 



    /**

     * Loads the state of the bean from secondary storage. Required by EJB spec.

     */

    public void ejbActivate() { 

    } 



    /**

     * Serializes the state of the bean to secondary storage. Required by EJB spec.

     */

    public void ejbPassivate() { 

    } 



    /**

     * Required by EJB spec.

     */

    public void TopologyManager() { 

    } 





    /**

     * Allocate QAM resources for a particular CPE

     * @param cpeId customer premise equiment id

     * @return qam ip, port, tsid, rf channel

     * @exception RemoteException, SQLException

     */

     

    public QamResource allocate(String cpeId) throws java.rmi.RemoteException, SQLException {



       // get db connection from pool

       Connection conn = dataSource.getConnection();



       // get the next free port from reliable dataset (no live cache)

       PreparedStatement stmt = conn.prepareStatement("SELECT * FROM qamresources WHERE free = ? ORDER BY qamport"); // FOR UPDATE



       stmt.setQueryTimeout(QUERYTIMEOUT);

       stmt.setInt(1, 1);

       ResultSet rs = stmt.executeQuery();

       QamResource resource = null;

       if (rs.next()) {

	   resource = new QamResource(cpeId, 

				      rs.getString(2),

				      rs.getString(3),

				      rs.getString(4),

				      rs.getString(5));

       }

       rs.close();

       stmt.close();



       if (resource != null) {

	   stmt = conn.prepareStatement("UPDATE qamresources SET cpeid = ?, free = ?, timest = ? WHERE qamip = ? AND qamport = ?");

	   

	   Timestamp now = new Timestamp(System.currentTimeMillis());

	   stmt.setQueryTimeout(QUERYTIMEOUT);

	   stmt.setString(1, cpeId);

	   stmt.setInt(2, 0);

	   stmt.setTimestamp(3, now);

	   stmt.setString(4, resource.getIP());

	   stmt.setString(5, resource.getPort());

	   stmt.executeUpdate();

	   stmt.close();

       }

       conn.close();



       System.out.println("TopologyManager.allocate: reserving resource fpr cpeid " + cpeId + ": " + resource);

       return resource;

    }



    /**

     * Free QAM resources for a particular CPE

     * @param cpeId customer premise equiment id

     * @return true if ok, false if an exception occured

     * @exception RemoteException

     */

     

    public boolean release(String cpeId) throws java.rmi.RemoteException, SQLException {



	boolean status = true;



       // get db connection from pool

       Connection conn = dataSource.getConnection();



       // free the resource allocated to this cpeid

       PreparedStatement stmt = conn.prepareStatement("UPDATE qamresources SET cpeid = NULL, free = ?, timest = NULL WHERE cpeId = ?");

	   

       stmt.setQueryTimeout(QUERYTIMEOUT);

       stmt.setBoolean(1, true);

       stmt.setString(2, cpeId);

       stmt.executeUpdate();

       stmt.close();

       conn.close();



       System.out.println("TopologyManager.release: releasing resource for " + cpeId);

       return status;

    }



    /* TODO: merge allocateIpResource and allocate together to return a

     * ResourceObject instead of multiple different objects. */



    /**

     * 

     * Allocate IP resource for a particular CPE

     * @param cpeId (customer premise equipment id)

     * @return IPResource: server ip

     * @exception RemoteException

     */

    public IpResource allocateIpResource(String cpeId, String serverIp) throws RemoteException, SQLException {

       

       // get db connection from pool

       Connection conn = dataSource.getConnection();



       // get the next free port from reliable dataset (no live cache)

       PreparedStatement stmt = conn.prepareStatement("SELECT * FROM ipresourcesvod WHERE free = ? AND serverip = ? ORDER BY slotnum"); // FOR UPDATE



       stmt.setQueryTimeout(QUERYTIMEOUT);

       stmt.setInt(1, 1);

       stmt.setString(2,serverIp);

       ResultSet rs = stmt.executeQuery();

       IpResource ipResource = null;

       String slotnum = null;

       System.out.println("allocateIpResource: cpeId="+cpeId+" serverIp="+serverIp);

       if (rs.next()) {

	       ipResource = new IpResource(cpeId, serverIp);

           slotnum = rs.getString(1);

       }

       rs.close();

       stmt.close();



       if (ipResource != null) {

	   stmt = conn.prepareStatement("UPDATE ipresourcesvod SET cpeid = ?, free = ?, timest = ? WHERE slotnum = ? AND serverip = ?");

	   

	   Timestamp now = new Timestamp(System.currentTimeMillis());

	   stmt.setQueryTimeout(QUERYTIMEOUT);

	   stmt.setString(1, cpeId);

	   stmt.setInt(2, 0);

	   stmt.setTimestamp(3, now);

	   stmt.setString(4, slotnum);

       stmt.setString(5, serverIp);

	   stmt.executeUpdate();

	   stmt.close();

       }

       conn.close();



       System.out.println("TopologyManager.allocate: reserving ipresource for cpeid " + cpeId + ": " + ipResource);

       return ipResource;

    }

          

    /**

     * 

     * Releasing IP resource for a particular CPE

     * @param cpeId (customer premise equipment id)

     * @return boolean

     * @exception RemoteException

     */

    public boolean releaseIpResource(String cpeId) throws RemoteException, SQLException {

            

	   boolean status = true;



       // get db connection from pool

       Connection conn = dataSource.getConnection();



       // free the resource allocated to this cpeid

       PreparedStatement stmt = conn.prepareStatement("UPDATE ipresourcesvod SET cpeid = NULL, free = ?, timest = NULL WHERE cpeId = ?");

	   

       stmt.setQueryTimeout(QUERYTIMEOUT);

       stmt.setInt(1, 1);

       stmt.setString(2, cpeId);

       stmt.executeUpdate();

       stmt.close();

       conn.close();



       System.out.println("TopologyManager.release: releasing resource for " + cpeId);

       return status;

    }



} 

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美国产日韩亚洲一区| 国产不卡视频一区| 亚洲美女区一区| 国产精品网站导航| 国产精品女上位| 国产精品久久一级| 亚洲欧美一区二区三区久本道91 | 中文字幕乱码亚洲精品一区| 337p粉嫩大胆色噜噜噜噜亚洲| 精品久久一区二区| 中文字幕乱码久久午夜不卡| 国产精品久久三| 亚洲综合一区二区| 日韩精品乱码免费| 国产一区二区伦理| 91丨九色丨尤物| 欧美日本精品一区二区三区| 日韩精品一区二区三区swag| 国产日韩欧美综合一区| 亚洲三级视频在线观看| 日韩精品乱码免费| 粉嫩嫩av羞羞动漫久久久 | 亚洲免费视频中文字幕| 亚洲一区二区三区免费视频| 日本va欧美va瓶| 粉嫩高潮美女一区二区三区| 欧洲精品一区二区| 久久蜜桃香蕉精品一区二区三区| 亚洲私人影院在线观看| 天堂影院一区二区| 成人一区二区三区| 欧美人与禽zozo性伦| 国产日产亚洲精品系列| 亚洲综合色区另类av| 久久国产尿小便嘘嘘尿| 一本大道久久精品懂色aⅴ| 欧美一级久久久久久久大片| 国产精品国产三级国产三级人妇| 性做久久久久久久免费看| 福利一区福利二区| 欧美一级艳片视频免费观看| 亚洲色图19p| 国产一区二区三区四区五区美女 | 日韩欧美一级片| 中文字幕一区视频| 捆绑调教一区二区三区| 在线看日韩精品电影| 久久久久久电影| 日韩av网站免费在线| 99精品一区二区| 久久综合九色综合97婷婷女人| 五月婷婷色综合| 一本大道av伊人久久综合| 国产亚洲精品资源在线26u| 日韩精品乱码av一区二区| 欧美专区在线观看一区| 中文字幕一区免费在线观看| 国产麻豆精品95视频| 日韩免费看的电影| 日韩不卡手机在线v区| 在线观看国产一区二区| 亚洲日本电影在线| thepron国产精品| 国产精品久久久久一区 | 在线观看日产精品| 亚洲伦理在线免费看| 99国产精品久久久久久久久久| 欧美精品一区二区久久婷婷| 久久精品国产成人一区二区三区 | 亚洲人成精品久久久久久| 成人三级伦理片| 国产精品大尺度| av欧美精品.com| 亚洲日本丝袜连裤袜办公室| 91看片淫黄大片一级在线观看| 国产精品久久久99| 91女神在线视频| 亚洲欧美日韩国产综合| 日本乱人伦aⅴ精品| 亚洲精品国产无套在线观| 91亚洲精品一区二区乱码| 亚洲欧美国产高清| 在线免费观看日韩欧美| 日韩中文字幕麻豆| 欧美一区二区三区播放老司机| 麻豆精品国产传媒mv男同| 日韩精品一区二区三区在线播放 | 色视频一区二区| 亚洲国产日产av| 91麻豆精品国产自产在线| 国内精品国产成人国产三级粉色 | 91色.com| 亚洲激情网站免费观看| 欧美精品第一页| 国模无码大尺度一区二区三区| 久久女同精品一区二区| 成人福利视频在线看| 一区二区久久久久久| 欧美一区二区视频观看视频| 国产一区二区三区美女| 最近中文字幕一区二区三区| 欧美高清视频www夜色资源网| 久久国产视频网| 中文字幕亚洲一区二区av在线| 欧美性生活久久| 国产一区二区福利视频| 亚洲色图清纯唯美| 日韩欧美成人激情| 一道本成人在线| 毛片av中文字幕一区二区| 综合激情成人伊人| 欧美mv日韩mv| 91久久精品一区二区| 黄一区二区三区| 亚洲一二三四区不卡| 久久婷婷国产综合精品青草| 在线视频你懂得一区| 国产乱码精品一区二区三| 亚洲一区二区美女| 国产精品国产a| 欧美大片拔萝卜| 欧美日韩日日摸| 99久久婷婷国产综合精品电影 | 亚洲综合丝袜美腿| 国产亚洲综合色| 日韩免费性生活视频播放| 欧美性一二三区| av在线一区二区三区| 国产精品1区2区3区在线观看| 亚洲电影在线播放| 日韩理论片中文av| 日本一区二区视频在线| 欧美成人猛片aaaaaaa| 欧美日韩视频在线第一区| 91日韩精品一区| 91视频你懂的| av激情成人网| jizz一区二区| 成人精品免费看| 懂色av一区二区三区免费观看| 美女精品自拍一二三四| 视频一区国产视频| 亚洲动漫第一页| 亚洲成人先锋电影| 天天操天天综合网| 图片区日韩欧美亚洲| 亚洲国产综合91精品麻豆| 亚洲香肠在线观看| 亚洲电影第三页| 日日夜夜免费精品视频| 日韩精品视频网站| 青青草国产成人av片免费| 日本三级韩国三级欧美三级| 免费人成在线不卡| 久久er精品视频| 国模无码大尺度一区二区三区| 国产在线一区二区| 国产成人午夜精品5599 | 美洲天堂一区二卡三卡四卡视频| 天天av天天翘天天综合网 | 亚洲午夜在线电影| 一区二区三区四区视频精品免费 | 欧美一卡2卡3卡4卡| 欧美一区二区精品久久911| 6080国产精品一区二区| 日韩西西人体444www| 久久久久久久久久美女| 国产精品女人毛片| 一区二区三区四区在线播放 | 国产精品乱码一区二三区小蝌蚪| 国产精品全国免费观看高清| 亚洲三级在线观看| 日韩精品电影一区亚洲| 国产精品影音先锋| 一本一道波多野结衣一区二区| 欧美日韩国产精品成人| 久久欧美一区二区| 亚洲欧美日本在线| 美女在线一区二区| av一二三不卡影片| 欧美精品aⅴ在线视频| 久久久久久久久蜜桃| 亚洲一区二区三区四区中文字幕| 另类小说图片综合网| 99久久99久久精品国产片果冻| 91麻豆精品国产91久久久资源速度| 久久欧美中文字幕| 午夜伊人狠狠久久| 国产98色在线|日韩| 欧美猛男男办公室激情| 国产欧美日韩综合精品一区二区| 亚洲激情中文1区| 国产寡妇亲子伦一区二区| 欧美亚洲国产一区在线观看网站 | 欧美私人免费视频| 久久久国产精品午夜一区ai换脸| 一二三区精品福利视频| 国产成人激情av| 欧美变态凌虐bdsm| 亚洲第一久久影院|