@Override public NoteStoreClient execute() throws Exception { return clientFactory.createNoteStoreClient(); } });
/** * Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} synchronously * * @param linkedNotebook */ public LinkedNoteStoreClient createLinkedNoteStoreClient( LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { NoteStoreClient mainNoteStoreClient = createNoteStoreClient(); AuthenticationResult sharedAuth = mainNoteStoreClient .authenticateToSharedNotebook(linkedNotebook.getShareKey()); NoteStoreClient linkedNoteStoreClient = createStoreClient( NoteStoreClient.class, linkedNotebook.getNoteStoreUrl(), sharedAuth.getAuthenticationToken()); return new LinkedNoteStoreClient(mainNoteStoreClient, linkedNoteStoreClient, sharedAuth); }
/** * Creates a LinkedNoteStoreClient from a {@link LinkedNotebook} synchronously * * @param linkedNotebook */ public LinkedNoteStoreClient createLinkedNoteStoreClient( LinkedNotebook linkedNotebook) throws EDAMUserException, EDAMSystemException, TException, EDAMNotFoundException { NoteStoreClient mainNoteStoreClient = createNoteStoreClient(); AuthenticationResult sharedAuth = mainNoteStoreClient .authenticateToSharedNotebook(linkedNotebook.getShareKey()); NoteStoreClient linkedNoteStoreClient = createStoreClient( NoteStoreClient.class, linkedNotebook.getNoteStoreUrl(), sharedAuth.getAuthenticationToken()); return new LinkedNoteStoreClient(mainNoteStoreClient, linkedNoteStoreClient, sharedAuth); }
/** * Create a new Business NoteStore client. Each call to this method will * return a new NoteStore.Client instance. The returned client can be used for * any number of API calls, but is NOT thread safe. * * This method will check expiration time for the business authorization * token, this is a network request * * This method is synchronous * * @throws TException * @throws EDAMUserException * @throws EDAMSystemException * User is not part of a business */ public BusinessNoteStoreClient createBusinessNoteStoreClient() throws TException, EDAMUserException, EDAMSystemException { NoteStoreClient mainNoteStoreClient = createNoteStoreClient(); AuthenticationResult businessAuthResult = createUserStoreClient() .authenticateToBusiness(); NoteStoreClient linkedNoteStoreClient = createStoreClient( NoteStoreClient.class, businessAuthResult.getNoteStoreUrl(), businessAuthResult.getAuthenticationToken()); return new BusinessNoteStoreClient(mainNoteStoreClient, linkedNoteStoreClient, businessAuthResult); }
/** * Create a new Business NoteStore client. Each call to this method will * return a new NoteStore.Client instance. The returned client can be used for * any number of API calls, but is NOT thread safe. * * This method will check expiration time for the business authorization * token, this is a network request * * This method is synchronous * * @throws TException * @throws EDAMUserException * @throws EDAMSystemException * User is not part of a business */ public BusinessNoteStoreClient createBusinessNoteStoreClient() throws TException, EDAMUserException, EDAMSystemException { NoteStoreClient mainNoteStoreClient = createNoteStoreClient(); AuthenticationResult businessAuthResult = createUserStoreClient() .authenticateToBusiness(); NoteStoreClient linkedNoteStoreClient = createStoreClient( NoteStoreClient.class, businessAuthResult.getNoteStoreUrl(), businessAuthResult.getAuthenticationToken()); return new BusinessNoteStoreClient(mainNoteStoreClient, linkedNoteStoreClient, businessAuthResult); }
public synchronized static NoteStoreClient getNoteStoreClient(MessageContext ctxt) throws TException, EDAMUserException, EDAMSystemException { Axis2MessageContext axis2mc = (Axis2MessageContext)ctxt; axis2mc.getAxis2MessageContext(); String devToken = (String)axis2mc.getAxis2MessageContext().getOperationContext().getProperty("evernote.devToken"); String noteStoreUrl = (String)axis2mc.getAxis2MessageContext().getOperationContext().getProperty("evernote.noteStoreUrl"); String devTokenType = (String)axis2mc.getAxis2MessageContext().getOperationContext().getProperty("evernote.devTokenType"); EvernoteAuth auth = null; if(devTokenType.equalsIgnoreCase("PRODUCTION")) { auth = new EvernoteAuth(EvernoteService.PRODUCTION, devToken); } else if(devTokenType.equalsIgnoreCase("YINXIANG")) { auth = new EvernoteAuth(EvernoteService.YINXIANG, devToken); } else if (devTokenType.equalsIgnoreCase("SANDBOX")){ auth = new EvernoteAuth(EvernoteService.SANDBOX, devToken); } if (auth != null) { auth.setNoteStoreUrl(noteStoreUrl); } ClientFactory factory = new ClientFactory(auth); return factory.createNoteStoreClient(); }