AbstractModule.java :  » JBoss » jboss-forums » org » jboss » portal » core » modules » Java Open Source

Java Open Source » JBoss » jboss forums 
jboss forums » org » jboss » portal » core » modules » AbstractModule.java
/*
* JBoss, Home of Professional Open Source
* Copyright 2005, JBoss Inc., and individual contributors as indicated
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
* This is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of
* the License, or (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this software; if not, write to the Free
* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
*/
package org.jboss.portal.core.modules;

import javax.naming.InitialContext;
import javax.naming.CompositeName;

import org.jboss.naming.NonSerializableFactory;
import org.jboss.portal.common.system.AbstractJBossService;

/**
 * Base class for modules. Provides JNDI facilities.
 *
 * @author <a href="mailto:julien@jboss.org">Julien Viet</a>
 * @version $Revision: 1.5.4.1 $
 */
public class AbstractModule extends AbstractJBossService
{

   protected String JNDIName;

  /**
   * @jmx.managed-attribute
   */
  public String getJNDIName()
  {
     return JNDIName;
  }

  /**
   * @jmx.managed-attribute
   */
  public void setJNDIName(String JNDIName)
  {
     this.JNDIName = JNDIName;
  }

  protected void startService() throws Exception
  {
     NonSerializableFactory.rebind(new CompositeName(JNDIName), this, true);
  }

  public void stopService() throws Exception
  {
     NonSerializableFactory.unbind(JNDIName);
  }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.