NUTCH-2886 Move Nutch WebApp to separate repository (#693)
diff --git a/ivy/ivy.xml b/ivy/ivy.xml
index 2781c6c..585a0fa 100644
--- a/ivy/ivy.xml
+++ b/ivy/ivy.xml
@@ -120,22 +120,6 @@
<dependency org="org.mortbay.jetty" name="jetty" rev="6.1.26" />
<dependency org="org.apache.commons" name="commons-collections4" rev="4.1" conf="*->default" />
- <dependency org="org.springframework" name="spring-core" rev="4.0.9.RELEASE" conf="*->default" />
- <dependency org="org.springframework" name="spring-context" rev="4.0.9.RELEASE" conf="*->default" />
- <dependency org="org.springframework" name="spring-web" rev="4.0.9.RELEASE" conf="*->default" />
-
- <dependency org="com.sun.jersey" name="jersey-client" rev="1.19.4" conf="*->default" />
-
- <dependency org="com.j256.ormlite" name="ormlite-jdbc" rev="5.1" conf="*->default" />
- <dependency org="com.h2database" name="h2" rev="1.4.197" conf="*->default" />
- <dependency org="org.eclipse.persistence" name="javax.persistence" rev="2.2.0" conf="*->default" />
-
- <dependency org="org.apache.wicket" name="wicket-core" rev="6.17.0" conf="*->default" />
- <dependency org="org.apache.wicket" name="wicket-spring" rev="6.17.0" conf="*->default" />
- <dependency org="de.agilecoders.wicket" name="wicket-bootstrap-core" rev="0.9.2" conf="*->default" />
- <dependency org="de.agilecoders.wicket" name="wicket-bootstrap-extensions" rev="0.9.2" conf="*->default">
- <exclude org="org.json" />
- </dependency>
<!-- RabbitMQ dependencies -->
<dependency org="com.rabbitmq" name="amqp-client" rev="5.2.0" conf="*->default" />
diff --git a/src/bin/nutch b/src/bin/nutch
index 9240a9e..3563b45 100755
--- a/src/bin/nutch
+++ b/src/bin/nutch
@@ -98,7 +98,6 @@
echo " plugin load a plugin and run one of its classes main()"
echo " junit runs the given JUnit test"
echo " startserver runs the Nutch Server on localhost:8081"
- echo " webapp run a local Nutch Web Application on locahost:8080"
echo " warc exports crawled data from segments at the WARC format"
echo " updatehostdb update the host db with records from the crawl db"
echo " readhostdb read / dump host db"
@@ -302,8 +301,6 @@
CLASS=org.junit.runner.JUnitCore
elif [ "$COMMAND" = "startserver" ] ; then
CLASS=org.apache.nutch.service.NutchServer
-elif [ "$COMMAND" = "webapp" ] ; then
- CLASS=org.apache.nutch.webui.NutchUiServer
elif [ "$COMMAND" = "warc" ] ; then
CLASS=org.apache.nutch.tools.warc.WARCExporter
elif [ "$COMMAND" = "updatehostdb" ] ; then
diff --git a/src/java/org/apache/nutch/webui/NutchUiApplication.java b/src/java/org/apache/nutch/webui/NutchUiApplication.java
deleted file mode 100644
index fc08874..0000000
--- a/src/java/org/apache/nutch/webui/NutchUiApplication.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui;
-
-import org.apache.nutch.webui.pages.DashboardPage;
-import org.apache.nutch.webui.pages.assets.NutchUiCssReference;
-import org.apache.wicket.RuntimeConfigurationType;
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.protocol.http.WebApplication;
-import org.apache.wicket.spring.injection.annot.SpringComponentInjector;
-import org.springframework.beans.BeansException;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-import org.springframework.stereotype.Component;
-
-import de.agilecoders.wicket.core.Bootstrap;
-import de.agilecoders.wicket.core.markup.html.themes.bootstrap.BootstrapCssReference;
-import de.agilecoders.wicket.core.settings.BootstrapSettings;
-import de.agilecoders.wicket.core.settings.SingleThemeProvider;
-import de.agilecoders.wicket.core.settings.Theme;
-import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesomeCssReference;
-
-@Component
-public class NutchUiApplication extends WebApplication implements
- ApplicationContextAware {
- private static final String THEME_NAME = "bootstrap";
- private ApplicationContext context;
-
- /**
- * @see org.apache.wicket.Application#getHomePage()
- */
- @Override
- public Class<? extends WebPage> getHomePage() {
- return DashboardPage.class;
- }
-
- /**
- * @see org.apache.wicket.Application#init()
- */
- @Override
- public void init() {
- super.init();
- BootstrapSettings settings = new BootstrapSettings();
- Bootstrap.install(this, settings);
- configureTheme(settings);
-
- getComponentInstantiationListeners().add(
- new SpringComponentInjector(this, context));
- }
-
- @Override
- public RuntimeConfigurationType getConfigurationType() {
- return RuntimeConfigurationType.DEPLOYMENT;
- }
-
- private void configureTheme(BootstrapSettings settings) {
- Theme theme = new Theme(THEME_NAME, BootstrapCssReference.instance(),
- FontAwesomeCssReference.instance(), NutchUiCssReference.instance());
- settings.setThemeProvider(new SingleThemeProvider(theme));
- }
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext)
- throws BeansException {
- this.context = applicationContext;
- }
-}
diff --git a/src/java/org/apache/nutch/webui/NutchUiApplication.properties b/src/java/org/apache/nutch/webui/NutchUiApplication.properties
deleted file mode 100644
index 4c62939..0000000
--- a/src/java/org/apache/nutch/webui/NutchUiApplication.properties
+++ /dev/null
@@ -1,63 +0,0 @@
-#############################################################################
-#Licensed to the Apache Software Foundation (ASF) under one or more
-#contributor license agreements. See the NOTICE file distributed with
-#this work for additional information regarding copyright ownership.
-#The ASF licenses this file to You under the Apache License, Version 2.0
-#(the "License"); you may not use this file except in compliance with
-#the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-#Unless required by applicable law or agreed to in writing, software
-#distributed under the License is distributed on an "AS IS" BASIS,
-#WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-#See the License for the specific language governing permissions and
-#limitations under the License.
-#############################################################################
-
-navbar.menu.dashboard = Dashboard
-navbar.menu.statistics = Statistics
-navbar.menu.instances = Instances
-navbar.menu.settings = Settings
-navbar.menu.crawls = Crawls
-navbar.menu.scheduling = Scheduling
-navbar.menu.search = Search
-navbar.menu.url = URLs upload
-navbar.menu.seedLists = Seed lists
-
-page.header.seedList = Seed list
-
-navbar.userMenu.settings = Settings
-navbar.userMenu.logout = Log out
-
-menu.settings=Settings
-menu.instances=Instances
-
-connected=Connected
-disconnected=Disconnected
-
-##ENUMS
-ConnectionStatus.CONNECTING=Connecting
-ConnectionStatus.CONNECTED=Connected
-ConnectionStatus.DISCONNECTED=Disconnected
-
-CrawlStatus.NEW=New
-CrawlStatus.ERROR=Error
-CrawlStatus.CRAWLING=Crawling
-CrawlStatus.FINISHED=Finished
-
-instances=Instances
-instances.header.name=Instance name
-instances.header.hostname=Hostname
-instances.header.status=Status
-instances.header.username=Username
-instances.label.name=Instance name
-instances.label.hostname=Hostname
-instances.label.port=Port
-instances.label.username=Username
-instances.label.password=Password
-instances.buttons.addInstance=Add instance
-
-settings=Settings
-settings.header.name = Name
-settings.header.value = Value
\ No newline at end of file
diff --git a/src/java/org/apache/nutch/webui/NutchUiServer.java b/src/java/org/apache/nutch/webui/NutchUiServer.java
deleted file mode 100644
index 4af3915..0000000
--- a/src/java/org/apache/nutch/webui/NutchUiServer.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui;
-
-import org.apache.commons.cli.CommandLine;
-import org.apache.commons.cli.CommandLineParser;
-import org.apache.commons.cli.GnuParser;
-import org.apache.commons.cli.HelpFormatter;
-import org.apache.commons.cli.Option;
-import org.apache.commons.cli.OptionBuilder;
-import org.apache.commons.cli.Options;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.wicket.protocol.http.WicketFilter;
-import org.apache.wicket.spring.SpringWebApplicationFactory;
-import org.mortbay.jetty.Handler;
-import org.mortbay.jetty.Server;
-import org.mortbay.jetty.servlet.Context;
-import org.mortbay.jetty.servlet.DefaultServlet;
-import org.mortbay.jetty.servlet.FilterHolder;
-import org.springframework.web.context.ContextLoaderListener;
-import org.springframework.web.context.WebApplicationContext;
-import org.springframework.web.context.request.RequestContextListener;
-import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
-
-public class NutchUiServer {
- private static final String APP_FACTORY_NAME = SpringWebApplicationFactory.class
- .getName();
- private static final String CONFIG_LOCATION = "org.apache.nutch.webui";
- private static final String CMD_PORT = "port";
- private static Integer port = 8080;
-
- public static void main(String[] args) throws Exception {
- CommandLineParser parser = new GnuParser();
- Options options = createWebAppOptions();
- CommandLine commandLine = null;
- HelpFormatter formatter = new HelpFormatter();
- try {
- commandLine = parser.parse(options, args);
- } catch (Exception e) {
- formatter.printHelp("NutchUiServer", options, true);
- StringUtils.stringifyException(e);
- }
-
- if (commandLine.hasOption("help")) {
- formatter.printHelp("NutchUiServer", options, true);
- return;
- }
- if (commandLine.hasOption(CMD_PORT)) {
- port = Integer.parseInt(commandLine.getOptionValue(CMD_PORT));
- }
- startServer();
- }
-
- private static void startServer() throws Exception, InterruptedException {
- Server server = new Server(port);
- Context context = new Context(server, "/", Context.SESSIONS);
- context.addServlet(DefaultServlet.class, "/*");
-
- context.addEventListener(new ContextLoaderListener(getContext()));
- context.addEventListener(new RequestContextListener());
-
- WicketFilter filter = new WicketFilter();
- filter.setFilterPath("/");
- FilterHolder holder = new FilterHolder(filter);
- holder.setInitParameter("applicationFactoryClassName", APP_FACTORY_NAME);
- context.addFilter(holder, "/*", Handler.DEFAULT);
-
- server.setHandler(context);
- server.start();
- server.join();
- }
-
- private static WebApplicationContext getContext() {
- AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
- context.setConfigLocation(CONFIG_LOCATION);
- return context;
- }
-
- private static Options createWebAppOptions() {
- Options options = new Options();
- Option helpOpt = new Option("h", "help", false, "show this help message");
- OptionBuilder.withDescription("Port to run the WebApplication on.");
- OptionBuilder.hasOptionalArg();
- OptionBuilder.withArgName("port number");
- options.addOption(OptionBuilder.create(CMD_PORT));
- options.addOption(helpOpt);
- return options;
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/client/NutchClient.java b/src/java/org/apache/nutch/webui/client/NutchClient.java
deleted file mode 100644
index 5b2dab3..0000000
--- a/src/java/org/apache/nutch/webui/client/NutchClient.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client;
-
-import java.util.Map;
-
-import org.apache.nutch.webui.client.model.ConnectionStatus;
-import org.apache.nutch.webui.client.model.JobConfig;
-import org.apache.nutch.webui.client.model.JobInfo;
-import org.apache.nutch.webui.client.model.NutchStatus;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.model.SeedList;
-
-public interface NutchClient {
-
- public NutchInstance getNutchInstance();
-
- public NutchStatus getNutchStatus();
-
- public ConnectionStatus getConnectionStatus();
-
- public String executeJob(JobConfig jobConfig);
-
- public JobInfo getJobInfo(String jobId);
-
- public Map<String, String> getNutchConfig(String config);
-
- /**
- * Create seed list and return seed directory location
- *
- * @param seedList a populated {@link org.apache.nutch.webui.model.SeedList}
- * @return a JSON HTTP response indicating the seed creation result
- */
- public String createSeed(SeedList seedList);
-}
diff --git a/src/java/org/apache/nutch/webui/client/NutchClientFactory.java b/src/java/org/apache/nutch/webui/client/NutchClientFactory.java
deleted file mode 100644
index e51ae5a..0000000
--- a/src/java/org/apache/nutch/webui/client/NutchClientFactory.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client;
-
-import java.util.concurrent.ExecutionException;
-
-import org.apache.nutch.webui.client.impl.NutchClientImpl;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.springframework.stereotype.Component;
-
-import com.google.common.cache.CacheBuilder;
-import com.google.common.cache.CacheLoader;
-import com.google.common.cache.LoadingCache;
-
-@Component
-public class NutchClientFactory {
- private LoadingCache<NutchInstance, NutchClient> cache;
-
- public NutchClientFactory() {
- cache = CacheBuilder.newBuilder().build(new NutchClientCacheLoader());
- }
-
- public NutchClient getClient(NutchInstance instance) {
- try {
- return cache.get(instance);
- } catch (ExecutionException e) {
- throw new IllegalStateException(e);
- }
- }
-
- private static class NutchClientCacheLoader extends
- CacheLoader<NutchInstance, NutchClient> {
- @Override
- public NutchClient load(NutchInstance key) throws Exception {
- return new NutchClientImpl(key);
- }
- }
-}
diff --git a/src/java/org/apache/nutch/webui/client/impl/CrawlingCycle.java b/src/java/org/apache/nutch/webui/client/impl/CrawlingCycle.java
deleted file mode 100644
index 4ddcfbb..0000000
--- a/src/java/org/apache/nutch/webui/client/impl/CrawlingCycle.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.impl;
-
-import java.lang.invoke.MethodHandles;
-import java.util.List;
-
-import org.apache.commons.collections4.CollectionUtils;
-import org.apache.nutch.webui.client.model.Crawl;
-import org.apache.nutch.webui.client.model.JobInfo;
-import org.apache.nutch.webui.client.model.JobInfo.State;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.collect.Lists;
-
-/**
- * This class implements crawl cycle as in crawl script
- *
- * @author feodor
- *
- */
-public class CrawlingCycle {
- private static final Logger LOG = LoggerFactory
- .getLogger(MethodHandles.lookup().lookupClass());
-
- private CrawlingCycleListener listener;
- private RemoteCommandExecutor executor;
- private Crawl crawl;
-
- private List<RemoteCommand> remoteCommands;
- private List<RemoteCommand> executedCommands = Lists.newArrayList();
-
- public CrawlingCycle(CrawlingCycleListener listener,
- RemoteCommandExecutor executor, Crawl crawl, List<RemoteCommand> commands) {
- this.listener = listener;
- this.executor = executor;
- this.crawl = crawl;
- this.remoteCommands = commands;
- }
-
- public synchronized void executeCrawlCycle() {
- listener.crawlingStarted(crawl);
-
- for (RemoteCommand command : remoteCommands) {
- JobInfo jobInfo = executor.executeRemoteJob(command);
- command.setJobInfo(jobInfo);
-
- LOG.info("Executed remote command data: {}", command);
-
- if (jobInfo.getState() == State.FAILED) {
- listener.onCrawlError(crawl, jobInfo.getMsg());
- return;
- }
-
- executedCommands.add(command);
- listener.commandExecuted(crawl, command, calculateProgress());
- }
- listener.crawlingFinished(crawl);
- }
-
- private int calculateProgress() {
- if (CollectionUtils.isEmpty(remoteCommands)) {
- return 0;
- }
- return (int) ((float) executedCommands.size()
- / (float) remoteCommands.size() * 100);
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/client/impl/CrawlingCycleListener.java b/src/java/org/apache/nutch/webui/client/impl/CrawlingCycleListener.java
deleted file mode 100644
index 86c916e..0000000
--- a/src/java/org/apache/nutch/webui/client/impl/CrawlingCycleListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.impl;
-
-import org.apache.nutch.webui.client.model.Crawl;
-
-public interface CrawlingCycleListener {
-
- void crawlingStarted(Crawl crawl);
-
- void onCrawlError(Crawl crawl, String msg);
-
- void commandExecuted(Crawl crawl, RemoteCommand command, int progress);
-
- void crawlingFinished(Crawl crawl);
-
-}
diff --git a/src/java/org/apache/nutch/webui/client/impl/NutchClientImpl.java b/src/java/org/apache/nutch/webui/client/impl/NutchClientImpl.java
deleted file mode 100644
index 671f735..0000000
--- a/src/java/org/apache/nutch/webui/client/impl/NutchClientImpl.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.impl;
-
-import static javax.ws.rs.core.MediaType.APPLICATION_JSON;
-
-import java.util.Map;
-
-import org.apache.nutch.webui.client.NutchClient;
-import org.apache.nutch.webui.client.model.ConnectionStatus;
-import org.apache.nutch.webui.client.model.JobConfig;
-import org.apache.nutch.webui.client.model.JobInfo;
-import org.apache.nutch.webui.client.model.NutchStatus;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.model.SeedList;
-
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
-
-public class NutchClientImpl implements NutchClient {
- private Client client;
- private WebResource nutchResource;
- private NutchInstance instance;
-
- public NutchClientImpl(NutchInstance instance) {
- this.instance = instance;
- createClient();
- }
-
- public void createClient() {
- ClientConfig clientConfig = new DefaultClientConfig();
- clientConfig.getFeatures()
- .put(JSONConfiguration.FEATURE_POJO_MAPPING, true);
- this.client = Client.create(clientConfig);
- this.nutchResource = client.resource(instance.getUrl());
- }
-
- @Override
- public NutchStatus getNutchStatus() {
- return nutchResource.path("/admin").type(APPLICATION_JSON)
- .get(NutchStatus.class);
- }
-
- @Override
- public ConnectionStatus getConnectionStatus() {
-
- getNutchStatus();
- return ConnectionStatus.CONNECTED;
- // TODO implement disconnected status
- }
-
- @Override
- public String executeJob(JobConfig jobConfig) {
- JobInfo jobInfo = nutchResource.path("/job/create").type(APPLICATION_JSON)
- .post(JobInfo.class, jobConfig);
- return jobInfo.getId();
- }
-
- @Override
- public JobInfo getJobInfo(String jobId) {
- return nutchResource.path("/job/" + jobId).type(APPLICATION_JSON)
- .get(JobInfo.class);
- }
-
- @Override
- public NutchInstance getNutchInstance() {
- return instance;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Map<String, String> getNutchConfig(String config) {
- return nutchResource.path("/config/" + config).type(APPLICATION_JSON)
- .get(Map.class);
- }
-
- @Override
- public String createSeed(SeedList seedList) {
- return nutchResource.path("/seed/create").type(APPLICATION_JSON)
- .post(String.class, seedList);
- }
-}
diff --git a/src/java/org/apache/nutch/webui/client/impl/RemoteCommand.java b/src/java/org/apache/nutch/webui/client/impl/RemoteCommand.java
deleted file mode 100644
index 173223e..0000000
--- a/src/java/org/apache/nutch/webui/client/impl/RemoteCommand.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.impl;
-
-import java.io.Serializable;
-import java.text.MessageFormat;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.nutch.webui.client.model.JobConfig;
-import org.apache.nutch.webui.client.model.JobInfo;
-import org.joda.time.Duration;
-
-public class RemoteCommand implements Serializable {
- private JobConfig jobConfig;
- private JobInfo jobInfo = new JobInfo();
- private Duration timeout;
-
- /**
- * Use {@link RemoteCommandBuilder} instead
- */
- @SuppressWarnings("unused")
- private RemoteCommand() {
- }
-
- public RemoteCommand(JobConfig jobConfig) {
- this.jobConfig = jobConfig;
- }
-
- public JobConfig getJobConfig() {
- return jobConfig;
- }
-
- public void setJobConfig(JobConfig jobConfig) {
- this.jobConfig = jobConfig;
- }
-
- public JobInfo getJobInfo() {
- return jobInfo;
- }
-
- public void setJobInfo(JobInfo jobInfo) {
- this.jobInfo = jobInfo;
- }
-
- public Duration getTimeout() {
- return timeout;
- }
-
- public void setTimeout(Duration timeout) {
- this.timeout = timeout;
- }
-
- @Override
- public String toString() {
- String statusInfo = StringUtils.EMPTY;
- if (jobInfo != null) {
- statusInfo = MessageFormat.format("{0}", jobInfo.getState());
- }
- return MessageFormat.format("{0} status: {1}", jobConfig.getType(),
- statusInfo);
- }
-}
diff --git a/src/java/org/apache/nutch/webui/client/impl/RemoteCommandBuilder.java b/src/java/org/apache/nutch/webui/client/impl/RemoteCommandBuilder.java
deleted file mode 100644
index ceb59b1..0000000
--- a/src/java/org/apache/nutch/webui/client/impl/RemoteCommandBuilder.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.impl;
-
-import org.apache.nutch.webui.client.model.JobConfig;
-import org.apache.nutch.webui.client.model.JobInfo.JobType;
-import org.joda.time.Duration;
-
-public class RemoteCommandBuilder {
- private JobConfig jobConfig = new JobConfig();
- private Duration timeout = Duration.standardSeconds(10);
-
- private RemoteCommandBuilder() {
- }
-
- public static RemoteCommandBuilder instance(JobType jobType) {
- return new RemoteCommandBuilder().withJobType(jobType);
- }
-
- public RemoteCommandBuilder withJobType(JobType jobType) {
- jobConfig.setType(jobType);
- return this;
- }
-
- public RemoteCommandBuilder withConfigId(String configId) {
- jobConfig.setConfId(configId);
- return this;
- }
-
- public RemoteCommandBuilder withCrawlId(String crawlId) {
- jobConfig.setCrawlId(crawlId);
- return this;
- }
-
- public RemoteCommandBuilder withArgument(String key, String value) {
- jobConfig.setArgument(key, value);
- return this;
- }
-
- public RemoteCommandBuilder withTimeout(Duration timeout) {
- this.timeout = timeout;
- return this;
- }
-
- public RemoteCommand build() {
- RemoteCommand remoteCommand = new RemoteCommand(jobConfig);
- remoteCommand.setTimeout(timeout);
- return remoteCommand;
- }
-}
diff --git a/src/java/org/apache/nutch/webui/client/impl/RemoteCommandExecutor.java b/src/java/org/apache/nutch/webui/client/impl/RemoteCommandExecutor.java
deleted file mode 100644
index 30fcf4d..0000000
--- a/src/java/org/apache/nutch/webui/client/impl/RemoteCommandExecutor.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.impl;
-
-import static com.google.common.base.Preconditions.checkState;
-
-import java.lang.invoke.MethodHandles;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.apache.nutch.webui.client.NutchClient;
-import org.apache.nutch.webui.client.model.JobInfo;
-import org.apache.nutch.webui.client.model.JobInfo.State;
-import org.joda.time.DateTimeConstants;
-import org.joda.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * This class executes remote job and waits for success/failure result
- *
- * @author feodor
- *
- */
-public class RemoteCommandExecutor {
- private static final Logger LOG = LoggerFactory
- .getLogger(MethodHandles.lookup().lookupClass());
-
- private static final int DEFAULT_TIMEOUT_SEC = 60;
- private Duration requestDelay = new Duration(500);
-
- private NutchClient client;
- private ExecutorService executor;
-
- public RemoteCommandExecutor(NutchClient client) {
- this.client = client;
- this.executor = Executors.newSingleThreadExecutor();
- }
-
- public JobInfo executeRemoteJob(RemoteCommand command) {
- try {
- String jobId = client.executeJob(command.getJobConfig());
- Future<JobInfo> chekerFuture = executor
- .submit(new JobStateChecker(jobId));
- return chekerFuture.get(getTimeout(command), TimeUnit.MILLISECONDS);
- } catch (Exception e) {
- LOG.error("Remote command failed", e);
- JobInfo jobInfo = new JobInfo();
- jobInfo.setState(State.FAILED);
- jobInfo.setMsg(ExceptionUtils.getStackTrace(e));
- return jobInfo;
- }
- }
-
- private long getTimeout(RemoteCommand command) {
- if (command.getTimeout() == null) {
- return DEFAULT_TIMEOUT_SEC * DateTimeConstants.MILLIS_PER_SECOND;
- }
- return command.getTimeout().getMillis();
- }
-
- public void setRequestDelay(Duration requestDelay) {
- this.requestDelay = requestDelay;
- }
-
- public class JobStateChecker implements Callable<JobInfo> {
-
- private String jobId;
-
- public JobStateChecker(String jobId) {
- this.jobId = jobId;
- }
-
- @Override
- public JobInfo call() throws Exception {
- while (!Thread.interrupted()) {
- JobInfo jobInfo = client.getJobInfo(jobId);
- checkState(jobInfo != null, "Cannot get job info!");
-
- State state = jobInfo.getState();
- checkState(state != null, "Unknown job state!");
-
- if (state == State.RUNNING || state == State.ANY || state == State.IDLE) {
- Thread.sleep(requestDelay.getMillis());
- continue;
- }
-
- return jobInfo;
- }
- return null;
- }
-
- }
-}
diff --git a/src/java/org/apache/nutch/webui/client/impl/RemoteCommandsBatchFactory.java b/src/java/org/apache/nutch/webui/client/impl/RemoteCommandsBatchFactory.java
deleted file mode 100644
index 00ff13f..0000000
--- a/src/java/org/apache/nutch/webui/client/impl/RemoteCommandsBatchFactory.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.impl;
-
-import java.util.List;
-import java.util.UUID;
-
-import org.apache.nutch.webui.client.model.Crawl;
-import org.apache.nutch.webui.client.model.JobInfo.JobType;
-import org.joda.time.Duration;
-import org.springframework.beans.factory.config.BeanDefinition;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-import com.google.common.collect.Lists;
-
-@Component
-@Scope(BeanDefinition.SCOPE_PROTOTYPE)
-public class RemoteCommandsBatchFactory {
-
- private List<RemoteCommand> remoteCommands;
- private Crawl crawl;
-
- private String batchId;
-
- public List<RemoteCommand> createCommands(Crawl crawl) {
- this.crawl = crawl;
- this.remoteCommands = Lists.newArrayList();
-
- remoteCommands.add(inject());
- for (int i = 0; i < crawl.getNumberOfRounds(); i++) {
- remoteCommands.addAll(createBatchCommands());
- }
- return remoteCommands;
- }
-
- private List<RemoteCommand> createBatchCommands() {
- this.batchId = UUID.randomUUID().toString();
- List<RemoteCommand> batchCommands = Lists.newArrayList();
-
- batchCommands.add(createGenerateCommand());
- batchCommands.add(createFetchCommand());
- batchCommands.add(createParseCommand());
- batchCommands.add(createUpdateDbCommand());
- batchCommands.add(createIndexCommand());
-
- return batchCommands;
- }
-
- private RemoteCommand inject() {
- RemoteCommandBuilder builder = RemoteCommandBuilder
- .instance(JobType.INJECT).withCrawlId(crawl.getCrawlId())
- .withArgument("url_dir", crawl.getSeedDirectory());
- return builder.build();
- }
-
- private RemoteCommand createGenerateCommand() {
- return createBuilder(JobType.GENERATE).build();
- }
-
- private RemoteCommand createFetchCommand() {
- return createBuilder(JobType.FETCH).withTimeout(
- Duration.standardSeconds(50)).build();
- }
-
- private RemoteCommand createParseCommand() {
- return createBuilder(JobType.PARSE).build();
- }
-
- private RemoteCommand createIndexCommand() {
- return createBuilder(JobType.INDEX).build();
- }
-
- private RemoteCommand createUpdateDbCommand() {
- return createBuilder(JobType.UPDATEDB).build();
- }
-
- private RemoteCommandBuilder createBuilder(JobType jobType) {
- return RemoteCommandBuilder.instance(jobType)
- .withCrawlId(crawl.getCrawlId()).withArgument("batch", batchId);
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/client/model/ConnectionStatus.java b/src/java/org/apache/nutch/webui/client/model/ConnectionStatus.java
deleted file mode 100644
index 66dec88..0000000
--- a/src/java/org/apache/nutch/webui/client/model/ConnectionStatus.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.model;
-
-public enum ConnectionStatus {
- CONNECTING, CONNECTED, DISCONNECTED;
-}
diff --git a/src/java/org/apache/nutch/webui/client/model/Crawl.java b/src/java/org/apache/nutch/webui/client/model/Crawl.java
deleted file mode 100644
index bb818c5..0000000
--- a/src/java/org/apache/nutch/webui/client/model/Crawl.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.model;
-
-import java.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-import org.apache.nutch.webui.model.SeedList;
-
-import com.j256.ormlite.field.DatabaseField;
-
-@Entity
-public class Crawl implements Serializable {
- public enum CrawlStatus {
- NEW, CRAWLING, FINISHED, ERROR
- }
-
- @Id
- @GeneratedValue
- private Long id;
-
- @Column
- private String crawlId;
-
- @Column
- private String crawlName;
-
- @Column
- private CrawlStatus status = CrawlStatus.NEW;
-
- @Column
- private Integer numberOfRounds = 1;
-
- @Column
- @DatabaseField(foreign = true, foreignAutoRefresh = true)
- private SeedList seedList;
-
- @Column
- private String seedDirectory;
-
- @Column
- private int progress;
-
- public Integer getNumberOfRounds() {
- return numberOfRounds;
- }
-
- public void setNumberOfRounds(Integer numberOfRounds) {
- this.numberOfRounds = numberOfRounds;
- }
-
- public String getCrawlId() {
- return crawlId;
- }
-
- public void setCrawlId(String crawlId) {
- this.crawlId = crawlId;
- }
-
- public CrawlStatus getStatus() {
- return status;
- }
-
- public void setStatus(CrawlStatus status) {
- this.status = status;
- }
-
- public String getCrawlName() {
- return crawlName;
- }
-
- public void setCrawlName(String crawlName) {
- this.crawlName = crawlName;
- }
-
- public SeedList getSeedList() {
- return seedList;
- }
-
- public void setSeedList(SeedList seedList) {
- this.seedList = seedList;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getSeedDirectory() {
- return seedDirectory;
- }
-
- public void setSeedDirectory(String seedDirectory) {
- this.seedDirectory = seedDirectory;
- }
-
- public int getProgress() {
- return progress;
- }
-
- public void setProgress(int progress) {
- this.progress = progress;
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/client/model/JobConfig.java b/src/java/org/apache/nutch/webui/client/model/JobConfig.java
deleted file mode 100644
index c15444b..0000000
--- a/src/java/org/apache/nutch/webui/client/model/JobConfig.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.model;
-
-import java.io.Serializable;
-import java.util.Collections;
-import java.util.Map;
-
-import org.apache.nutch.webui.client.model.JobInfo.JobType;
-
-import com.google.common.collect.Maps;
-
-public class JobConfig implements Serializable {
- private String crawlId;
- private JobType type;
- private String confId = "default";
- private String jobClassName;
- private Map<String, Object> args = Maps.newHashMap();
-
- public void setArgument(String key, String value) {
- args.put(key, value);
- }
-
- public String getCrawlId() {
- return crawlId;
- }
-
- public void setCrawlId(String crawlId) {
- this.crawlId = crawlId;
- }
-
- public JobType getType() {
- return type;
- }
-
- public void setType(JobType type) {
- this.type = type;
- }
-
- public String getConfId() {
- return confId;
- }
-
- public void setConfId(String confId) {
- this.confId = confId;
- }
-
- public Map<String, Object> getArgs() {
- return Collections.unmodifiableMap(args);
- }
-
- public void setArgs(Map<String, Object> args) {
- this.args = args;
- }
-
- public String getJobClassName() {
- return jobClassName;
- }
-
- public void setJobClassName(String jobClass) {
- this.jobClassName = jobClass;
- }
-}
diff --git a/src/java/org/apache/nutch/webui/client/model/JobInfo.java b/src/java/org/apache/nutch/webui/client/model/JobInfo.java
deleted file mode 100644
index e293f4d..0000000
--- a/src/java/org/apache/nutch/webui/client/model/JobInfo.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.model;
-
-import java.io.Serializable;
-import java.util.Map;
-
-public class JobInfo implements Serializable {
- public static enum JobType {
- INJECT, GENERATE, FETCH, PARSE, UPDATEDB, INDEX, READDB, CLASS
- };
-
- public static enum State {
- IDLE, RUNNING, FINISHED, FAILED, KILLED, STOPPING, KILLING, ANY
- };
-
- private String id;
- private String type;
- private String confId;
- private Map<String, Object> args;
- private Map<String, Object> result;
- private State state;
- private String msg;
- private String crawlId;
-
- public String getMsg() {
- return msg;
- }
-
- public void setMsg(String msg) {
- this.msg = msg;
- }
-
- public State getState() {
- return state;
- }
-
- public void setState(State state) {
- this.state = state;
- }
-
- public Map<String, Object> getResult() {
- return result;
- }
-
- public void setResult(Map<String, Object> result) {
- this.result = result;
- }
-
- public Map<String, Object> getArgs() {
- return args;
- }
-
- public void setArgs(Map<String, Object> args) {
- this.args = args;
- }
-
- public String getConfId() {
- return confId;
- }
-
- public void setConfId(String confId) {
- this.confId = confId;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getCrawlId() {
- return crawlId;
- }
-
- public void setCrawlId(String crawlId) {
- this.crawlId = crawlId;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/client/model/NutchStatus.java b/src/java/org/apache/nutch/webui/client/model/NutchStatus.java
deleted file mode 100644
index 3c8c137..0000000
--- a/src/java/org/apache/nutch/webui/client/model/NutchStatus.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.client.model;
-
-import java.io.Serializable;
-import java.util.Collection;
-import java.util.Date;
-import java.util.Set;
-
-public class NutchStatus implements Serializable {
-
- private Date startDate;
- private Set<String> configuration;
- private Collection<JobInfo> jobs;
- private Collection<JobInfo> runningJobs;
-
- public Date getStartDate() {
- return startDate;
- }
-
- public void setStartDate(Date startDate) {
- this.startDate = startDate;
- }
-
- public Set<String> getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(Set<String> configuration) {
- this.configuration = configuration;
- }
-
- public Collection<JobInfo> getJobs() {
- return jobs;
- }
-
- public void setJobs(Collection<JobInfo> jobs) {
- this.jobs = jobs;
- }
-
- public Collection<JobInfo> getRunningJobs() {
- return runningJobs;
- }
-
- public void setRunningJobs(Collection<JobInfo> runningJobs) {
- this.runningJobs = runningJobs;
- }
-}
diff --git a/src/java/org/apache/nutch/webui/config/CustomDaoFactory.java b/src/java/org/apache/nutch/webui/config/CustomDaoFactory.java
deleted file mode 100644
index 26fbece..0000000
--- a/src/java/org/apache/nutch/webui/config/CustomDaoFactory.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.config;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import com.j256.ormlite.dao.Dao;
-import com.j256.ormlite.spring.DaoFactory;
-import com.j256.ormlite.support.ConnectionSource;
-
-public class CustomDaoFactory {
- private ConnectionSource connectionSource;
- private List<Dao<?, ?>> registredDaos = Collections
- .synchronizedList(new ArrayList<Dao<?, ?>>());
-
- public CustomDaoFactory(ConnectionSource connectionSource) {
- this.connectionSource = connectionSource;
- }
-
- public <T, ID> Dao<T, ID> createDao(Class<T> clazz) {
- try {
- Dao<T, ID> dao = DaoFactory.createDao(connectionSource, clazz);
- register(dao);
- return dao;
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- private <T, ID> void register(Dao<T, ID> dao) {
- synchronized (registredDaos) {
- registredDaos.add(dao);
- }
- }
-
- public List<Dao<?, ?>> getCreatedDaos() {
- synchronized (registredDaos) {
- return Collections.unmodifiableList(registredDaos);
- }
- }
-}
diff --git a/src/java/org/apache/nutch/webui/config/CustomTableCreator.java b/src/java/org/apache/nutch/webui/config/CustomTableCreator.java
deleted file mode 100644
index 87a0e64..0000000
--- a/src/java/org/apache/nutch/webui/config/CustomTableCreator.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.config;
-
-import java.sql.SQLException;
-import java.util.List;
-
-import com.j256.ormlite.dao.BaseDaoImpl;
-import com.j256.ormlite.dao.Dao;
-import com.j256.ormlite.support.ConnectionSource;
-import com.j256.ormlite.table.DatabaseTableConfig;
-import com.j256.ormlite.table.TableUtils;
-
-public class CustomTableCreator {
-
- private ConnectionSource connectionSource;
- private List<Dao<?, ?>> configuredDaos;
-
- public CustomTableCreator(ConnectionSource connectionSource,
- List<Dao<?, ?>> configuredDaos) {
- this.connectionSource = connectionSource;
- this.configuredDaos = configuredDaos;
- initialize();
- }
-
- private void initialize() {
- if (configuredDaos == null) {
- throw new IllegalStateException("configuredDaos was not set in "
- + getClass().getSimpleName());
- }
-
- for (Dao<?, ?> dao : configuredDaos) {
- createTableForDao(dao);
- }
- }
-
- private void createTableForDao(Dao<?, ?> dao) {
- DatabaseTableConfig<?> tableConfig = getTableConfig(dao);
- createTableIfNotExists(tableConfig);
- }
-
- private DatabaseTableConfig<?> getTableConfig(Dao<?, ?> dao) {
- Class<?> clazz = dao.getDataClass();
- DatabaseTableConfig<?> tableConfig = null;
- if (dao instanceof BaseDaoImpl) {
- tableConfig = ((BaseDaoImpl<?, ?>) dao).getTableConfig();
- }
- if (tableConfig == null) {
- return getConfigFromClass(clazz);
- }
- return tableConfig;
- }
-
- private DatabaseTableConfig<?> getConfigFromClass(Class<?> clazz) {
- try {
- return DatabaseTableConfig.fromClass(connectionSource, clazz);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- private void createTableIfNotExists(DatabaseTableConfig<?> tableConfig) {
- try {
- TableUtils.createTableIfNotExists(connectionSource, tableConfig);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/src/java/org/apache/nutch/webui/config/NutchGuiConfiguration.java b/src/java/org/apache/nutch/webui/config/NutchGuiConfiguration.java
deleted file mode 100644
index 82cab4c..0000000
--- a/src/java/org/apache/nutch/webui/config/NutchGuiConfiguration.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.config;
-
-import java.util.List;
-
-import org.apache.nutch.webui.model.NutchInstance;
-
-public class NutchGuiConfiguration {
- private List<NutchInstance> instances;
-
- public List<NutchInstance> getInstances() {
- return instances;
- }
-
- public void setInstances(List<NutchInstance> instances) {
- this.instances = instances;
- }
-}
diff --git a/src/java/org/apache/nutch/webui/config/SpringConfiguration.java b/src/java/org/apache/nutch/webui/config/SpringConfiguration.java
deleted file mode 100644
index 7783d78..0000000
--- a/src/java/org/apache/nutch/webui/config/SpringConfiguration.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.config;
-
-import java.sql.SQLException;
-import java.util.concurrent.Executor;
-
-import org.apache.nutch.webui.client.model.Crawl;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.model.SeedList;
-import org.apache.nutch.webui.model.SeedUrl;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.AsyncConfigurer;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-import com.j256.ormlite.dao.Dao;
-import com.j256.ormlite.db.H2DatabaseType;
-import com.j256.ormlite.jdbc.JdbcConnectionSource;
-
-@Configuration
-@EnableAsync
-public class SpringConfiguration implements AsyncConfigurer {
-
- @Override
- public Executor getAsyncExecutor() {
- // TODO move magic numbers to properties file
- ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
- executor.setCorePoolSize(7);
- executor.setMaxPoolSize(42);
- executor.setQueueCapacity(11);
- executor.setThreadNamePrefix("SpringExecutor-");
- executor.initialize();
- return executor;
- }
-
- @Bean
- public JdbcConnectionSource getConnectionSource() throws SQLException {
- JdbcConnectionSource source = new JdbcConnectionSource(
- "jdbc:h2:~/.nutch/config", new H2DatabaseType());
- source.initialize();
- return source;
- }
-
- @Bean
- public CustomDaoFactory getDaoFactory() throws SQLException {
- return new CustomDaoFactory(getConnectionSource());
- }
-
- @Bean
- public Dao<NutchInstance, Long> createNutchDao() throws SQLException {
- return getDaoFactory().createDao(NutchInstance.class);
- }
-
- @Bean
- public Dao<SeedList, Long> createSeedListDao() throws SQLException {
- return getDaoFactory().createDao(SeedList.class);
- }
-
- @Bean
- public Dao<SeedUrl, Long> createSeedUrlDao() throws SQLException {
- return getDaoFactory().createDao(SeedUrl.class);
- }
-
- @Bean
- public Dao<Crawl, Long> createCrawlDao() throws SQLException {
- return getDaoFactory().createDao(Crawl.class);
- }
-
- @Bean
- public CustomTableCreator createTableCreator() throws SQLException {
- return new CustomTableCreator(getConnectionSource(), getDaoFactory()
- .getCreatedDaos());
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/model/NutchConfig.java b/src/java/org/apache/nutch/webui/model/NutchConfig.java
deleted file mode 100644
index 7acf9ad..0000000
--- a/src/java/org/apache/nutch/webui/model/NutchConfig.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.model;
-
-import java.io.Serializable;
-
-public class NutchConfig implements Serializable {
- private String name = "name";
- private String value;
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getName() {
- return this.name;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-}
diff --git a/src/java/org/apache/nutch/webui/model/NutchInstance.java b/src/java/org/apache/nutch/webui/model/NutchInstance.java
deleted file mode 100644
index 3800df2..0000000
--- a/src/java/org/apache/nutch/webui/model/NutchInstance.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.model;
-
-import java.io.Serializable;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-import org.apache.nutch.webui.client.model.ConnectionStatus;
-
-@Entity
-public class NutchInstance implements Serializable {
-
- @Id
- @GeneratedValue
- private Long id;
-
- @Column
- private String name = "localhost";
-
- @Column
- private String host = "localhost";
-
- @Column
- private Integer port = 8081;
-
- @Column
- private String username;
-
- @Column
- private String password;
-
- private ConnectionStatus connectionStatus;
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getHost() {
- return host;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public Integer getPort() {
- return port;
- }
-
- public void setPort(Integer port) {
- this.port = port;
- }
-
- public ConnectionStatus getConnectionStatus() {
- return connectionStatus;
- }
-
- public void setConnectionStatus(ConnectionStatus connectionStatus) {
- this.connectionStatus = connectionStatus;
- }
-
- public URI getUrl() {
- try {
- return new URI("http", null, host, port, null, null, null);
- } catch (URISyntaxException e) {
- throw new IllegalStateException("Cannot parse url parameters", e);
- }
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/model/SeedList.java b/src/java/org/apache/nutch/webui/model/SeedList.java
deleted file mode 100644
index a963e94..0000000
--- a/src/java/org/apache/nutch/webui/model/SeedList.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.model;
-
-import java.io.Serializable;
-import java.util.Collection;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-
-import org.apache.commons.collections4.CollectionUtils;
-import org.codehaus.jackson.annotate.JsonIgnore;
-
-import com.fasterxml.jackson.annotation.JsonManagedReference;
-import com.j256.ormlite.field.ForeignCollectionField;
-
-@Entity
-public class SeedList implements Serializable {
-
- @Id
- @GeneratedValue
- private Long id;
-
- @Column
- private String name;
-
- @OneToMany
- @ForeignCollectionField(eager = true)
- @JsonManagedReference
- private Collection<SeedUrl> seedUrls;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- @JsonIgnore
- public int getSeedUrlsCount() {
- if (CollectionUtils.isEmpty(seedUrls)) {
- return 0;
- }
- return seedUrls.size();
- }
-
- public Collection<SeedUrl> getSeedUrls() {
- return seedUrls;
- }
-
- public void setSeedUrls(Collection<SeedUrl> seedUrls) {
- this.seedUrls = seedUrls;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- SeedList other = (SeedList) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/model/SeedUrl.java b/src/java/org/apache/nutch/webui/model/SeedUrl.java
deleted file mode 100644
index b45164c..0000000
--- a/src/java/org/apache/nutch/webui/model/SeedUrl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.model;
-
-import java.io.Serializable;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-
-import com.fasterxml.jackson.annotation.JsonBackReference;
-import com.j256.ormlite.field.DatabaseField;
-
-@Entity
-public class SeedUrl implements Serializable {
-
- @Id
- @GeneratedValue
- private Long id;
-
- @Column
- @DatabaseField(foreign = true, foreignAutoCreate = true, foreignAutoRefresh = true)
- @JsonBackReference
- private SeedList seedList;
-
- @Column
- private String url;
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getUrl() {
- return url;
- }
-
- public void setUrl(String url) {
- this.url = url;
- }
-
- @JsonIgnore
- public SeedList getSeedList() {
- return seedList;
- }
-
- @JsonIgnore
- public void setSeedList(SeedList seedList) {
- this.seedList = seedList;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- SeedUrl other = (SeedUrl) obj;
- if (id == null) {
- if (other.id != null)
- return false;
- } else if (!id.equals(other.id))
- return false;
- return true;
- }
-}
diff --git a/src/java/org/apache/nutch/webui/pages/AbstractBasePage.html b/src/java/org/apache/nutch/webui/pages/AbstractBasePage.html
deleted file mode 100644
index 101a0f3..0000000
--- a/src/java/org/apache/nutch/webui/pages/AbstractBasePage.html
+++ /dev/null
@@ -1,33 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<head>
-<meta charset="utf-8">
-<meta http-equiv="X-UA-Compatible" content="IE=edge">
-<meta name="viewport" content="width=device-width, initial-scale=1">
-<meta name="description" content="">
-<meta name="author" content="">
-<link rel="shortcut icon" href="../../assets/ico/favicon.ico">
-
-<title>Apache Nutch</title>
-
-</head>
-<body>
- <div id="wrapper">
- <nav wicket:id="navigation" class="bs-docs-nav"></nav>
- <div id="page-wrapper">
- <div wicket:id="globalNotificationPanel"></div>
- <wicket:child></wicket:child>
- </div>
- </div>
-</body>
-</html>
\ No newline at end of file
diff --git a/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java b/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java
deleted file mode 100644
index 0a89c0f..0000000
--- a/src/java/org/apache/nutch/webui/pages/AbstractBasePage.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages;
-
-import static de.agilecoders.wicket.core.markup.html.bootstrap.navbar.Navbar.ComponentPosition.LEFT;
-import static de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarComponents.transform;
-
-import java.util.List;
-
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.pages.crawls.CrawlsPage;
-import org.apache.nutch.webui.pages.instances.InstancesPage;
-import org.apache.nutch.webui.pages.menu.VerticalMenu;
-import org.apache.nutch.webui.pages.seed.SeedListsPage;
-import org.apache.nutch.webui.pages.settings.SettingsPage;
-import org.apache.nutch.webui.service.NutchInstanceService;
-import org.apache.nutch.webui.service.NutchService;
-import org.apache.wicket.Component;
-import org.apache.wicket.Page;
-import org.apache.wicket.markup.html.GenericWebPage;
-import org.apache.wicket.markup.html.link.AbstractLink;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.model.PropertyModel;
-import org.apache.wicket.model.ResourceModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-import com.google.common.collect.Iterables;
-import com.google.common.collect.Lists;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.DropDownButton;
-import de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.MenuBookmarkablePageLink;
-import de.agilecoders.wicket.core.markup.html.bootstrap.button.dropdown.MenuDivider;
-import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
-import de.agilecoders.wicket.core.markup.html.bootstrap.image.IconType;
-import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.Navbar.ComponentPosition;
-import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.Navbar.Position;
-import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarButton;
-import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarComponents;
-import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.NavbarDropDownButton;
-import de.agilecoders.wicket.extensions.markup.html.bootstrap.icon.FontAwesomeIconType;
-
-public abstract class AbstractBasePage<T> extends GenericWebPage<T> {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @SpringBean
- private NutchService service;
-
- @SpringBean
- private NutchInstanceService instanceService;
-
- private VerticalMenu navbar;
-
- protected IModel<NutchInstance> currentInstance = new InstanceModel();
-
- public AbstractBasePage() {
- navbar = new VerticalMenu("navigation");
- navbar.brandName(Model.of("Apache Nutch GUI"));
- navbar.setInverted(true);
- navbar.setPosition(Position.TOP);
- add(navbar);
-
- addMenuItem(DashboardPage.class, "navbar.menu.dashboard",
- FontAwesomeIconType.dashboard);
- addMenuItem(StatisticsPage.class, "navbar.menu.statistics",
- FontAwesomeIconType.bar_chart_o);
- addMenuItem(InstancesPage.class, "navbar.menu.instances",
- FontAwesomeIconType.gears);
- addMenuItem(SettingsPage.class, "navbar.menu.settings",
- FontAwesomeIconType.wrench);
- addMenuItem(CrawlsPage.class, "navbar.menu.crawls",
- FontAwesomeIconType.refresh);
- addMenuItem(SchedulingPage.class, "navbar.menu.scheduling",
- FontAwesomeIconType.clock_o);
- addMenuItem(SearchPage.class, "navbar.menu.search",
- FontAwesomeIconType.search);
- addMenuItem(SeedListsPage.class, "navbar.menu.seedLists",
- FontAwesomeIconType.file);
-
- navbar.addComponents(transform(ComponentPosition.RIGHT,
- addInstancesMenuMenu()));
- navbar.addComponents(transform(ComponentPosition.RIGHT, addUserMenu()));
-
- add(new NotificationPanel("globalNotificationPanel"));
-
- if (currentInstance.getObject() == null && !(this instanceof InstancesPage)) {
- getSession().error("No running instances found!");
- setResponsePage(InstancesPage.class);
- }
- }
-
- protected Component addUserMenu() {
- DropDownButton userMenu = new NavbarDropDownButton(Model.of("Username")) {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected List<AbstractLink> newSubMenuButtons(final String buttonMarkupId) {
- List<AbstractLink> subMenu = Lists.newArrayList();
- subMenu.add(new MenuBookmarkablePageLink<Void>(UserSettingsPage.class,
- new ResourceModel("navbar.userMenu.settings"))
- .setIconType(FontAwesomeIconType.gear));
- subMenu.add(new MenuDivider());
- subMenu.add(new MenuBookmarkablePageLink<Void>(LogOutPage.class,
- new ResourceModel("navbar.userMenu.logout"))
- .setIconType(FontAwesomeIconType.power_off));
- return subMenu;
- }
- }.setIconType(FontAwesomeIconType.user);
- return userMenu;
- }
-
- protected Component addInstancesMenuMenu() {
- IModel<String> instanceName = PropertyModel.of(currentInstance, "name");
- DropDownButton instancesMenu = new NavbarDropDownButton(instanceName) {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected List<AbstractLink> newSubMenuButtons(String buttonMarkupId) {
- List<NutchInstance> instances = instanceService.getInstances();
- List<AbstractLink> subMenu = Lists.newArrayList();
- for (NutchInstance instance : instances) {
- subMenu.add(new Link<NutchInstance>(buttonMarkupId, Model
- .of(instance)) {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- public void onClick() {
- currentInstance.setObject(getModelObject());
- setResponsePage(DashboardPage.class);
- }
- }.setBody(Model.of(instance.getName())));
- }
- return subMenu;
- }
- }.setIconType(FontAwesomeIconType.gears);
-
- return instancesMenu;
- }
-
- private <P extends Page> void addMenuItem(Class<P> page, String label,
- IconType icon) {
- Component button = new NavbarButton<Void>(page, Model.of(getString(label)))
- .setIconType(icon);
- navbar.addComponents(NavbarComponents.transform(LEFT, button));
- }
-
- protected NutchInstance getCurrentInstance() {
- return currentInstance.getObject();
- }
-
- private class InstanceModel extends LoadableDetachableModel<NutchInstance> {
-
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- public void setObject(NutchInstance instance) {
- super.setObject(instance);
- getSession().setAttribute("instanceId", instance.getId());
- }
-
- @Override
- protected NutchInstance load() {
- Long instanceId = (Long) getSession().getAttribute("instanceId");
- if (instanceId == null) {
- return getFirstInstance();
- }
- return instanceService.getInstance(instanceId);
- }
-
- private NutchInstance getFirstInstance() {
- return Iterables.getFirst(instanceService.getInstances(), null);
- }
- }
-}
diff --git a/src/java/org/apache/nutch/webui/pages/DashboardPage.html b/src/java/org/apache/nutch/webui/pages/DashboardPage.html
deleted file mode 100644
index b6d5426..0000000
--- a/src/java/org/apache/nutch/webui/pages/DashboardPage.html
+++ /dev/null
@@ -1,52 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<head>
-<meta charset="utf-8" />
-<title>Wicket extend</title>
-</head>
-
-<body>
- <wicket:extend>
- <h2>
- <wicket:message key="navbar.menu.dashboard">Instances</wicket:message>
- </h2>
- <div class="row">
- <div class="col-lg-3">
- <div class="panel panel-info">
- <div wicket:id="panel" class="panel-heading">
- <div class="row">
- <div class="col-xs-6">
- <i class="fa fa-gears fa-5x"></i>
- </div>
- <div class="col-xs-6 text-right">
- <p class="announcement-heading" wicket:id="jobsRunning">2</p>
- <p class="announcement-text">Jobs running</p>
- </div>
- </div>
- </div>
- <a href="#non-existing-id" wicket:id="viewInstances">
- <div class="panel-footer announcement-bottom">
- <div class="row">
- <div class="col-xs-6">View instances</div>
- <div class="col-xs-6 text-right">
- <i class="fa fa-arrow-circle-right"></i>
- </div>
- </div>
- </div>
- </a>
- </div>
- </div>
- </div>
- </wicket:extend>
-</body>
-</html>
diff --git a/src/java/org/apache/nutch/webui/pages/DashboardPage.java b/src/java/org/apache/nutch/webui/pages/DashboardPage.java
deleted file mode 100644
index ae6d760..0000000
--- a/src/java/org/apache/nutch/webui/pages/DashboardPage.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages;
-
-import org.apache.nutch.webui.client.model.NutchStatus;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.pages.instances.InstancesPage;
-import org.apache.nutch.webui.service.NutchService;
-import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.wicket.util.time.Duration;
-
-public class DashboardPage extends AbstractBasePage<Object> {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @SpringBean
- private NutchService nutchService;
-
- private WebMarkupContainer panel;
-
- public DashboardPage() {
- panel = new WebMarkupContainer("panel");
- panel.setOutputMarkupId(true);
- panel.add(new AjaxSelfUpdatingTimerBehavior(Duration.ONE_SECOND));
- panel.add(new Label("jobsRunning", new JobsModel()));
- add(panel);
- add(new BookmarkablePageLink<Void>("viewInstances", InstancesPage.class));
- }
-
- private class JobsModel extends LoadableDetachableModel<Integer> {
- /**
- *
- */
- private static final long serialVersionUID = 1L;
-
- @Override
- protected Integer load() {
- NutchInstance currentInstance = getCurrentInstance();
- Long id = currentInstance.getId();
- NutchStatus nutchStatus = nutchService.getNutchStatus(id);
- return nutchStatus.getRunningJobs().size();
- }
- }
-}
diff --git a/src/java/org/apache/nutch/webui/pages/LogOutPage.java b/src/java/org/apache/nutch/webui/pages/LogOutPage.java
deleted file mode 100644
index a9bb883..0000000
--- a/src/java/org/apache/nutch/webui/pages/LogOutPage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages;
-
-public class LogOutPage extends AbstractBasePage {
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/SchedulingPage.java b/src/java/org/apache/nutch/webui/pages/SchedulingPage.java
deleted file mode 100644
index 39b07a3..0000000
--- a/src/java/org/apache/nutch/webui/pages/SchedulingPage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages;
-
-public class SchedulingPage extends AbstractBasePage {
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/SearchPage.java b/src/java/org/apache/nutch/webui/pages/SearchPage.java
deleted file mode 100644
index a390c01..0000000
--- a/src/java/org/apache/nutch/webui/pages/SearchPage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages;
-
-public class SearchPage extends AbstractBasePage {
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/StatisticsPage.java b/src/java/org/apache/nutch/webui/pages/StatisticsPage.java
deleted file mode 100644
index c676b40..0000000
--- a/src/java/org/apache/nutch/webui/pages/StatisticsPage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages;
-
-public class StatisticsPage extends AbstractBasePage {
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/UrlsUploadPage.java b/src/java/org/apache/nutch/webui/pages/UrlsUploadPage.java
deleted file mode 100644
index 9ae1c7b..0000000
--- a/src/java/org/apache/nutch/webui/pages/UrlsUploadPage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages;
-
-public class UrlsUploadPage extends AbstractBasePage {
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/UserSettingsPage.java b/src/java/org/apache/nutch/webui/pages/UserSettingsPage.java
deleted file mode 100644
index 5a95bba..0000000
--- a/src/java/org/apache/nutch/webui/pages/UserSettingsPage.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages;
-
-public class UserSettingsPage extends AbstractBasePage {
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/assets/NutchUiCssReference.java b/src/java/org/apache/nutch/webui/pages/assets/NutchUiCssReference.java
deleted file mode 100644
index dbc2be5..0000000
--- a/src/java/org/apache/nutch/webui/pages/assets/NutchUiCssReference.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.assets;
-
-import org.apache.wicket.request.resource.CssResourceReference;
-
-public class NutchUiCssReference extends CssResourceReference {
- private static final long serialVersionUID = 1L;
-
- /**
- * Singleton instance of this reference
- */
- private static final NutchUiCssReference INSTANCE = new NutchUiCssReference();
-
- public static NutchUiCssReference instance() {
- return INSTANCE;
- }
-
- /**
- * Private constructor.
- */
- private NutchUiCssReference() {
- super(NutchUiCssReference.class, "nutch-style.css");
- }
-}
diff --git a/src/java/org/apache/nutch/webui/pages/assets/nutch-style.css b/src/java/org/apache/nutch/webui/pages/assets/nutch-style.css
deleted file mode 100644
index 8cc01ac..0000000
--- a/src/java/org/apache/nutch/webui/pages/assets/nutch-style.css
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-@CHARSET "UTF-8";
-
-body {
- margin-top: 50px;
-}
-
-#wrapper {
- padding-left: 0;
-}
-
-#page-wrapper {
- width: 100%;
- padding: 5px 15px;
-}
-
-/* Nav Messages */
-.messages-dropdown .dropdown-menu .message-preview .avatar,.messages-dropdown .dropdown-menu .message-preview .name,.messages-dropdown .dropdown-menu .message-preview .message,.messages-dropdown .dropdown-menu .message-preview .time
- {
- display: block;
-}
-
-.messages-dropdown .dropdown-menu .message-preview .avatar {
- float: left;
- margin-right: 15px;
-}
-
-.messages-dropdown .dropdown-menu .message-preview .name {
- font-weight: bold;
-}
-
-.messages-dropdown .dropdown-menu .message-preview .message {
- font-size: 12px;
-}
-
-.messages-dropdown .dropdown-menu .message-preview .time {
- font-size: 12px;
-}
-
-/* Nav Announcements */
-.announcement-heading {
- font-size: 50px;
- margin: 0;
-}
-
-.announcement-text {
- margin: 0;
-}
-
-/* Table Headers */
-table.tablesorter thead {
- cursor: pointer;
-}
-
-table.tablesorter thead tr th:hover {
- background-color: #f5f5f5;
-}
-
-/* Flot Chart Containers */
-.flot-chart {
- display: block;
- height: 400px;
-}
-
-.flot-chart-content {
- width: 100%;
- height: 100%;
-}
-
-/* Edit Below to Customize Widths > 768px */
-@media ( min-width :768px) {
- /* Wrappers */
- #wrapper {
- padding-left: 225px;
- }
- #page-wrapper {
- padding: 15px 25px;
- }
-
- /* Side Nav */
- .side-nav {
- margin-left: -225px;
- left: 225px;
- width: 225px;
- position: fixed;
- top: 50px;
- height: 100%;
- border-radius: 0;
- border: none;
- background-color: #222222;
- overflow-y: auto;
- }
-
- /* Bootstrap Default Overrides - Customized Dropdowns for the Side Nav */
- .side-nav>li.dropdown>ul.dropdown-menu {
- position: relative;
- min-width: 225px;
- margin: 0;
- padding: 0;
- border: none;
- border-radius: 0;
- background-color: transparent;
- box-shadow: none;
- -webkit-box-shadow: none;
- }
- .side-nav>li.dropdown>ul.dropdown-menu>li>a {
- color: #999999;
- padding: 15px 15px 15px 25px;
- }
- .side-nav>li.dropdown>ul.dropdown-menu>li>a:hover,.side-nav>li.dropdown>ul.dropdown-menu>li>a.active,.side-nav>li.dropdown>ul.dropdown-menu>li>a:focus
- {
- color: #fff;
- background-color: #080808;
- }
- .side-nav>li>a {
- width: 225px;
- }
- .navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus
- {
- background-color: #080808;
- }
-
- /* Nav Messages */
- .messages-dropdown .dropdown-menu {
- min-width: 300px;
- }
- .messages-dropdown .dropdown-menu li a {
- white-space: normal;
- }
- .navbar-collapse {
- padding-left: 15px !important;
- padding-right: 15px !important;
- }
-}
\ No newline at end of file
diff --git a/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabel.java b/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabel.java
deleted file mode 100644
index 8518c0b..0000000
--- a/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabel.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.components;
-
-import java.util.Map;
-
-import org.apache.wicket.markup.html.basic.EnumLabel;
-import org.apache.wicket.model.AbstractReadOnlyModel;
-import org.apache.wicket.model.IModel;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelBehavior;
-import de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType;
-
-/**
- * Label which renders connection status as bootstrap label
- *
- * @author feodor
- *
- */
-public class ColorEnumLabel<E extends Enum<E>> extends EnumLabel<E> {
- private Map<E, LabelType> labelTypeMap;
-
- ColorEnumLabel(String id, IModel<E> model, Map<E, LabelType> labelTypeMap) {
- super(id, model);
- this.labelTypeMap = labelTypeMap;
- }
-
- @Override
- protected void onInitialize() {
- super.onInitialize();
- setOutputMarkupId(true);
- add(new LabelBehavior(new EnumCssModel(getModel())));
- }
-
- private class EnumCssModel extends AbstractReadOnlyModel<LabelType> {
- private IModel<E> model;
-
- public EnumCssModel(IModel<E> model) {
- this.model = model;
- }
-
- @Override
- public LabelType getObject() {
- LabelType labelType = labelTypeMap.get(model.getObject());
- if (labelType == null) {
- return LabelType.Default;
- }
- return labelType;
- }
- }
-
- public static <E extends Enum<E>> ColorEnumLabelBuilder<E> getBuilder(
- String id) {
- return new ColorEnumLabelBuilder<>(id);
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabelBuilder.java b/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabelBuilder.java
deleted file mode 100644
index d12b594..0000000
--- a/src/java/org/apache/nutch/webui/pages/components/ColorEnumLabelBuilder.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.components;
-
-import java.util.Map;
-
-import org.apache.wicket.model.IModel;
-
-import com.google.common.collect.Maps;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType;
-
-public class ColorEnumLabelBuilder<E extends Enum<E>> {
- private Map<E, LabelType> labelTypeMap = Maps.newHashMap();
- private IModel<E> model;
- private String id;
-
- public ColorEnumLabelBuilder(String id) {
- this.id = id;
- }
-
- public ColorEnumLabelBuilder<E> withModel(IModel<E> model) {
- this.model = model;
- return this;
- }
-
- public ColorEnumLabelBuilder<E> withEnumColor(E e, LabelType type) {
- labelTypeMap.put(e, type);
- return this;
- }
-
- public ColorEnumLabel<E> build() {
- return new ColorEnumLabel<>(id, model, labelTypeMap);
- }
-}
diff --git a/src/java/org/apache/nutch/webui/pages/components/CpmIteratorAdapter.java b/src/java/org/apache/nutch/webui/pages/components/CpmIteratorAdapter.java
deleted file mode 100644
index ae31003..0000000
--- a/src/java/org/apache/nutch/webui/pages/components/CpmIteratorAdapter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.components;
-
-import org.apache.wicket.markup.repeater.util.ModelIteratorAdapter;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.IModel;
-
-/**
- * This is iterator adapter, which wraps iterable items with
- * CompoundPropertyModel.
- *
- * @author feodor
- *
- */
-public class CpmIteratorAdapter<T> extends ModelIteratorAdapter<T> {
- public CpmIteratorAdapter(Iterable<T> iterable) {
- super(iterable);
- }
-
- @Override
- protected IModel<T> model(T object) {
- return new CompoundPropertyModel<>(object);
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.html b/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.html
deleted file mode 100644
index 81095f0..0000000
--- a/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.html
+++ /dev/null
@@ -1,58 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<head>
-<meta charset="utf-8" />
-<title>Wicket extend</title>
-</head>
-
-<body>
- <wicket:extend>
- <div wicket:id="notificationPanel"></div>
-
- <form class="form-horizontal" wicket:id="crawlForm">
- <div class="form-group">
- <label for="inputEmail" class="control-label col-xs-2">Crawl id</label>
- <div class="col-xs-10">
- <span wicket:id="crawlId">123-1321-123</span>
- </div>
- </div>
- <div class="form-group">
- <label for="seedDir" class="control-label col-xs-2">Crawl name</label>
- <div class="col-xs-10">
- <input class="form-control" id="seedDir" wicket:id="crawlName" placeholder="Crawl name">
- </div>
- </div>
- <div class="form-group">
- <label for="seedDir" class="control-label col-xs-2">Seed list</label>
- <div class="col-xs-10">
- <select wicket:id="seedList">
- <option>Google list</option>
- <option>Yahoo list</option>
- </select>
- </div>
- </div>
-
- <div class="form-group">
- <label for="numberOfRounds" class="control-label col-xs-2">Rounds</label>
- <div class="col-xs-10">
- <select wicket:id="numberOfRounds">
- <option>1</option>
- <option>2</option>
- </select>
- </div>
- </div>
- </form>
-
- </wicket:extend>
-</body>
-</html>
diff --git a/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.java b/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.java
deleted file mode 100644
index e778f83..0000000
--- a/src/java/org/apache/nutch/webui/pages/crawls/CrawlPanel.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.crawls;
-
-import java.util.List;
-
-import org.apache.nutch.webui.client.model.Crawl;
-import org.apache.nutch.webui.model.SeedList;
-import org.apache.nutch.webui.service.CrawlService;
-import org.apache.nutch.webui.service.SeedListService;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.ChoiceRenderer;
-import org.apache.wicket.markup.html.form.DropDownChoice;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-import com.google.common.collect.Lists;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
-import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
-import de.agilecoders.wicket.core.markup.html.bootstrap.form.BootstrapForm;
-
-public class CrawlPanel extends Modal {
- private static final int MAX_ROUNDS = 10;
-
- private BootstrapForm<Crawl> form;
-
- @SpringBean
- private CrawlService crawlService;
-
- @SpringBean
- private SeedListService seedListService;
-
- private NotificationPanel notificationPanel;
-
- public CrawlPanel(String markupId) {
- super(markupId);
- header(Model.of("Crawl"));
-
- notificationPanel = new NotificationPanel("notificationPanel");
- notificationPanel.setOutputMarkupId(true);
- add(notificationPanel);
-
- form = new BootstrapForm<>("crawlForm");
- form.add(new Label("crawlId"));
- form.add(new TextField<String>("crawlName").setRequired(true));
-
- form.add(new DropDownChoice<>("numberOfRounds", getNumbersOfRounds()));
- form.add(new DropDownChoice<>("seedList",
- seedListService.findAll(), new ChoiceRenderer<>("name"))
- .setRequired(true));
-
- addButton(new AjaxSubmitLink("button", form) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> ajaxForm) {
- crawlService.saveCrawl(form.getModelObject());
- target.add(this.getPage());
- }
-
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- target.add(notificationPanel);
- };
- }.setBody(Model.of("Save")));
- add(form);
- }
-
- public void setModel(IModel<Crawl> model) {
- form.setModel(model);
- }
-
- private List<Integer> getNumbersOfRounds() {
- List<Integer> numbers = Lists.newArrayList();
- for (int i = 1; i <= MAX_ROUNDS; i++) {
- numbers.add(i);
- }
- return numbers;
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.html b/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.html
deleted file mode 100644
index 3c5d789..0000000
--- a/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.html
+++ /dev/null
@@ -1,90 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<head>
-<meta charset="utf-8" />
-<title>Wicket extend</title>
-</head>
-
-<body>
- <wicket:extend>
- <h2>
- <wicket:message key="navbar.menu.crawls">Crawls</wicket:message>
- </h2>
-
- <div class="row">
- <div class="col-lg-8">
- <div class="row">
- <div class="col-lg-8 col-md-offset-10">
- <button class="btn btn-success btn-default" wicket:id="newCrawl">
- <i class="fa fa-plus"></i> Add new crawl
- </button>
- </div>
- </div>
- <table class="table table-hover table-striped tablesorter">
- <thead>
- <tr>
- <th class="header col-md-2">Crawl name</th>
- <th class="header col-md-2">Seed list</th>
- <th class="header col-md-2">Status</th>
- <th class="header col-md-2">Progress</th>
- <th></th>
- </tr>
- </thead>
-
- <tbody wicket:id="crawlsTable">
- <tr wicket:id="crawls">
- <td>
- <a href="#" data-toggle="modal" data-target="#crawlInfo" wicket:id="edit">
- <span wicket:id="crawlName">Crawl name</span>
- </a>
- </td>
- <td>
- <span wicket:id="seedList.name">Google list</span>
- </td>
- <td>
- <span wicket:id="status" class="label">Finished</span>
- </td>
- <td>
- <span wicket:id="progress">50</span>
- %
-
- </td>
-
- <td>
- <button class="btn btn-sm btn-default" type="button" wicket:id="start">
- <span class="fa fa-play"></span>
- </button>
- <button class="btn btn-sm btn-danger" type="button" wicket:id="delete">
- <span class="fa fa-trash-o"></span>
- </button>
- </td>
- </tr>
- </tbody>
- </table>
- <div wicket:id="crawl"></div>
- </div>
- <div class="col-lg-4">
- <div class="panel panel-primary">
- <div class="panel-heading">
- <h3 class="panel-title">Help</h3>
- </div>
- <div class="panel-body">
- <p>Some help about crawling</p>
- </div>
- </div>
- </div>
- </div>
- <!--row-->
- </wicket:extend>
-</body>
-</html>
diff --git a/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.java b/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.java
deleted file mode 100644
index df9419b..0000000
--- a/src/java/org/apache/nutch/webui/pages/crawls/CrawlsPage.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.crawls;
-
-import static de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType.Danger;
-import static de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType.Default;
-import static de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType.Info;
-import static de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType.Success;
-import static org.apache.nutch.webui.client.model.Crawl.CrawlStatus.CRAWLING;
-import static org.apache.nutch.webui.client.model.Crawl.CrawlStatus.ERROR;
-import static org.apache.nutch.webui.client.model.Crawl.CrawlStatus.FINISHED;
-import static org.apache.nutch.webui.client.model.Crawl.CrawlStatus.NEW;
-
-import java.util.Iterator;
-
-import org.apache.nutch.webui.client.model.Crawl;
-import org.apache.nutch.webui.client.model.Crawl.CrawlStatus;
-import org.apache.nutch.webui.pages.AbstractBasePage;
-import org.apache.nutch.webui.pages.components.ColorEnumLabelBuilder;
-import org.apache.nutch.webui.pages.components.CpmIteratorAdapter;
-import org.apache.nutch.webui.service.CrawlService;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.EnumLabel;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.markup.repeater.RefreshingView;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.wicket.util.time.Duration;
-
-/**
- * This page is for crawls management
- *
- * @author feodor
- *
- */
-public class CrawlsPage extends AbstractBasePage<Void> {
-
- private static final Duration UPDATE_TIMEOUT = Duration.seconds(2);
-
- @SpringBean
- private CrawlService crawlService;
-
- private WebMarkupContainer crawlsTable;
- private CrawlPanel crawlPanel;
-
- public CrawlsPage() {
- crawlsTable = new WebMarkupContainer("crawlsTable");
- crawlsTable.setOutputMarkupId(true);
- crawlsTable.add(new AjaxSelfUpdatingTimerBehavior(UPDATE_TIMEOUT));
-
- RefreshingView<Crawl> crawls = new RefreshingView<Crawl>("crawls") {
-
- @Override
- protected Iterator<IModel<Crawl>> getItemModels() {
- return new CpmIteratorAdapter<>(crawlService.getCrawls());
- }
-
- @Override
- protected void populateItem(Item<Crawl> item) {
- populateCrawlRow(item);
- }
- };
-
- crawlsTable.add(crawls);
- add(crawlsTable);
-
- crawlPanel = new CrawlPanel("crawl");
- add(crawlPanel);
-
- add(new AjaxLink<Crawl>("newCrawl") {
- @Override
- public void onClick(AjaxRequestTarget target) {
- editCrawl(target, new CompoundPropertyModel<>(createNewCrawl()));
- }
- });
- }
-
- private void populateCrawlRow(Item<Crawl> item) {
- item.add(new AjaxLink<Crawl>("edit", item.getModel()) {
- @Override
- public void onClick(AjaxRequestTarget target) {
- editCrawl(target, getModel());
- }
- }.add(new Label("crawlName")));
- item.add(new Label("seedList.name"));
-
- item.add(new Label("progress"));
- item.add(createStatusLabel());
- item.add(new Link<Crawl>("start", item.getModel()) {
- @Override
- public void onClick() {
- crawlService.startCrawl(getModelObject().getId(), getCurrentInstance());
- }
- });
-
- item.add(new Link<Crawl>("delete", item.getModel()) {
- @Override
- public void onClick() {
- crawlService.deleteCrawl(getModelObject().getId());
- }
- });
- }
-
- private void editCrawl(AjaxRequestTarget target, IModel<Crawl> model) {
- crawlPanel.setModel(model);
- target.add(crawlPanel);
- crawlPanel.appendShowDialogJavaScript(target);
- }
-
- private Crawl createNewCrawl() {
- return new Crawl();
- }
-
- private EnumLabel<CrawlStatus> createStatusLabel() {
- return new ColorEnumLabelBuilder<CrawlStatus>("status")
- .withEnumColor(NEW, Default).withEnumColor(ERROR, Danger)
- .withEnumColor(FINISHED, Success).withEnumColor(CRAWLING, Info).build();
- }
-}
diff --git a/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.html b/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.html
deleted file mode 100644
index cdbc242..0000000
--- a/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<title>Insert title here</title>
-</head>
-<body>
- <wicket:extend>
- <div wicket:id="notificationPanel"></div>
- <form class="form-horizontal" wicket:id="instanceForm">
- <div class="form-group">
- <label class="control-label col-xs-2"><wicket:message key="instances.label.name">Instance name</wicket:message></label>
- <div class="col-xs-10">
- <input class="form-control" wicket:id="name" placeholder="Localhost instance">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-2"><wicket:message key="instances.label.hostname">Host</wicket:message></label>
- <div class="col-xs-10">
- <input class="form-control" wicket:id="host" placeholder="http://localhost:8080">
- </div>
- </div>
-
- <div class="form-group">
- <label class="control-label col-xs-2"><wicket:message key="instances.label.port">Port</wicket:message></label>
- <div class="col-xs-10">
- <input class="form-control" wicket:id="port" placeholder="http://localhost:8080">
- </div>
- </div>
-
- <div class="form-group">
- <label class="control-label col-xs-2"><wicket:message key="instances.label.username">Username</wicket:message></label>
- <div class="col-xs-10">
- <input class="form-control" wicket:id="username" placeholder="">
- </div>
- </div>
- <div class="form-group">
- <label class="control-label col-xs-2"><wicket:message key="instances.label.password">Password</wicket:message></label>
- <div class="col-xs-10">
- <input class="form-control" type="password" wicket:id="password" placeholder="">
- </div>
- </div>
- </form>
- </wicket:extend>
-</body>
-</html>
\ No newline at end of file
diff --git a/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.java b/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.java
deleted file mode 100644
index 09ac71a..0000000
--- a/src/java/org/apache/nutch/webui/pages/instances/InstancePanel.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.instances;
-
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.service.NutchInstanceService;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.PasswordTextField;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.common.NotificationPanel;
-import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal;
-import de.agilecoders.wicket.core.markup.html.bootstrap.form.BootstrapForm;
-
-public class InstancePanel extends Modal {
-
- private BootstrapForm<NutchInstance> form;
-
- private NotificationPanel notificationPanel;
-
- @SpringBean
- private NutchInstanceService instanceService;
-
- public InstancePanel(String markupId) {
- super(markupId);
- header(Model.of("Instance"));
-
- notificationPanel = new NotificationPanel("notificationPanel");
- notificationPanel.setOutputMarkupId(true);
- add(notificationPanel);
-
- form = new BootstrapForm<>("instanceForm");
- form.add(new TextField<String>("name").setRequired(true));
- form.add(new TextField<String>("host").setRequired(true));
- form.add(new TextField<Integer>("port").setRequired(true));
- form.add(new TextField<String>("username"));
- form.add(new PasswordTextField("password").setResetPassword(false)
- .setRequired(false));
-
- addButton(new AjaxSubmitLink("button", form) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> ajaxForm) {
- instanceService.saveInstance(form.getModelObject());
- target.add(this.getPage());
-
- }
-
- protected void onError(AjaxRequestTarget target, Form<?> form) {
- target.add(notificationPanel);
- };
- }.setBody(Model.of("Save")));
- add(form);
- }
-
- public void setModel(IModel<NutchInstance> model) {
- form.setModel(model);
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.html b/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.html
deleted file mode 100644
index 15e6ed8..0000000
--- a/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.html
+++ /dev/null
@@ -1,66 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="UTF-8">
-<title>Instances</title>
-</head>
-<body>
- <wicket:extend>
- <h2>
- <wicket:message key="navbar.menu.instances">Instances</wicket:message>
- </h2>
- <div class="row">
- <div class="col-lg-8">
- <table class="table table-hover table-striped tablesorter">
- <thead>
- <tr>
- <th class="header col-md-2"><wicket:message key="instances.header.name">Name</wicket:message></th>
- <th class="header col-md-2"><wicket:message key="instances.header.hostname">Host</wicket:message></th>
- <th class="header col-md-2"><wicket:message key="instances.header.username">Username</wicket:message></th>
- <th class="header col-md-2"><wicket:message key="instances.header.status">Status</wicket:message></th>
- <th></th>
- </tr>
- </thead>
- <tbody wicket:id="instancesTable">
- <tr wicket:id="instances">
- <td>
- <a href="#" data-toggle="modal" data-target="#instanceInfo" wicket:id="editInstance">
- <span wicket:id="name">Instance name</span>
- </a>
- </td>
- <td>
- <span wicket:id="host">Host</span>
- </td>
- <td>
- <span wicket:id="username">Username</span>
- </td>
- <td>
- <span wicket:id="connectionStatus" class="label">Status</span>
- </td>
- <td>
- <button class="btn btn-sm btn-danger" type="button" wicket:id="instanceDelete">
- <span class="fa fa-trash-o"></span>
- </button>
- </td>
- </tr>
- </tbody>
- </table>
- <div wicket:id="instanceForm"></div>
- <button class="btn btn-sm btn-primary" wicket:id="addInstance">
- <i class="fa fa-plus"></i> <wicket:message key="instances.buttons.addInstance">Add instance</wicket:message>
- </button>
- </div>
- <div class="col-lg-4">
- <div class="panel panel-primary">
- <div class="panel-heading">
- <h3 class="panel-title">Help</h3>
- </div>
- <div class="panel-body">
- <p>Some help about crawling</p>
- </div>
- </div>
- </div>
- </div>
- </wicket:extend>
-</body>
-</html>
\ No newline at end of file
diff --git a/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.java b/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.java
deleted file mode 100644
index 89ac8f9..0000000
--- a/src/java/org/apache/nutch/webui/pages/instances/InstancesPage.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.instances;
-
-import static de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType.Danger;
-import static de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType.Info;
-import static de.agilecoders.wicket.core.markup.html.bootstrap.block.LabelType.Success;
-import static org.apache.nutch.webui.client.model.ConnectionStatus.CONNECTED;
-import static org.apache.nutch.webui.client.model.ConnectionStatus.CONNECTING;
-import static org.apache.nutch.webui.client.model.ConnectionStatus.DISCONNECTED;
-
-import java.util.Iterator;
-
-import org.apache.nutch.webui.client.model.ConnectionStatus;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.pages.AbstractBasePage;
-import org.apache.nutch.webui.pages.components.ColorEnumLabel;
-import org.apache.nutch.webui.pages.components.ColorEnumLabelBuilder;
-import org.apache.nutch.webui.pages.components.CpmIteratorAdapter;
-import org.apache.nutch.webui.service.NutchInstanceService;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.AjaxSelfUpdatingTimerBehavior;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.markup.repeater.RefreshingView;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.wicket.util.time.Duration;
-
-public class InstancesPage extends AbstractBasePage<Void> {
- @SpringBean
- private NutchInstanceService instanceService;
-
- private InstancePanel instancePanel;
-
- private WebMarkupContainer instancesTable;
- private static final Duration UPDATE_TIMEOUT = Duration.seconds(1);
-
- public InstancesPage() {
-
- instancesTable = new WebMarkupContainer("instancesTable");
- instancesTable.setOutputMarkupId(true);
- instancesTable.add(new AjaxSelfUpdatingTimerBehavior(UPDATE_TIMEOUT));
-
- instancePanel = new InstancePanel("instanceForm");
-
- RefreshingView<NutchInstance> instances = refreshingView();
- instancesTable.add(instances);
- add(instancesTable);
- add(instancePanel);
- add(addInstanceButton());
- }
-
- private RefreshingView<NutchInstance> refreshingView() {
- RefreshingView<NutchInstance> instances = new RefreshingView<NutchInstance>(
- "instances") {
-
- @Override
- protected Iterator<IModel<NutchInstance>> getItemModels() {
- return new CpmIteratorAdapter<>(
- instanceService.getInstances());
- }
-
- @Override
- protected void populateItem(Item<NutchInstance> item) {
- populateInstanceRow(item);
- }
- };
- return instances;
- }
-
- private AjaxLink<NutchInstance> addInstanceButton() {
- return new AjaxLink<NutchInstance>("addInstance") {
- @Override
- public void onClick(AjaxRequestTarget target) {
- instancePanel.setModel(new CompoundPropertyModel<>(
- new NutchInstance()));
- target.add(instancePanel);
- instancePanel.appendShowDialogJavaScript(target);
- }
- };
- }
-
- private void populateInstanceRow(final Item<NutchInstance> item) {
- item.add(new AjaxLink<NutchInstance>("editInstance") {
- @Override
- public void onClick(AjaxRequestTarget target) {
- instancePanel.setModel(item.getModel());
- target.add(instancePanel);
- instancePanel.appendShowDialogJavaScript(target);
- }
- }.add(new Label("name")));
- item.add(new Label("host"));
- item.add(new Label("username"));
- item.add(createStatusLabel());
- item.add(new AjaxLink<NutchInstance>("instanceDelete", item.getModel()) {
- @Override
- public void onClick(AjaxRequestTarget target) {
- instanceService.removeInstance(getModelObject().getId());
- target.add(instancesTable);
- }
- });
- }
-
- private ColorEnumLabel<ConnectionStatus> createStatusLabel() {
- return new ColorEnumLabelBuilder<ConnectionStatus>("connectionStatus")
- .withEnumColor(CONNECTED, Success).withEnumColor(CONNECTING, Info)
- .withEnumColor(DISCONNECTED, Danger).build();
- }
-}
diff --git a/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.html b/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.html
deleted file mode 100644
index 32d6e01..0000000
--- a/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.html
+++ /dev/null
@@ -1,48 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<html xmlns:wicket="http://wicket.apache.org">
-<head>
-<title>Navbar</title>
-</head>
-<body>
- <wicket:panel>
- <div class="fluid-container" wicket:id="container">
- <!-- Brand and toggle get grouped for better mobile display -->
- <div class="navbar-header">
- <button type="button" class="navbar-toggle" data-toggle="collapse"
- wicket:id="collapseButton">
- <span class="sr-only" wicket:id="toggleNavigationLabel">[[CONTENT]]</span>
- <span class="icon-bar"></span> <span class="icon-bar"></span> <span
- class="icon-bar"></span>
- </button>
- <a wicket:id="brandName" class="navbar-brand" href="#"> <img
- wicket:id="brandImage" /> <span wicket:id="brandLabel"></span>
- </a>
- </div>
-
- <div class="collapse navbar-collapse navbar-ex1-collapse"
- role="navigation" wicket:id="collapse">
- <ul class="nav navbar-nav side-nav">
- <li wicket:id="navLeftList">
- <div wicket:id="component">[[CONTENT]]</div>
- </li>
- </ul>
- <ul wicket:enclosure="navRightList"
- class="nav navbar-nav navbar-right">
- <li wicket:id="navRightList">
- <div wicket:id="component">[[CONTENT]]</div>
- </li>
- </ul>
- </div>
- </div>
- </wicket:panel>
-</body>
-</html>
diff --git a/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.java b/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.java
deleted file mode 100644
index 0085e46..0000000
--- a/src/java/org/apache/nutch/webui/pages/menu/VerticalMenu.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.menu;
-
-import de.agilecoders.wicket.core.markup.html.bootstrap.navbar.Navbar;
-
-public class VerticalMenu extends Navbar {
-
- public VerticalMenu(String componentId) {
- super(componentId);
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.html b/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.html
deleted file mode 100644
index f9aff87..0000000
--- a/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.html
+++ /dev/null
@@ -1,75 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<head>
-<meta charset="utf-8" />
-<title>Wicket extend</title>
-</head>
-
-<body>
- <wicket:extend>
- <h2>
- <wicket:message key="navbar.menu.seedLists">Seed lists</wicket:message>
- </h2>
-
- <div class="row">
- <div class="col-lg-8">
- <div class="row">
- <div class="col-lg-8 col-md-offset-10">
- <button class="btn btn-success btn-default" wicket:id="newSeedList">
- <i class="fa fa-plus"></i> Add new list
- </button>
- </div>
- </div>
- <table class="table table-hover table-striped tablesorter">
- <thead>
- <tr>
- <th class="header col-md-3">Name</th>
- <th class="header col-md-2">Urls</th>
- <th></th>
- </tr>
- </thead>
-
- <tbody>
- <tr wicket:id="seedLists">
- <td>
- <a href="#" wicket:id="edit">
- <span wicket:id="name">List name</span>
- </a>
- </td>
- <td>
- <span wicket:id="seedUrlsCount">10</span>
- </td>
- <td>
- <button class="btn btn-sm btn-danger" type="button" wicket:id="delete">
- <span class="fa fa-trash-o"></span>
- </button>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="col-lg-4">
- <div class="panel panel-primary">
- <div class="panel-heading">
- <h3 class="panel-title">Help</h3>
- </div>
- <div class="panel-body">
- <p>Some help about seed lists</p>
- </div>
- </div>
- </div>
- </div>
- <!--row-->
- </wicket:extend>
-</body>
-</html>
diff --git a/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.java b/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.java
deleted file mode 100644
index b837438..0000000
--- a/src/java/org/apache/nutch/webui/pages/seed/SeedListsPage.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.seed;
-
-import java.util.Iterator;
-
-import org.apache.nutch.webui.model.SeedList;
-import org.apache.nutch.webui.pages.AbstractBasePage;
-import org.apache.nutch.webui.pages.components.CpmIteratorAdapter;
-import org.apache.nutch.webui.service.SeedListService;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.link.Link;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.markup.repeater.RefreshingView;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-/**
- * This page is for seed lists management
- *
- * @author feodor
- *
- */
-public class SeedListsPage extends AbstractBasePage<Void> {
-
- @SpringBean
- private SeedListService seedListService;
-
- public SeedListsPage() {
-
- RefreshingView<SeedList> seedLists = new RefreshingView<SeedList>(
- "seedLists") {
-
- @Override
- protected Iterator<IModel<SeedList>> getItemModels() {
- return new CpmIteratorAdapter<>(seedListService.findAll());
- }
-
- @Override
- protected void populateItem(final Item<SeedList> item) {
- PageParameters params = new PageParameters();
- params.add("id", item.getModelObject().getId());
-
- Link<Void> edit = new BookmarkablePageLink<>("edit",
- SeedPage.class, params);
- edit.add(new Label("name"));
- item.add(edit);
-
- item.add(new Label("seedUrlsCount"));
-
- item.add(new Link<SeedList>("delete", item.getModel()) {
- @Override
- public void onClick() {
- seedListService.delete(item.getModelObject().getId());
- }
- });
- }
- };
-
- add(seedLists);
- add(new BookmarkablePageLink<Void>("newSeedList", SeedPage.class));
- }
-}
diff --git a/src/java/org/apache/nutch/webui/pages/seed/SeedPage.html b/src/java/org/apache/nutch/webui/pages/seed/SeedPage.html
deleted file mode 100644
index d6f33a3..0000000
--- a/src/java/org/apache/nutch/webui/pages/seed/SeedPage.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor
- license agreements. See the NOTICE file distributed with this work for additional
- information regarding copyright ownership. The ASF licenses this file to
- You under the Apache License, Version 2.0 (the "License"); you may not use
- this file except in compliance with the License. You may obtain a copy of
- the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required
- by applicable law or agreed to in writing, software distributed under the
- License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
- OF ANY KIND, either express or implied. See the License for the specific
- language governing permissions and limitations under the License. -->
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<head>
-<meta charset="utf-8" />
-<title>Wicket extend</title>
-</head>
-
-<body>
- <wicket:extend>
- <h2>
- <wicket:message key="page.header.seedList">Seed list</wicket:message>
- </h2>
-
- <div class="row">
- <div class="col-lg-8">
- <form class="form-horizontal" wicket:id="seedList">
- <fieldset>
- <!-- Text input-->
- <div class="form-group">
- <label class="col-md-4 control-label" for="textinput">Seed list name</label>
- <div class="col-md-4">
- <input wicket:id="name" name="textinput" class="form-control input-md" type="text">
- </div>
- </div>
- <div class="form-group">
- <div class="col-md-offset-4 col-md-4">
- <button type="submit" class="btn btn-primary">Save</button>
- </div>
- </div>
- </fieldset>
- </form>
- <h3>Seed urls</h3>
- <table class="table table-hover table-striped tablesorter">
- <thead>
- <tr>
- <th class="header col-md-3">Url</th>
- <th></th>
- </tr>
- </thead>
-
- <tbody wicket:id="seedUrlsTable">
- <tr wicket:id="seedUrls">
- <td>
- <span wicket:id="url">http://google.com</span>
- </td>
- <td>
- <button wicket:id="delete" class="btn btn-sm btn-danger" type="button">
- <span class="fa fa-trash-o"></span>
- </button>
- </td>
- </tr>
- </tbody>
- </table>
- <form class="form-horizontal" wicket:id="urlForm">
- <fieldset>
- <div class="form-group">
- <div class="col-md-4">
- <input wicket:id="url" name="textinput" class="form-control input-md" type="text">
- </div>
- <div>
- <button wicket:id="addUrl" class="btn btn-primary">Add url</button>
- </div>
- </div>
- </fieldset>
- </form>
- </div>
- <div class="col-lg-4">
- <div class="panel panel-primary">
- <div class="panel-heading">
- <h3 class="panel-title">Help</h3>
- </div>
- <div class="panel-body">
- <p>Some help about seed management</p>
- </div>
- </div>
- </div>
- </div>
- <!--row-->
- </wicket:extend>
-</body>
-</html>
diff --git a/src/java/org/apache/nutch/webui/pages/seed/SeedPage.java b/src/java/org/apache/nutch/webui/pages/seed/SeedPage.java
deleted file mode 100644
index fd9c418..0000000
--- a/src/java/org/apache/nutch/webui/pages/seed/SeedPage.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.seed;
-
-import java.util.Iterator;
-
-import org.apache.nutch.webui.model.SeedList;
-import org.apache.nutch.webui.model.SeedUrl;
-import org.apache.nutch.webui.pages.AbstractBasePage;
-import org.apache.nutch.webui.pages.components.CpmIteratorAdapter;
-import org.apache.nutch.webui.service.SeedListService;
-import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.AjaxLink;
-import org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.markup.repeater.RefreshingView;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
-import org.apache.wicket.model.Model;
-import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-import com.google.common.collect.Lists;
-
-/**
- * This page is for seed urls management
- *
- * @author feodor
- *
- */
-public class SeedPage extends AbstractBasePage<SeedList> {
-
- @SpringBean
- private SeedListService seedListService;
-
- private Form<SeedUrl> urlForm;
-
- private WebMarkupContainer seedUrlsTable;
-
- public SeedPage() {
- SeedList list = new SeedList();
- list.setSeedUrls(Lists.<SeedUrl> newArrayList());
- initPage(Model.of(list));
- }
-
- public SeedPage(final PageParameters parameters) {
- initPage(new LoadableDetachableModel<SeedList>() {
-
- @Override
- protected SeedList load() {
- Long seedListId = parameters.get("id").toLongObject();
- return seedListService.getSeedList(seedListId);
- }
- });
- }
-
- public void initPage(IModel<SeedList> model) {
- setModel(new CompoundPropertyModel<>(model));
-
- addBaseForm();
- addSeedUrlsList();
- addUrlForm();
- }
-
- private void addBaseForm() {
- Form<SeedList> form = new Form<SeedList>("seedList", getModel()) {
- @Override
- protected void onSubmit() {
- seedListService.save(getModelObject());
- setResponsePage(SeedListsPage.class);
- }
- };
- form.add(new TextField<String>("name"));
- add(form);
- }
-
- private void addSeedUrlsList() {
- seedUrlsTable = new WebMarkupContainer("seedUrlsTable");
- seedUrlsTable.setOutputMarkupId(true);
-
- RefreshingView<SeedUrl> seedUrls = new RefreshingView<SeedUrl>("seedUrls") {
-
- @Override
- protected Iterator<IModel<SeedUrl>> getItemModels() {
- return new CpmIteratorAdapter<>(getModelObject().getSeedUrls());
- }
-
- @Override
- protected void populateItem(Item<SeedUrl> item) {
- item.add(new Label("url"));
- item.add(new AjaxLink<SeedUrl>("delete", item.getModel()) {
-
- @Override
- public void onClick(AjaxRequestTarget target) {
- deleteSeedUrl(getModelObject());
- target.add(seedUrlsTable);
- }
- });
- }
- };
- seedUrlsTable.add(seedUrls);
- add(seedUrlsTable);
- }
-
- private void addUrlForm() {
- urlForm = new Form<>("urlForm", CompoundPropertyModel.of(Model
- .of(new SeedUrl())));
- urlForm.setOutputMarkupId(true);
- urlForm.add(new TextField<String>("url"));
- urlForm.add(new AjaxSubmitLink("addUrl", urlForm) {
- @Override
- protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
- addSeedUrl();
- urlForm.setModelObject(new SeedUrl());
- target.add(urlForm);
- target.add(seedUrlsTable);
- }
- });
- add(urlForm);
- }
-
- private void addSeedUrl() {
- SeedUrl url = urlForm.getModelObject();
- SeedList seedList = getModelObject();
- url.setSeedList(seedList);
- seedList.getSeedUrls().add(url);
- }
-
- private void deleteSeedUrl(SeedUrl url) {
- SeedList seedList = getModelObject();
- seedList.getSeedUrls().remove(url);
- }
-
-}
diff --git a/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.html b/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.html
deleted file mode 100644
index 8810371..0000000
--- a/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE html>
-<html xmlns:wicket="http://wicket.apache.org">
-<head>
-<meta charset="utf-8" />
-<title>Wicket extend</title>
-</head>
-
-<body>
- <wicket:extend>
- <h2>
- <wicket:message key="settings">Settings</wicket:message>
- </h2>
- <div class="row">
- <div class="col-lg-12">
- <table class="table table-hover tablesorter table-bordered">
- <thead>
- <tr>
- <th class="header col-lg-3">
- <wicket:message key="settings.header.name">Name</wicket:message>
- </th>
- <th class="header col-lg-9">
- <wicket:message key="settings.header.value">Value</wicket:message>
- </th>
- </tr>
- </thead>
- <tbody wicket:id="settingsTable">
- <tr wicket:id="settings">
- <td>
- <span wicket:id="name">Name</span>
- </td>
- <td>
-<!-- <span wicket:id="value">Value</span> -->
- <input class="col-lg-12" wicket:id="value" placeholder="http://localhost:8080">
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </wicket:extend>
-
-</body>
-</html>
diff --git a/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.java b/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.java
deleted file mode 100644
index dd3780b..0000000
--- a/src/java/org/apache/nutch/webui/pages/settings/SettingsPage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.pages.settings;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.nutch.webui.model.NutchConfig;
-import org.apache.nutch.webui.pages.AbstractBasePage;
-import org.apache.nutch.webui.pages.components.CpmIteratorAdapter;
-import org.apache.nutch.webui.service.NutchService;
-import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.basic.Label;
-import org.apache.wicket.markup.html.form.TextField;
-import org.apache.wicket.markup.repeater.Item;
-import org.apache.wicket.markup.repeater.RefreshingView;
-import org.apache.wicket.model.IModel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-
-public class SettingsPage extends AbstractBasePage<Void> {
- @SpringBean
- private NutchService nutchService;
-
- private WebMarkupContainer settingsTable;
-
- public SettingsPage() {
- settingsTable = new WebMarkupContainer("settingsTable");
- settingsTable.setOutputMarkupId(true);
- RefreshingView<NutchConfig> nutchConfig = new RefreshingView<NutchConfig>(
- "settings") {
-
- @Override
- protected Iterator<IModel<NutchConfig>> getItemModels() {
- return new CpmIteratorAdapter<>(
- convertNutchConfig(nutchService.getNutchConfig(getCurrentInstance()
- .getId())));
- }
-
- @Override
- protected void populateItem(Item<NutchConfig> item) {
- item.add(new Label("name"));
- item.add(new TextField<String>("value"));
- }
- };
- settingsTable.add(nutchConfig);
- add(settingsTable);
- }
-
- private List<NutchConfig> convertNutchConfig(Map<String, String> map) {
- List<NutchConfig> listNutchConfigs = new LinkedList<>();
- for (String key : map.keySet()) {
- NutchConfig conf = new NutchConfig();
- conf.setName(key);
- conf.setValue(map.get(key));
- listNutchConfigs.add(conf);
- }
- return listNutchConfigs;
- }
-}
diff --git a/src/java/org/apache/nutch/webui/service/CrawlService.java b/src/java/org/apache/nutch/webui/service/CrawlService.java
deleted file mode 100644
index c23c0da..0000000
--- a/src/java/org/apache/nutch/webui/service/CrawlService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.service;
-
-import java.util.List;
-
-import org.apache.nutch.webui.client.model.Crawl;
-import org.apache.nutch.webui.model.NutchInstance;
-
-public interface CrawlService {
-
- public void saveCrawl(Crawl crawl);
-
- public List<Crawl> getCrawls();
-
- void startCrawl(Long crawlId, NutchInstance instance);
-
- void deleteCrawl(Long crawlId);
-}
diff --git a/src/java/org/apache/nutch/webui/service/NutchInstanceService.java b/src/java/org/apache/nutch/webui/service/NutchInstanceService.java
deleted file mode 100644
index 8607539..0000000
--- a/src/java/org/apache/nutch/webui/service/NutchInstanceService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.service;
-
-import java.util.List;
-
-import org.apache.nutch.webui.model.NutchInstance;
-
-public interface NutchInstanceService {
-
- public List<NutchInstance> getInstances();
-
- public void saveInstance(NutchInstance instance);
-
- public void removeInstance(Long id);
-
- public NutchInstance getInstance(Long id);
-
-}
diff --git a/src/java/org/apache/nutch/webui/service/NutchService.java b/src/java/org/apache/nutch/webui/service/NutchService.java
deleted file mode 100644
index 6a145c4..0000000
--- a/src/java/org/apache/nutch/webui/service/NutchService.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.service;
-
-import java.util.Map;
-
-import org.apache.nutch.webui.client.model.ConnectionStatus;
-import org.apache.nutch.webui.client.model.NutchStatus;
-
-public interface NutchService {
- public ConnectionStatus getConnectionStatus(Long instanceId);
-
- public Map<String, String> getNutchConfig(Long instanceId);
-
- public NutchStatus getNutchStatus(Long instanceId);
-
-}
diff --git a/src/java/org/apache/nutch/webui/service/SeedListService.java b/src/java/org/apache/nutch/webui/service/SeedListService.java
deleted file mode 100644
index 731ab6c..0000000
--- a/src/java/org/apache/nutch/webui/service/SeedListService.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.service;
-
-import java.util.List;
-
-import org.apache.nutch.webui.model.SeedList;
-
-public interface SeedListService {
-
- public void save(SeedList seedList);
-
- public void delete(Long seedListId);
-
- public List<SeedList> findAll();
-
- public SeedList getSeedList(Long seedListId);
-
-}
diff --git a/src/java/org/apache/nutch/webui/service/impl/CrawlServiceImpl.java b/src/java/org/apache/nutch/webui/service/impl/CrawlServiceImpl.java
deleted file mode 100644
index 1d9120e..0000000
--- a/src/java/org/apache/nutch/webui/service/impl/CrawlServiceImpl.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.service.impl;
-
-import java.lang.invoke.MethodHandles;
-import java.sql.SQLException;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.apache.nutch.webui.client.NutchClient;
-import org.apache.nutch.webui.client.NutchClientFactory;
-import org.apache.nutch.webui.client.impl.CrawlingCycle;
-import org.apache.nutch.webui.client.impl.RemoteCommandsBatchFactory;
-import org.apache.nutch.webui.client.impl.CrawlingCycleListener;
-import org.apache.nutch.webui.client.impl.RemoteCommand;
-import org.apache.nutch.webui.client.impl.RemoteCommandExecutor;
-import org.apache.nutch.webui.client.model.Crawl;
-import org.apache.nutch.webui.client.model.Crawl.CrawlStatus;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.service.CrawlService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-
-import com.j256.ormlite.dao.Dao;
-
-@Service
-public class CrawlServiceImpl implements CrawlService, CrawlingCycleListener {
- private static final Logger LOG = LoggerFactory
- .getLogger(MethodHandles.lookup().lookupClass());
-
- @Resource
- private Dao<Crawl, Long> crawlDao;
-
- @Resource
- private NutchClientFactory nutchClientFactory;
-
- @Resource
- private RemoteCommandsBatchFactory commandFactory;
-
- @Override
- @Async
- public void startCrawl(Long crawlId, NutchInstance instance) {
- Crawl crawl = null;
- try {
- crawl = crawlDao.queryForId(crawlId);
- if(crawl.getCrawlId()==null) {
- crawl.setCrawlId("crawl-" + crawlId.toString());
- }
- NutchClient client = nutchClientFactory.getClient(instance);
- String seedDirectory = client.createSeed(crawl.getSeedList());
- crawl.setSeedDirectory(seedDirectory);
-
- List<RemoteCommand> commands = commandFactory.createCommands(crawl);
- RemoteCommandExecutor executor = new RemoteCommandExecutor(client);
-
- CrawlingCycle cycle = new CrawlingCycle(this, executor, crawl, commands);
- cycle.executeCrawlCycle();
-
- } catch (Exception e) {
- crawl.setStatus(CrawlStatus.ERROR);
- saveCrawl(crawl);
- LOG.error("exception occured", e);
- }
- }
-
- @Override
- public List<Crawl> getCrawls() {
- try {
- return crawlDao.queryForAll();
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void saveCrawl(Crawl crawl) {
- try {
- crawlDao.createOrUpdate(crawl);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void deleteCrawl(Long crawlId) {
- try {
- crawlDao.deleteById(crawlId);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void crawlingStarted(Crawl crawl) {
- crawl.setStatus(CrawlStatus.CRAWLING);
- crawl.setProgress(0);
- saveCrawl(crawl);
- }
-
- @Override
- public void onCrawlError(Crawl crawl, String msg) {
- crawl.setStatus(CrawlStatus.ERROR);
- saveCrawl(crawl);
- }
-
- @Override
- public void commandExecuted(Crawl crawl, RemoteCommand command, int progress) {
- crawl.setProgress(progress);
- saveCrawl(crawl);
- }
-
- @Override
- public void crawlingFinished(Crawl crawl) {
- crawl.setStatus(CrawlStatus.FINISHED);
- saveCrawl(crawl);
- }
-}
diff --git a/src/java/org/apache/nutch/webui/service/impl/NutchInstanceServiceImpl.java b/src/java/org/apache/nutch/webui/service/impl/NutchInstanceServiceImpl.java
deleted file mode 100644
index ac8b815..0000000
--- a/src/java/org/apache/nutch/webui/service/impl/NutchInstanceServiceImpl.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.service.impl;
-
-import java.sql.SQLException;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.apache.nutch.webui.client.NutchClientFactory;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.service.NutchInstanceService;
-import org.springframework.stereotype.Service;
-
-import com.j256.ormlite.dao.Dao;
-
-@Service
-public class NutchInstanceServiceImpl implements NutchInstanceService {
-
- @Resource
- private NutchClientFactory nutchClientFactory;
-
- @Resource
- private Dao<NutchInstance, Long> instancesDao;
-
- @Override
- public List<NutchInstance> getInstances() {
- try {
- return instancesDao.queryForAll();
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- @Override
- public NutchInstance getInstance(Long id) {
- try {
- return instancesDao.queryForId(id);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void saveInstance(NutchInstance instance) {
- try {
- instancesDao.createOrUpdate(instance);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void removeInstance(Long id) {
- try {
- instancesDao.deleteById(id);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/src/java/org/apache/nutch/webui/service/impl/NutchServiceImpl.java b/src/java/org/apache/nutch/webui/service/impl/NutchServiceImpl.java
deleted file mode 100644
index 322b864..0000000
--- a/src/java/org/apache/nutch/webui/service/impl/NutchServiceImpl.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.service.impl;
-
-import java.lang.invoke.MethodHandles;
-import java.net.ConnectException;
-import java.util.Collections;
-import java.util.Map;
-
-import javax.annotation.Resource;
-
-import org.apache.nutch.webui.client.NutchClientFactory;
-import org.apache.nutch.webui.client.model.ConnectionStatus;
-import org.apache.nutch.webui.client.model.NutchStatus;
-import org.apache.nutch.webui.model.NutchInstance;
-import org.apache.nutch.webui.service.NutchInstanceService;
-import org.apache.nutch.webui.service.NutchService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Service;
-
-import com.sun.jersey.api.client.ClientHandlerException;
-
-@Service
-public class NutchServiceImpl implements NutchService {
- private static final Logger LOG = LoggerFactory
- .getLogger(MethodHandles.lookup().lookupClass());
-
- @Resource
- private NutchClientFactory nutchClientFactory;
-
- @Resource
- private NutchInstanceService instanceService;
-
- @Override
- public ConnectionStatus getConnectionStatus(Long instanceId) {
- NutchInstance instance = instanceService.getInstance(instanceId);
- try {
- NutchStatus nutchStatus = nutchClientFactory.getClient(instance)
- .getNutchStatus();
- if (nutchStatus.getStartDate() != null) {
- return ConnectionStatus.CONNECTED;
- }
- } catch (Exception e) {
- if (e.getCause() instanceof ConnectException) {
- return ConnectionStatus.DISCONNECTED;
- }
-
- LOG.error("Cannot connect to nutch server!", e);
- }
- return null;
- }
-
- @Override
- public Map<String, String> getNutchConfig(Long instanceId) {
- NutchInstance instance = instanceService.getInstance(instanceId);
- try {
- return nutchClientFactory.getClient(instance).getNutchConfig("default");
- } catch (ClientHandlerException exception) {
- return Collections.emptyMap();
- }
- }
-
- @Override
- public NutchStatus getNutchStatus(Long instanceId) {
- NutchInstance instance = instanceService.getInstance(instanceId);
- return nutchClientFactory.getClient(instance).getNutchStatus();
- }
-}
diff --git a/src/java/org/apache/nutch/webui/service/impl/SeedListServiceImpl.java b/src/java/org/apache/nutch/webui/service/impl/SeedListServiceImpl.java
deleted file mode 100644
index d54d3ff..0000000
--- a/src/java/org/apache/nutch/webui/service/impl/SeedListServiceImpl.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.nutch.webui.service.impl;
-
-import java.sql.SQLException;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.apache.nutch.webui.model.SeedList;
-import org.apache.nutch.webui.model.SeedUrl;
-import org.apache.nutch.webui.service.SeedListService;
-import org.springframework.stereotype.Service;
-
-import com.j256.ormlite.dao.Dao;
-
-@Service
-public class SeedListServiceImpl implements SeedListService {
-
- @Resource
- private Dao<SeedList, Long> seedListDao;
-
- @Resource
- private Dao<SeedUrl, Long> seedUrlDao;
-
- @Override
- public void save(SeedList seedList) {
- try {
- seedListDao.createOrUpdate(seedList);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void delete(Long seedListId) {
- try {
- seedListDao.deleteById(seedListId);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
-
- }
-
- @Override
- public List<SeedList> findAll() {
- try {
- return seedListDao.queryForAll();
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public SeedList getSeedList(Long seedListId) {
- try {
- return seedListDao.queryForId(seedListId);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
-}