As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
public class TestConexion { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub boolean pasa=false; ValidateUser user=new ValidateUser(); RepositoryDefault repository=new RepositoryDefault(); //user.logout(); pasa=user.login("user", "password"); if (!pasa){ //System.out.print("error de conexion"); System.out.print(user.miErr); }else{ System.out.print("se ha registrado correctamente"); System.out.print("ver los store disponibles en el repositorio"); repository.getMiStores(); user.logout(); } } }
import org.alfresco.webservice.authentication.AuthenticationFault; import org.alfresco.webservice.util.AuthenticationUtils; public class ValidateUser { public String miErr; public Boolean login(String log,String password){ try { AuthenticationUtils.startSession(log, password); return true; } catch (AuthenticationFault e) { // TODO Auto-generated catch block e.printStackTrace(); this.miErr="login o password incorrecto"; return false; } } public void logout(){ AuthenticationUtils.endSession(); } }
import java.rmi.RemoteException; import org.alfresco.webservice.content.Content; import org.alfresco.webservice.repository.RepositoryFault; import org.alfresco.webservice.repository.RepositoryServiceSoapBindingStub; import org.alfresco.webservice.types.Store; import org.alfresco.webservice.util.WebServiceFactory; public class RepositoryDefault { public RepositoryServiceSoapBindingStub repositoryService ; public Store[] stores; public Content content; public Content[] readResult; public void getMiStores(){ repositoryService = WebServiceFactory.getRepositoryService(); try { stores = repositoryService.getStores(); } catch (RepositoryFault e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } if (stores == null) { // NOTE: empty array are returned as a null object, this is a issue with the generated web service code. System.out.println("There are no stores avilable in the repository."); } else { // Output the names of all the stores available in the repository System.out.println("The following stores are available in the repository:"); for (Store store : stores) { System.out.println(store.getScheme() + "://" + store.getAddress()); //Aqui es donde deseo mostrar los contenidos y la clase para poder manejarlos(Si es que no me hago entender, me refiero a modificar, leer, escribir, trasnformar, etc) } } } }