1 | |
package org.paneris.bibliomania; |
2 | |
|
3 | |
import java.io.IOException; |
4 | |
import java.net.HttpURLConnection; |
5 | |
import java.net.MalformedURLException; |
6 | |
import java.net.URL; |
7 | |
|
8 | |
import org.melati.Melati; |
9 | |
import org.melati.admin.AdminSpecialised; |
10 | |
import org.melati.template.MarkupLanguage; |
11 | |
import org.paneris.bibliomania.generated.AuthorWebSiteBase; |
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
|
17 | |
|
18 | |
|
19 | |
|
20 | |
|
21 | |
|
22 | |
|
23 | |
|
24 | |
|
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
public class AuthorWebSite extends AuthorWebSiteBase implements AdminSpecialised { |
40 | |
|
41 | |
|
42 | |
|
43 | |
|
44 | |
|
45 | |
|
46 | |
|
47 | |
|
48 | |
|
49 | |
|
50 | |
|
51 | 19 | public AuthorWebSite() { } |
52 | |
|
53 | |
|
54 | |
|
55 | |
|
56 | |
public boolean isStillLive() { |
57 | 0 | System.err.println(getUrl()); |
58 | 0 | HttpURLConnection it = null; |
59 | |
try { |
60 | 0 | it = (HttpURLConnection) new URL(getUrl()).openConnection(); |
61 | 0 | } catch (MalformedURLException e) { |
62 | 0 | System.err.println("Malformed:" +getUrl()); |
63 | 0 | return false; |
64 | 0 | } catch (IOException e) { |
65 | 0 | System.err.println("Not findable: " + getUrl()); |
66 | 0 | return false; |
67 | 0 | } |
68 | |
try { |
69 | 0 | int responseCode = it.getResponseCode(); |
70 | 0 | if (responseCode > 399) { |
71 | 0 | System.err.println("Page not found: " + responseCode); |
72 | 0 | return false; |
73 | |
} |
74 | 0 | System.err.println("AuthorWebSite.isStillLive response code:" + responseCode); |
75 | 0 | } catch (IOException e) { |
76 | 0 | System.err.println("Domain not found: " + getUrl()); |
77 | 0 | return false; |
78 | 0 | } |
79 | |
|
80 | 0 | return true; |
81 | |
} |
82 | |
|
83 | |
public String adminHandle(Melati melati, MarkupLanguage markupLanguage) |
84 | |
throws Exception { |
85 | 0 | return null; |
86 | |
} |
87 | |
|
88 | |
public BibliomaniaDatabase getBibliomaniaDatabase () { |
89 | 0 | return (BibliomaniaDatabase)getDatabase(); |
90 | |
} |
91 | |
public String adminSpecialFacilities(Melati melati, |
92 | |
MarkupLanguage markupLanguage) throws Exception { |
93 | 0 | return getBibliomaniaDatabase().getWMTemplet("AuthorWebSite-specials"); } |
94 | |
|
95 | |
} |
96 | |
|