001/* 002 * ModeShape (http://www.modeshape.org) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.modeshape.web.server; 017 018import java.io.Serializable; 019import java.util.Collection; 020import javax.servlet.ServletContext; 021import org.modeshape.web.shared.RemoteException; 022import org.modeshape.web.shared.RepositoryName; 023 024/** 025 * @author kulikov 026 */ 027public interface Connector extends Serializable { 028 /** 029 * Starts this connector using given context. 030 * 031 * @param context the context 032 * @throws RemoteException if there is an error with the connector 033 */ 034 public void start(ServletContext context) throws RemoteException; 035 036 /** 037 * Logs in with given credentials. 038 * 039 * @param username the user name 040 * @param password user's password. 041 */ 042 public void login( String username, String password ) throws RemoteException; 043 044 /** 045 * Logs out. 046 */ 047 public void logout(); 048 049 /** 050 * Gets name of user currently logged in. 051 * 052 * @return user name or null if not logged yet. 053 */ 054 public String userName(); 055 056 /** 057 * Gets list of all available repositories. 058 * 059 * @return the collection of repository names 060 */ 061 public Collection<RepositoryName> getRepositories(); 062 063 /** 064 * Searches repository with given name. 065 * 066 * @param name the name of the repository to search. 067 * @return repository instance or null if not found. 068 * @throws RemoteException if there is an error getting the repository 069 */ 070 public LRepository find( String name ) throws RemoteException; 071 072 public Collection<RepositoryName> search( String name ) throws RemoteException; 073 074}