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

org.ow2.frascati.binding.http.HttpBinding Maven / Gradle / Ivy

There is a newer version: 1.4
Show newest version
/**
 * OW2 FraSCAti: SCA Binding HTTP
 * Copyright (C) 2010 INRIA, USTL
 *
 * 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 of the License, or (at your option) 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
 *
 * Contact: [email protected] 
 *
 * Author: Philippe Merle
 * 
 * Contributor(s):
 *
 */

package org.ow2.frascati.binding.http;

import javax.servlet.Servlet;

import org.osoa.sca.annotations.Destroy;
import org.osoa.sca.annotations.Init;
import org.osoa.sca.annotations.Scope;
import org.osoa.sca.annotations.Service;
import org.osoa.sca.annotations.Property;
import org.osoa.sca.annotations.Reference;

@Scope("COMPOSITE")
@Service(Runnable.class)
public class HttpBinding
  implements Runnable
{
	/** URI of this HTTP binding. */
    @Property
    protected String uri;

    /** The servlet exposed by this HTTP binding. */
    @Reference
    protected Servlet servlet;

    /** The servlet manager. */
    @Reference
    protected ServletManager servletManager;

    public final void run() {
      System.out.println(this + ".run()");
      try {
        Thread.sleep(5*60*1000);
      } catch(Exception exc) {
      }
    }

    @Init
    public final void initialize() throws Exception {
        servletManager.registerServlet(uri, servlet);
    }

    @Destroy
    public final void destroy() {
    	servletManager.unregisterServlet(uri);    
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy