0
|
1 package nabble.model.export;
|
|
2
|
|
3 import fschmidt.util.java.ProxyIntoThread;
|
|
4 import nabble.model.Init;
|
|
5 import nabble.model.ModelHome;
|
|
6 import nabble.model.Site;
|
|
7 import nabble.view.lib.Jtp;
|
|
8
|
|
9 import java.net.URL;
|
|
10 import java.net.MalformedURLException;
|
|
11 import java.rmi.RemoteException;
|
|
12
|
|
13
|
|
14 public final class ImportServerImpl implements ImportServer {
|
|
15 private static final long timeout = Init.get("importTimeout",1000L*60*60); // 1 hour
|
|
16
|
|
17 public Import newImport(String permalink,long nodeId) throws RemoteException, MalformedURLException {
|
|
18 URL url = new URL(permalink);
|
|
19 String domain = url.getHost();
|
|
20 Long siteId = Jtp.getSiteIdFromDomain(domain);
|
|
21 Site site = ModelHome.getSite(siteId);
|
|
22
|
|
23 AbstractImportImpl imp = new ImportImpl(site);
|
|
24 ProxyIntoThread<Import> pit = new ProxyIntoThread<Import>( "importing "+nodeId, timeout, imp, Import.class );
|
|
25 imp.setProxy(pit);
|
|
26 return Init.rmiExport(pit.newInstance());
|
|
27 }
|
|
28
|
|
29 private static final ImportServerImpl importServer = new ImportServerImpl();
|
|
30
|
|
31 public static void bind() {
|
|
32 Init.rmiBind("import",importServer);
|
|
33 }
|
|
34 }
|