Skip to content

Commit

Permalink
added parameter for main update site like: -DudpateSite=http://www.so…
Browse files Browse the repository at this point in the history
…mesite.net/update/program/ (site.xml expected in program folder)
  • Loading branch information
Xyrio committed Dec 7, 2017
1 parent c7bdd5b commit f1d8554
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 18 deletions.
Expand Up @@ -8,6 +8,7 @@
import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.HttpConfiguration;
import org.eclipse.jetty.server.HttpConnectionFactory;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.SecureRequestCustomizer;
import org.eclipse.jetty.server.Server;
Expand All @@ -16,6 +17,7 @@
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.DefaultHandler;
import org.eclipse.jetty.server.handler.HandlerList;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.util.resource.Resource;
import org.eclipse.jetty.util.security.Constraint;
Expand Down Expand Up @@ -58,11 +60,22 @@
/**
* https://www.eclipse.org/jetty/documentation/9.4.x/embedded-examples.html
*/
public class TestUtils {
public class TestWebServer {
public static final String someFeedName = "some_feed.xml";

public static void main(String[] args) {

NCSARequestLog requestLog = new NCSARequestLog();
// requestLog.setFilename("/path/to/my/logs/yyyy_mm_dd.request.log");
// requestLog.setFilenameDateFormat("yyyy_MM_dd");
// requestLog.setAppend(true);
// requestLog.setRetainDays(1);
requestLog.setExtended(true);
requestLog.setLogCookies(false);
requestLog.setLogTimeZone("GMT");
RequestLogHandler requestLogHandler = new RequestLogHandler();
requestLogHandler.setRequestLog(requestLog);

try {
String jettyDistKeystore = "unimportant_weak.keystore";
File keystoreFile = new File(jettyDistKeystore);
Expand Down Expand Up @@ -187,10 +200,25 @@ public void run() {
}
});

ContextHandler updateProgramCH = new ContextHandler("/rssowl/");
{
String updateSitePath = "file:///S:\\CODE\\ProjectsMy\\java\\rssowl\\rssowlprj\\update_site_2_3_1\\rssowl";
Resource updateSiteResource = Resource.newResource(updateSitePath);
if (updateSiteResource.isAlias())
updateSitePath = updateSiteResource.getAlias().toString();

ResourceHandler updateProgramRH = new ResourceHandler();
updateProgramRH.setDirAllowed(true);
updateProgramRH.setDirectoriesListed(true);
updateProgramRH.setResourceBase(updateSitePath);

updateProgramCH.setHandler(updateProgramRH);
}

DefaultHandler defaultHandler = new DefaultHandler();

HandlerList handlers = new HandlerList();
handlers.setHandlers(new Handler[] { feedContextHandler, authContextHandler, quitContextHandler, defaultHandler });
handlers.setHandlers(new Handler[] { requestLogHandler, updateProgramCH, feedContextHandler, authContextHandler, quitContextHandler, defaultHandler });
server.setHandler(handlers);

// System.out.println(server.dump());
Expand Down
2 changes: 1 addition & 1 deletion org.rssowl.core/META-INF/MANIFEST.MF
Expand Up @@ -11,7 +11,7 @@ Require-Bundle: org.rssowl.lib.db4o,
org.rssowl.lib.lucene,
org.eclipse.core.runtime,
org.eclipse.core.net,
org.eclipse.equinox.security;bundle-version="1.0.0"
org.eclipse.equinox.security
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Expand Down
2 changes: 1 addition & 1 deletion org.rssowl.feature.tests/feature.xml
Expand Up @@ -20,11 +20,11 @@
<requires>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.rssowl.lib.jdom"/>
<import plugin="org.junit4"/>
<import plugin="org.eclipse.ui"/>
<import plugin="org.rssowl.ui"/>
<import plugin="org.rssowl.lib.db4o"/>
<import plugin="org.rssowl.core"/>
<import plugin="org.junit"/>
</requires>

<plugin
Expand Down
2 changes: 1 addition & 1 deletion org.rssowl.feature/feature.xml
Expand Up @@ -237,7 +237,7 @@ litigation.
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.update.ui"/>
<import plugin="org.eclipse.update.core"/>
<import plugin="org.eclipse.update.core" version="3.2.600" match="equivalent"/>
<import plugin="org.eclipse.equinox.security" version="1.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.equinox.console" version="1.0.0" match="greaterOrEqual"/>
<import plugin="org.apache.felix.gogo.runtime" version="0.8.0" match="greaterOrEqual"/>
Expand Down
6 changes: 3 additions & 3 deletions org.rssowl.ui/META-INF/MANIFEST.MF
Expand Up @@ -8,16 +8,16 @@ Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.update.ui,
org.eclipse.update.core,
org.rssowl.core,
org.eclipse.update.core;bundle-version="[3.2.600,3.2.800)",
org.eclipse.equinox.security;bundle-version="1.0.0",
org.eclipse.equinox.console;bundle-version="1.0.0",
org.apache.felix.gogo.runtime;bundle-version="0.8.0",
org.apache.felix.gogo.shell;bundle-version="0.8.0",
org.apache.felix.gogo.command;bundle-version="0.8.0",
org.eclipse.emf.ecore.change;bundle-version="2.8.0",
org.eclipse.emf.ecore.xmi;bundle-version="2.8.1",
org.eclipse.e4.core.di;bundle-version="1.6.1"
org.eclipse.e4.core.di;bundle-version="1.6.1",
org.rssowl.core
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.rssowl.ui.dialogs.properties,
Expand Down
8 changes: 4 additions & 4 deletions org.rssowl.ui/src/org/rssowl/ui/internal/Controller.java
Expand Up @@ -284,7 +284,7 @@ public class Controller {
private final AtomicLong fLastGoogleLoginCancel = new AtomicLong(0);
private BookMarkAdapter fBookMarkListener;
private LabelListener fLabelListener;
private ListenerList fBookMarkLoadListeners = new ListenerList();
private ListenerList<BookMarkLoadListener> fBookMarkLoadListeners = new ListenerList<>();
private final int fConnectionTimeout;
private List<ShareProvider> fShareProviders = new ArrayList<ShareProvider>();
private Map<String, LinkTransformer> fLinkTransformers = new HashMap<String, LinkTransformer>();
Expand Down Expand Up @@ -1851,7 +1851,7 @@ private void defineLabelCommands(Collection<ILabel> labels) {
if (InternalOwl.TESTING)
return;

ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService == null)
return;

Expand All @@ -1867,7 +1867,7 @@ private void defineSharingCommands(List<ShareProvider> shareProviders) {
if (InternalOwl.TESTING)
return;

ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService == null)
return;

Expand All @@ -1890,7 +1890,7 @@ private void undefineLabelCommands(Collection<ILabel> labels) {
if (InternalOwl.TESTING)
return;

ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class);
if (commandService == null)
return;

Expand Down
Expand Up @@ -63,6 +63,10 @@
*/
public class FindUpdatesAction extends Action implements IWorkbenchWindowActionDelegate {
private static final String UPDATE_SITE = "http://boreal.rssowl.org/update/program/"; //$NON-NLS-1$

/* System Property to Control Site for Updates to look for */
private static final String EXTENSION_SITE_PROPERTY = "updateSite"; //$NON-NLS-1$

private Shell fShell;
private final boolean fUserInitiated;

Expand All @@ -72,8 +76,8 @@ public FindUpdatesAction() {
}

/**
* @param userInitiated if <code>true</code> will open a dialog informing
* about updates, even when none exist.
* @param userInitiated if <code>true</code> will open a dialog informing about
* updates, even when none exist.
*/
public FindUpdatesAction(boolean userInitiated) {
fUserInitiated = userInitiated;
Expand All @@ -90,11 +94,25 @@ public void run() {
return;

try {

/* Scope to RSSOwl Updates Only */
UpdateSearchScope scope = new UpdateSearchScope();
scope.addSearchSite("RSSOwl.org", new URL(UPDATE_SITE), null); //$NON-NLS-1$
scope.setFeatureProvidedSitesEnabled(false);

/* Check for User Defined Sites from System Property */
String extensionSites = System.getProperty(EXTENSION_SITE_PROPERTY);
if (StringUtils.isSet(extensionSites)) {
try {
URL url = new URL(extensionSites);
scope.addSearchSite(url.toString(), url, null);
} catch (MalformedURLException e) {
// skip bad URLs
}
}

/* Add RSSOwl.org if user did not define any other sites */
if (scope.getSearchSites().length == 0) {
URL url = new URL(UPDATE_SITE);
scope.addSearchSite("RSSOwl.org", url, null); //$NON-NLS-1$
scope.setFeatureProvidedSitesEnabled(false);
}

/* Run in Update Job */
final UpdateJob job = new UpdateJob(Messages.FindUpdatesAction_UPDATE_SEARCH, true, false);
Expand Down

0 comments on commit f1d8554

Please sign in to comment.