public void addResource(File object) { ResourceModel rm = new ResourceModel(); rm.setName(object.getName()); rm.setFilePath(object.getAbsolutePath()); String filePath = rm.getFilePath(); if (filePath.endsWith(".jpeg") || filePath.endsWith(".gif")) rm.setDataType("Image"); else if (filePath.endsWith(".au")) rm.setDataType("AudioStream"); if (rm.getDataType().equals("Image")) rm.setImage(loadImage(object.getAbsolutePath())); else if (rm.getDataType().equals("AudioStream")) rm.setAudioStream(loadAudio(object.getAbsolutePath())); resources.put(rm.getName(), rm); }