org.drools.compiler.kie.builder.impl.ZipKieModule Maven / Gradle / Ivy
package org.drools.compiler.kie.builder.impl;
import java.io.File;
import java.util.Collection;
import java.util.Map;
import org.drools.core.util.IoUtils;
import org.kie.api.builder.ReleaseId;
import org.kie.api.builder.model.KieModuleModel;
public class ZipKieModule extends AbstractKieModule implements InternalKieModule {
private final File file;
private Map zipEntries;
public ZipKieModule(ReleaseId releaseId,
KieModuleModel kieProject,
File file) {
super(releaseId, kieProject );
this.file = file;
this.zipEntries = IoUtils.indexZipFile( file );
}
@Override
public File getFile() {
return this.file;
}
@Override
public boolean isAvailable(String name ) {
return this.zipEntries.containsKey( name );
}
@Override
public byte[] getBytes(String name) {
return zipEntries.get(name);
}
@Override
public Collection getFileNames() {
return this.zipEntries.keySet();
}
@Override
public byte[] getBytes() {
throw new UnsupportedOperationException();
}
public long getCreationTimestamp() {
return file.lastModified();
}
public String toString() {
return "ZipKieModule[ ReleaseId=" + getReleaseId() + "file=" + file + "]";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy