/*
* Created on Jul 30, 2006
*
* Copyright 2005 CafeSip.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.cafesip.jiplet.console.server.rpc;
import org.cafesip.jiplet.console.client.rpc.RealmElement;
import org.cafesip.jiplet.console.client.rpc.RealmService;
import org.cafesip.jiplet.console.server.RealmMgmt;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
/**
* @author Amit Chatterjee
*
*/
public class RealmServiceImpl extends RemoteServiceServlet implements
RealmService
{
/**
* Comment for <code>serialVersionUID</code>
*/
private static final long serialVersionUID = 3384456983457504305L;
/*
* @see org.cafesip.jiplet.console.client.ContextService#list()
*/
public String[] list() throws Exception
{
try
{
RealmMgmt rlm = new RealmMgmt();
return rlm.listRealms();
}
catch (Exception e)
{
throw ExceptionHandler.getException(e, this);
}
}
public void create(String name, String dir)
{
}
public void delete(String name) throws Exception
{
try
{
RealmMgmt rlm = new RealmMgmt();
rlm.deleteRealm(name);
}
catch (Exception e)
{
throw ExceptionHandler.getException(e, this);
}
}
public RealmElement getProperty(String realm) throws Exception
{
try
{
RealmMgmt rlm = new RealmMgmt();
return rlm.viewRealmProperty(realm);
}
catch (Exception e)
{
throw ExceptionHandler.getException(e, this);
}
}
public RealmElement[] listProperty() throws Exception
{
try
{
RealmMgmt rlm = new RealmMgmt();
return rlm.listRealmsProperties();
}
catch (Exception e)
{
throw ExceptionHandler.getException(e, this);
}
}
public void createUser(String realm, String user, String password,
String[] roles) throws Exception
{
try
{
RealmMgmt rlm = new RealmMgmt();
rlm.createUser(realm, user, password, roles);
}
catch (Exception e)
{
throw ExceptionHandler.getException(e, this);
}
}
public void modifyUser(String realm, String user, String password,
String[] roles) throws Exception
{
try
{
RealmMgmt rlm = new RealmMgmt();
rlm.modifyUser(realm, user, password, roles);
}
catch (Exception e)
{
throw ExceptionHandler.getException(e, this);
}
}
public void deleteUser(String realm, String user) throws Exception
{
try
{
RealmMgmt rlm = new RealmMgmt();
rlm.deleteUser(realm, user);
}
catch (Exception e)
{
throw ExceptionHandler.getException(e, this);
}
}
public String[] getRoles(String realm, String user) throws Exception
{
try
{
RealmMgmt rlm = new RealmMgmt();
return rlm.getUser(realm, user);
}
catch (Exception e)
{
throw ExceptionHandler.getException(e, this);
}
}
}