⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jahiaservice.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
// $Id: JahiaService.java,v 1.2 2002/04/04 08:13:25 pmartin Exp $////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////                 . . . i n   j a h i a   w e   t r u s t . . .//package org.jahia.services;import org.jahia.settings.JahiaPrivateSettings;import org.jahia.exceptions.JahiaException;import org.jahia.exceptions.JahiaInitializationException;/** * This class is the root class of all the Jahia services. The * {@link #init init()} method is called when the service is created when the * Jahia server starts, and the {@link #shutdown shutdown()} is called when * the service has to be shutdown. Service developpers should override these two * methods to perform specific initialization or shutdown operations. When the * service needs to be restarted, a call to the * {@link #restart restart()} method should be done. * * @author  Khue Nguyen * @author  Fulco Houkes * * @version 1.2 */public abstract class JahiaService{    private String mServiceName = null;    /**     * This variable is true when the service has been initialized and is ready     * to be used, method calls should fail (raise an exception) when this     * variable is false.     */    protected boolean mIsServiceInitialized = false;    //-------------------------------------------------------------------------    /** Return true if the service is initialized and ready to be used.     *     * @return  Return true if the service is initialized.     */    public boolean isInitialized ()    {        return mIsServiceInitialized;    }    //-------------------------------------------------------------------------    /** Check if the service is running (initialized). If it's not initialized     *  yet, a JahiaException is thrown.     *     * @exception   JahiaException     *      Throws this exception when the service is not initialized.     */    protected void checkService ()        throws JahiaException    {        if (!mIsServiceInitialized) {            throw new JahiaException ("Service error.",                    "Service ["+mServiceName+"] is not initialized!",                    JahiaException.SERVICE_ERROR, JahiaException.CRITICAL);        }    }    //-------------------------------------------------------------------------    /** Set the service name.     *     * @param   name     *      String representation of the service name.     */    public synchronized void setServiceName (String name)    {        if (name != null) {            if (name.length() > 0) {                mServiceName = name;            }        }    }    //-------------------------------------------------------------------------    /** Get the service name.     *     * @return     *      Return a reference on the service name. Might return     *      <code>null</code> when the service has not be named yet.     */    public String getServiceName ()    {        return mServiceName;    }    //-------------------------------------------------------------------------    /**     * Code to clean up the services ressource here. Override this method     * with specific services shutdown codes.     *     * @exception   JahiaException     *      Raise an JahiaException exception on any failure.     */    public synchronized void shutdown ()        throws JahiaException    {        mIsServiceInitialized = false;    }    //-------------------------------------------------------------------------    /** Initialize the service. Override this method if specific initialization     *  is needed to start the service.     *     * @exception   JahiaInitializationException     *      Thows this exception on any failure.     */    public synchronized void init (JahiaPrivateSettings jSettings)        throws JahiaInitializationException    {        mIsServiceInitialized = true;    }    //-------------------------------------------------------------------------    /** Restart the service by cleaning the remaining resources. This method     *  calls the {@link #shutdown() shutdown()} and     *  {@link #init init()} method of the service.     *     * @exception   JahiaInitializationException     *      Thows this exception on any failure.     *     * @exception   JahiaException     *      Raise an JahiaException exception on any shutdown failure.     */    public synchronized void restart (JahiaPrivateSettings jSettings)        throws  JahiaInitializationException,                JahiaException    {        shutdown ();        init (jSettings);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -