/*
(non-Javadoc)

@see com.flickr4java.flickr.util.AuthStore#store(com.flickr4java.flickr.auth.Auth)
778942
public void store(Auth token) throws IOException {
        this.auths.put(token.getUser().getId(), token);
        this.authsByUser.put(token.getUser().getUsername(), token);

        String filename = token.getUser().getId() + ".auth";
        File outFile = new File(this.authStoreDir, filename);
        outFile.createNewFile();

        ObjectOutputStream authStream = new ObjectOutputStream(new FileOutputStream(outFile));
        authStream.writeObject(token);
        authStream.flush();
        authStream.close();
    }
750525
def create(store_data)
      auth_by_platform_token!
      response = self.class.post('/stores', { body: store_data.to_json })
      data = JSON.parse(response.body) rescue nil

      {
        status: response.code,
        data: data,
      }
    end
558470
def store(graph)
      begin
        statements = graph.each_statement.to_a
        @client.insert(statements)
        graph
      rescue => e
        raise TriplestoreAdapter::TriplestoreException, "store graph in triplestore cache failed with exception: #{e.message}"
      end
    end
469321
@Override
    public void store(T key, float[] array) {
        INDArray toStore = compressor.compress(array);

        if (emulateIsAbsent)
            lock.writeLock().lock();

        compressedEntries.put(key, toStore);

        if (emulateIsAbsent)
            lock.writeLock().unlock();
    }
511924
@Override
  public ConfigurationStore getStore(final String name) throws ConfigException {
    try {
      final File dir = new File(dirPath);
      final String newPath = dirPath + name;

      final File[] files = dir.listFiles(new DirsOnly());

      for (final File f: files) {
        if (f.getName().equals(name)) {
          return new ConfigurationFileStore(newPath);
        }
      }

      final File newDir = new File(newPath);
      if (!newDir.mkdir()) {
        throw new ConfigException("Unable to create directory " + newPath);
      }

      return new ConfigurationFileStore(newPath);
    } catch (final Throwable t) {
      throw new ConfigException(t);
    }
  }
9623
def getStore(self, name, domain):
        """"""
        return IRealm(self.original.store.parent).accountByAddress(name, domain).avatars.open()
1011524
public static PublicKey loadPublicKeyFromKeyStore(String location,String alias,String storeType,String storePass,String keyPass){
        try {			
        	storeType = null == storeType ? KeyStore.getDefaultType() : storeType;
        	keyPass = keyPass == null ? storePass : keyPass;
        	KeyStore keyStore = KeyStore.getInstance(storeType);
        	InputStream is = new FileInputStream(location);
        	keyStore.load(is, storePass.toCharArray());
        	
        	RSAPrivateCrtKey key = (RSAPrivateCrtKey) keyStore.getKey(alias, keyPass.toCharArray());
			RSAPublicKeySpec spec = new RSAPublicKeySpec(key.getModulus(),
					key.getPublicExponent());
			PublicKey publicKey = KeyFactory.getInstance(KEY_ALGORITHM).generatePublic(spec);
            return publicKey;
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
    }
377820
private void initializeTenantStores(Tenant tenant) {
        DBService.instance(tenant).createStoreIfAbsent(SchemaService.APPS_STORE_NAME, false);
        DBService.instance(tenant).createStoreIfAbsent(TaskManagerService.TASKS_STORE_NAME, false);
    }
393656
private void loadKeystore() {
		String keypath = this.getProperty(KEY_PATH_PROPERTY_KEY);
		String keyEntryName = this.getProperty(ENTRY_NAME_PROPERTY_KEY);
		String keyStorePassword = this
				.getProperty(KEYSTORE_PASSWORD_PROPERTY_KEY);

		loadKeystore(keypath, keyStorePassword, keyEntryName);

	}
1148443
private void storeKey(SecretKey key) {
        final String keyStoreFile = getMain().getFileSystemManager().getSystemLocation() + File.separator + "izou.keystore";
        KeyStore keyStore = createKeyStore(keyStoreFile, "4b[X:+H4CS&avY<)");

        try {
            KeyStore.SecretKeyEntry keyStoreEntry = new KeyStore.SecretKeyEntry(key);
            KeyStore.PasswordProtection keyPassword = new KeyStore.PasswordProtection("Ev45j>eP}QTR?K9_".toCharArray());
            keyStore.setEntry("izou_key", keyStoreEntry, keyPassword);
            keyStore.store(new FileOutputStream(keyStoreFile), "4b[X:+H4CS&avY<)".toCharArray());
        } catch (NoSuchAlgorithmException | KeyStoreException
                | CertificateException | IOException e) {
            logger.error("Unable to store key", e);
        }
    }
633944
@Reference(target = "(id=unbound)")
    protected void setTaskStore(DatabaseStore svc, Map<String, Object> props) {
        persistentStore = svc;
        persistentStoreDisplayId = (String) props.get("config.displayId");
    }
1898
private KeyStore createKeyStore(String fileName, String password)  {
        File file = new File(fileName);
        KeyStore keyStore = null;
        try {
            keyStore = KeyStore.getInstance("JCEKS");
            if (file.exists()) {
                keyStore.load(new FileInputStream(file), password.toCharArray());
            } else {
                keyStore.load(null, null);
                keyStore.store(new FileOutputStream(fileName), password.toCharArray());
            }
        } catch (CertificateException | IOException | KeyStoreException | NoSuchAlgorithmException e) {
            logger.error("Unable to create key store", e);
        }

        return keyStore;
    }
378554
public synchronized AuthStorage getStorage(){
        if(storage==null){
            String cls = Objects.get(config,"storageClass",LogStorage.class.getName());
            try{
                storage = (AuthStorage)Class.forName(cls).newInstance();
            }catch (Exception e){
                throw S1SystemError.wrap(e);
            }
        }
        return storage;
    }
504869
private static TrustManagerFactory getTrustManagerFactory(InputStream trustStoreStream, StoreProperties storeProperties)
      throws IOException, GeneralSecurityException {

    // use provider if given, otherwise use the first matching security provider
    final KeyStore ks;
    if (StringUtils.isNotBlank(storeProperties.getProvider())) {
      ks = KeyStore.getInstance(storeProperties.getType(), storeProperties.getProvider());
    }
    else {
      ks = KeyStore.getInstance(storeProperties.getType());
    }

    ks.load(trustStoreStream, storeProperties.getPassword().toCharArray());
    TrustManagerFactory tmf = TrustManagerFactory.getInstance(storeProperties.getManagerType());
    tmf.init(ks);
    return tmf;
  }
626902
public static <S> StorageTree resolvedTree(S context, ExtTree<S, ResourceMeta> authStorage) {
        return ResolvedExtTree.with(context, authStorage);
    }
1078430
protected KeyStore loadKeyStore() throws Exception {
        return getKeyStore(keyStoreInputStream, sslConfig.getKeyStorePath(),
			   sslConfig.getKeyStoreType(), sslConfig.getKeyStoreProvider(),
			   sslConfig.getKeyStorePassword());
    }
491792
public void setKeyStore(String keyStore, String keyPass) 
    {
        setKeyStore(keyStore, keyPass, null, null);
    }