use of com.mucommander.commons.file.DefaultSchemeHandler in project mucommander by mucommander.
the class Activator method start.
@Override
public void start(BundleContext context) throws Exception {
FileProtocolService service = new FileProtocolService() {
@Override
public String getSchema() {
return "hdfs";
}
@Override
public ProtocolProvider getProtocolProvider() {
return new HDFSProtocolProvider();
}
@Override
public SchemeHandler getSchemeHandler() {
return new DefaultSchemeHandler(new DefaultSchemeParser(true), 8020, "/", AuthenticationType.AUTHENTICATION_OPTIONAL, null);
}
};
ProtocolPanelProvider panelProvider = new ProtocolPanelProvider() {
@Override
public String getSchema() {
return "hdfs";
}
@Override
public ServerPanel get(ServerPanelListener listener, JFrame mainFrame) {
return new HDFSPanel(listener, mainFrame);
}
@Override
public int priority() {
return Integer.MAX_VALUE;
}
};
serviceRegistration = context.registerService(FileProtocolService.class, service, null);
uiServiceRegistration = context.registerService(ProtocolPanelProvider.class, panelProvider, null);
}
use of com.mucommander.commons.file.DefaultSchemeHandler in project mucommander by mucommander.
the class Activator method start.
@Override
public void start(BundleContext context) throws Exception {
FileProtocolService service = new FileProtocolService() {
@Override
public String getSchema() {
return "smb";
}
@Override
public ProtocolProvider getProtocolProvider() {
return new SMBProtocolProvider();
}
@Override
public SchemeHandler getSchemeHandler() {
return new DefaultSchemeHandler(new DefaultSchemeParser(), -1, "/", AuthenticationType.AUTHENTICATION_REQUIRED, new Credentials("GUEST", "")) {
@Override
public FileURL getRealm(FileURL location) {
FileURL realm = new FileURL(this);
String newPath = location.getPath();
// Find first path token (share)
int pos = newPath.indexOf('/', 1);
newPath = newPath.substring(0, pos == -1 ? newPath.length() : pos + 1);
realm.setPath(newPath);
realm.setScheme(location.getScheme());
realm.setHost(location.getHost());
realm.setPort(location.getPort());
// Copy properties (if any)
realm.importProperties(location);
return realm;
}
};
}
};
ProtocolPanelProvider panelProvider = new ProtocolPanelProvider() {
@Override
public String getSchema() {
return "smb";
}
@Override
public ServerPanel get(ServerPanelListener listener, JFrame mainFrame) {
return new SMBPanel(listener, mainFrame);
}
@Override
public int priority() {
return 4000;
}
@Override
public Class<? extends ServerPanel> getPanelClass() {
return SMBPanel.class;
}
};
serviceRegistration = context.registerService(FileProtocolService.class, service, null);
uiServiceRegistration = context.registerService(ProtocolPanelProvider.class, panelProvider, null);
}
Aggregations