Java Code Examples for com.google.api.client.util.IOUtils#isSymbolicLink()
The following examples show how to use
com.google.api.client.util.IOUtils#isSymbolicLink() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileDataStoreFactory.java From google-http-java-client with Apache License 2.0 | 6 votes |
FileDataStore(FileDataStoreFactory dataStore, File dataDirectory, String id) throws IOException { super(dataStore, id); this.dataFile = new File(dataDirectory, id); // error if it is a symbolic link if (IOUtils.isSymbolicLink(dataFile)) { throw new IOException("unable to use a symbolic link: " + dataFile); } // create new file (if necessary) if (dataFile.createNewFile()) { keyValueMap = Maps.newHashMap(); // save the credentials to create a new file save(); } else { // load credentials from existing file keyValueMap = IOUtils.deserialize(new FileInputStream(dataFile)); } }
Example 2
Source File: FileDataStoreFactory.java From google-http-java-client with Apache License 2.0 | 6 votes |
/** @param dataDirectory data directory */ public FileDataStoreFactory(File dataDirectory) throws IOException { dataDirectory = dataDirectory.getCanonicalFile(); // error if it is a symbolic link if (IOUtils.isSymbolicLink(dataDirectory)) { throw new IOException("unable to use a symbolic link: " + dataDirectory); } // create parent directory (if necessary) if (!dataDirectory.exists() && !dataDirectory.mkdirs()) { throw new IOException("unable to create directory: " + dataDirectory); } this.dataDirectory = dataDirectory; if (IS_WINDOWS) { setPermissionsToOwnerOnlyWindows(dataDirectory); } else { setPermissionsToOwnerOnly(dataDirectory); } }
Example 3
Source File: FileDataStoreFactory.java From google-http-java-client with Apache License 2.0 | 6 votes |
FileDataStore(FileDataStoreFactory dataStore, File dataDirectory, String id) throws IOException { super(dataStore, id); this.dataFile = new File(dataDirectory, id); // error if it is a symbolic link if (IOUtils.isSymbolicLink(dataFile)) { throw new IOException("unable to use a symbolic link: " + dataFile); } // create new file (if necessary) if (dataFile.createNewFile()) { keyValueMap = Maps.newHashMap(); // save the credentials to create a new file save(); } else { // load credentials from existing file keyValueMap = IOUtils.deserialize(new FileInputStream(dataFile)); } }
Example 4
Source File: CustomDataStoreFactory.java From hop with Apache License 2.0 | 5 votes |
public CustomDataStoreFactory( File dataDirectory ) throws IOException { dataDirectory = dataDirectory.getCanonicalFile(); this.dataDirectory = dataDirectory; if ( IOUtils.isSymbolicLink( dataDirectory ) ) { throw new IOException( "unable to use a symbolic link: " + dataDirectory ); } else if ( !dataDirectory.exists() && !dataDirectory.mkdirs() ) { throw new IOException( "unable to create directory: " + dataDirectory ); } }
Example 5
Source File: CustomDataStoreFactory.java From hop with Apache License 2.0 | 5 votes |
CustomDataStore( CustomDataStoreFactory dataStore, File dataDirectory, String id ) throws IOException { super( dataStore, id ); this.dataDirectory = dataDirectory; this.dataFile = new File( this.dataDirectory, getId() ); if ( IOUtils.isSymbolicLink( this.dataFile ) ) { throw new IOException( "unable to use a symbolic link: " + this.dataFile ); } this.keyValueMap = Maps.newHashMap(); if ( this.dataFile.exists() ) { this.keyValueMap = IOUtils.deserialize( new FileInputStream( this.dataFile ) ); } }
Example 6
Source File: FileDataStoreFactory.java From google-http-java-client with Apache License 2.0 | 5 votes |
/** @param dataDirectory data directory */ public FileDataStoreFactory(File dataDirectory) throws IOException { dataDirectory = dataDirectory.getCanonicalFile(); // error if it is a symbolic link if (IOUtils.isSymbolicLink(dataDirectory)) { throw new IOException("unable to use a symbolic link: " + dataDirectory); } // create parent directory (if necessary) if (!dataDirectory.exists() && !dataDirectory.mkdirs()) { throw new IOException("unable to create directory: " + dataDirectory); } this.dataDirectory = dataDirectory; setPermissionsToOwnerOnly(dataDirectory); }
Example 7
Source File: CustomDataStoreFactory.java From pentaho-kettle with Apache License 2.0 | 5 votes |
public CustomDataStoreFactory( File dataDirectory ) throws IOException { dataDirectory = dataDirectory.getCanonicalFile(); this.dataDirectory = dataDirectory; if ( IOUtils.isSymbolicLink( dataDirectory ) ) { throw new IOException( "unable to use a symbolic link: " + dataDirectory ); } else if ( !dataDirectory.exists() && !dataDirectory.mkdirs() ) { throw new IOException( "unable to create directory: " + dataDirectory ); } }
Example 8
Source File: CustomDataStoreFactory.java From pentaho-kettle with Apache License 2.0 | 5 votes |
CustomDataStore( CustomDataStoreFactory dataStore, File dataDirectory, String id ) throws IOException { super( dataStore, id ); this.dataDirectory = dataDirectory; this.dataFile = new File( this.dataDirectory, getId() ); if ( IOUtils.isSymbolicLink( this.dataFile ) ) { throw new IOException( "unable to use a symbolic link: " + this.dataFile ); } this.keyValueMap = Maps.newHashMap(); if ( this.dataFile.exists() ) { this.keyValueMap = (HashMap) IOUtils.deserialize( new FileInputStream( this.dataFile ) ); } }