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

org.ow2.cmi.test.IIOPHelloServer Maven / Gradle / Ivy

/**
 * CMI : Cluster Method Invocation
 * Copyright (C) 2007,2008 Bull S.A.S.
 *
 * This library 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 any later version.
 *
 * This library 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 library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * --------------------------------------------------------------------------
 * $Id:IIOPHelloServer.java 966 2007-06-05 07:54:33Z loris $
 * --------------------------------------------------------------------------
 */

package org.ow2.cmi.test;

import java.rmi.RemoteException;

import javax.rmi.PortableRemoteObject;

import org.ow2.cmi.annotation.Cluster;
import org.ow2.cmi.annotation.Policy;
import org.ow2.cmi.info.CMIInfoExtractor;
import org.ow2.cmi.info.CMIInfoExtractorException;
import org.ow2.cmi.info.ClusteredObjectInfo;
import org.ow2.cmi.jndi.ClusteredObject;
import org.ow2.cmi.lb.policy.RoundRobin;

/**
 * @author nieuviar
 * @author The new CMI team
 *
 */
@Cluster(name="test_cluster")
@Policy(RoundRobin.class)
public class IIOPHelloServer extends PortableRemoteObject implements TestItf, ClusteredObject {

    private static ClusteredObjectInfo clusteredObjectInfo;

    private String msg;


    public IIOPHelloServer(final String string) throws RemoteException {
        msg = string;
        try {
            clusteredObjectInfo =
                CMIInfoExtractor.extractClusteringInfoFromAnnotatedPOJO(
                       "iiopHelloServer", TestItf.class, IIOPHelloServer.class,
                       false, null);
        } catch (CMIInfoExtractorException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

    public void display() throws RemoteException {
        System.out.println("Hello "+msg);
    }

    public ClusteredObjectInfo getClusteredObjectInfo() {
        return clusteredObjectInfo;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy