All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mule.registry.impl.AbstractEntry Maven / Gradle / Ivy

The newest version!
/*
 * $Id: AbstractEntry.java 7976 2007-08-21 14:26:13Z dirk.olmes $
 * --------------------------------------------------------------------------------------
 * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
 *
 * The software in this package is published under the terms of the CPAL v1.0
 * license, a copy of which has been included with this distribution in the
 * LICENSE.txt file.
 */

package org.mule.registry.impl;

import org.mule.registry.Entry;
import org.mule.registry.Registry;
import org.mule.registry.RegistryException;

import java.io.IOException;
import java.io.Serializable;

/**
 * @author Guillaume Nodet
 */
public abstract class AbstractEntry implements Entry, Serializable
{

    protected transient String currentState;
    protected String name;
    protected String installRoot;
    protected String stateAtShutdown;
    protected transient Registry registry;

    protected AbstractEntry(Registry registry)
    {
        this.currentState = UNKNOWN;
        this.stateAtShutdown = UNKNOWN;
        this.registry = registry;
    }

    protected void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException
    {
        in.defaultReadObject();
        this.currentState = UNKNOWN;
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.mule.jbi.registry.Entry#getName()
     */
    public String getName()
    {
        return this.name;
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.mule.jbi.registry.Entry#getInstallRoot()
     */
    public String getInstallRoot()
    {
        return this.installRoot;
    }

    /*
     * (non-Javadoc)
     * 
     * @see javax.jbi.management.LifeCycleMBean#getCurrentState()
     */
    public synchronized String getCurrentState()
    {
        return this.currentState;
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.mule.jbi.registry.Entry#getStatusAtShutdown()
     */
    public String getStateAtShutdown()
    {
        return this.stateAtShutdown;
    }

    public void setCurrentState(String currentState) throws RegistryException
    {
        this.currentState = currentState;
        getRegistry().save();
    }

    /*
     * (non-Javadoc)
     * 
     * @see org.mule.jbi.registry.Entry#setInstallRoot(java.lang.String)
     */
    public void setInstallRoot(String installRoot)
    {
        this.installRoot = installRoot;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public void setStateAtShutdown(String statusAtShutdown)
    {
        this.stateAtShutdown = statusAtShutdown;
    }

    public Registry getRegistry()
    {
        return registry;
    }

    public void setRegistry(Registry registry)
    {
        this.registry = registry;
    }

    protected void checkDescriptor() throws RegistryException
    {
        // nothing to do (yet?)
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy