public void putHost( String name, String id ) throws IOException { ObjectMapper mapper = new ObjectMapper(); hostCache.put( name, id ); hostCacheDataFile.writeString( mapper.writeValueAsString( hostCache ), "UTF-8", null ); }
public void putItem( String name, String id ) throws IOException { ObjectMapper mapper = new ObjectMapper(); itemCache.put( name, id ); itemCacheDataFile.writeString( mapper.writeValueAsString( itemCache ), "UTF-8", null ); }
public void putHostGroup( String name, String id ) throws IOException { ObjectMapper mapper = new ObjectMapper(); hostGroupCache.put( name, id ); hostGroupCacheDataFile.writeString( mapper.writeValueAsString( hostGroupCache ), "UTF-8", null ); }
.mkdirs(); settingsXml.writeString( rendered, "UTF-8", new ChangeSummary( ChangeSummary.SYSTEM_USER, "SETBACK: Updating generated SetBack settings.xml for: " + key ) );
target.writeString( migrated, summary ); changed = true;
private void store( final boolean skipIfExists, final ChangeSummary summary, final ArtifactStore... stores ) throws IndyDataException { for ( final ArtifactStore store : stores ) { final DataFile f = manager.getDataFile( INDY_STORE, store.getPackageType(), store.getType().singularEndpointName(), store.getName() + ".json" ); if ( skipIfExists && f.exists() ) { continue; } final DataFile d = f.getParent(); if ( !d.mkdirs() ) { throw new IndyDataException( "Cannot create storage directory: {} for definition: {}", d, store ); } try { final String json = serializer.writeValueAsString( store ); f.writeString( json, "UTF-8", summary ); logger.debug( "Persisted {} to disk at: {}\n{}", store, f, json ); } catch ( final IOException e ) { throw new IndyDataException( "Cannot write definition: {} to: {}. Reason: {}", e, store, f, e.getMessage() ); } } }