summaryrefslogtreecommitdiff
path: root/nlpsolver/src
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2011-11-25 14:48:18 +0000
committerMichael Meeks <michael.meeks@suse.com>2011-11-28 11:07:00 +0000
commite699314df8fb81c06ae632b18dc3b4bcf1028129 (patch)
tree664ba9639831fa78e3dcebc2f5207ef5efd24d7b /nlpsolver/src
parent9df9da38c90eb6f379fa7d9d63a7aa01d074506d (diff)
nlpsolver: migrate the build to use native gnumake build
Remove dmake, build.pl and ant build cruft. Update extension description, cleanup file locations etc. Switch to passive registration.
Diffstat (limited to 'nlpsolver/src')
-rwxr-xr-xnlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java2
-rwxr-xr-xnlpsolver/src/com/sun/star/comp/Calc/NLPSolver/CentralRegistrationClass.java146
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/Manifest.mf1
-rwxr-xr-xnlpsolver/src/com/sun/star/comp/Calc/NLPSolver/PropertyInfo.java5
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/Registration.java61
-rwxr-xr-xnlpsolver/src/com/sun/star/comp/Calc/NLPSolver/description-en-US.txt2
-rw-r--r--nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/description.xml (renamed from nlpsolver/src/description.xml)9
-rw-r--r--[-rwxr-xr-x]nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/manifest.xml (renamed from nlpsolver/src/uno-extension-manifest.xml)4
-rwxr-xr-xnlpsolver/src/locale/NLPSolverCommon_en_US.properties2
9 files changed, 73 insertions, 159 deletions
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java
index eb30bcfe7666..b4c18a22ee85 100755
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/BaseNLPSolver.java
@@ -99,7 +99,7 @@ public abstract class BaseNLPSolver extends WeakBase
}
resourceManager = new ResourceManager(xContext, "com.sun.star.comp.Calc.NLPSolver", "/locale", "NLPSolverCommon");
-
+
registerProperty(m_assumeNonNegative);
}
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/CentralRegistrationClass.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/CentralRegistrationClass.java
deleted file mode 100755
index 0d9fb029b0f5..000000000000
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/CentralRegistrationClass.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2009 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: CentralRegistrationClass.java,v $
- * $Revision: 1.1 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-package com.sun.star.comp.Calc.NLPSolver;
-
-import com.sun.star.lang.XSingleComponentFactory;
-import com.sun.star.registry.XRegistryKey;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.net.JarURLConnection;
-import java.net.URL;
-import java.util.Enumeration;
-import java.util.StringTokenizer;
-import java.util.jar.Attributes;
-import java.util.jar.Manifest;
-
-/**
- *
- * @author as231978
- */
-public class CentralRegistrationClass {
-
- public static XSingleComponentFactory __getComponentFactory( String sImplementationName ) {
- String regClassesList = getRegistrationClasses();
- StringTokenizer t = new StringTokenizer(regClassesList, " ");
- while (t.hasMoreTokens()) {
- String className = t.nextToken();
- if (className != null && className.length() != 0) {
- try {
- Class regClass = Class.forName(className);
- Method writeRegInfo = regClass.getDeclaredMethod("__getComponentFactory", new Class[]{String.class});
- Object result = writeRegInfo.invoke(regClass, sImplementationName);
- if (result != null) {
- return (XSingleComponentFactory)result;
- }
- }
- catch (ClassNotFoundException ex) {
- ex.printStackTrace();
- } catch (ClassCastException ex) {
- ex.printStackTrace();
- } catch (SecurityException ex) {
- ex.printStackTrace();
- } catch (NoSuchMethodException ex) {
- ex.printStackTrace();
- } catch (IllegalArgumentException ex) {
- ex.printStackTrace();
- } catch (InvocationTargetException ex) {
- ex.printStackTrace();
- } catch (IllegalAccessException ex) {
- ex.printStackTrace();
- }
- }
- }
- return null;
- }
-
- public static boolean __writeRegistryServiceInfo( XRegistryKey xRegistryKey ) {
- boolean bResult = true;
- String regClassesList = getRegistrationClasses();
- StringTokenizer t = new StringTokenizer(regClassesList, " ");
- while (t.hasMoreTokens()) {
- String className = t.nextToken();
- if (className != null && className.length() != 0) {
- try {
- Class regClass = Class.forName(className);
- Method writeRegInfo = regClass.getDeclaredMethod("__writeRegistryServiceInfo", new Class[]{XRegistryKey.class});
- Object result = writeRegInfo.invoke(regClass, xRegistryKey);
- bResult &= ((Boolean)result).booleanValue();
- }
- catch (ClassNotFoundException ex) {
- ex.printStackTrace();
- } catch (ClassCastException ex) {
- ex.printStackTrace();
- } catch (SecurityException ex) {
- ex.printStackTrace();
- } catch (NoSuchMethodException ex) {
- ex.printStackTrace();
- } catch (IllegalArgumentException ex) {
- ex.printStackTrace();
- } catch (InvocationTargetException ex) {
- ex.printStackTrace();
- } catch (IllegalAccessException ex) {
- ex.printStackTrace();
- }
- }
- }
- return bResult;
- }
-
- private static String getRegistrationClasses() {
- CentralRegistrationClass c = new CentralRegistrationClass();
- String name = c.getClass().getCanonicalName().replace('.', '/').concat(".class");
- try {
- Enumeration<URL> urlEnum = c.getClass().getClassLoader().getResources("META-INF/MANIFEST.MF");
- while (urlEnum.hasMoreElements()) {
- URL url = urlEnum.nextElement();
- String file = url.getFile();
- JarURLConnection jarConnection =
- (JarURLConnection) url.openConnection();
- Manifest mf = jarConnection.getManifest();
-
- Attributes attrs = (Attributes) mf.getAttributes(name);
- if ( attrs != null ) {
- String classes = attrs.getValue( "RegistrationClasses" );
- return classes;
- }
- }
- } catch (IOException ex) {
- ex.printStackTrace();
- }
-
- return "";
- }
-
- /** Creates a new instance of CentralRegistrationClass */
- private CentralRegistrationClass() {
- }
-}
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/Manifest.mf b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/Manifest.mf
new file mode 100644
index 000000000000..d194e6a3bbf6
--- /dev/null
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/Manifest.mf
@@ -0,0 +1 @@
+RegistrationClassName: com.sun.star.comp.Calc.NLPSolver.Registration
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/PropertyInfo.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/PropertyInfo.java
index a32cb3988418..8b286ebff802 100755
--- a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/PropertyInfo.java
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/PropertyInfo.java
@@ -55,7 +55,7 @@ public class PropertyInfo<PropType> {
public String getDescription() {
return m_description;
}
-
+
public void setValue(Object value) throws IllegalArgumentException {
if (m_property.Type == Type.LONG) {
if (!(value instanceof Integer))
@@ -97,8 +97,9 @@ public class PropertyInfo<PropType> {
public void localize(ResourceManager resourceManager) {
try {
m_description = resourceManager.getLocalizedString("Properties." + m_property.Name);
+ System.out.println("Localised description to " + m_description);
} catch (com.sun.star.resource.MissingResourceException ex) {
-
+ System.out.println("No properties file !");
}
}
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/Registration.java b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/Registration.java
new file mode 100644
index 000000000000..edeb6a447c13
--- /dev/null
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/Registration.java
@@ -0,0 +1,61 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Novell, Inc. (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+package com.sun.star.comp.Calc.NLPSolver;
+
+import com.sun.star.lib.uno.helper.Factory;
+import com.sun.star.lang.XSingleComponentFactory;
+import java.io.IOException;
+
+public final class Registration {
+
+ private static final String[] m_serviceNames = {
+ "com.sun.star.beans.PropertySet",
+ "com.sun.star.sheet.Solver"
+ };
+
+ public static XSingleComponentFactory __getComponentFactory( String sImplementationName )
+ {
+ XSingleComponentFactory xFactory = null;
+
+ System.out.println("Get component '" + sImplementationName + "'");
+
+ if ( sImplementationName.equals( "com.sun.star.comp.Calc.NLPSolver.DEPSSolverImpl" ) )
+ xFactory = Factory.createComponentFactory( com.sun.star.comp.Calc.NLPSolver.DEPSSolverImpl.class,
+ m_serviceNames );
+ if ( sImplementationName.equals( "com.sun.star.comp.Calc.NLPSolver.SCOSolverImpl" ) )
+ xFactory = Factory.createComponentFactory( com.sun.star.comp.Calc.NLPSolver.SCOSolverImpl.class,
+ m_serviceNames );
+
+ System.out.println("Return factory " + xFactory);
+
+ return xFactory;
+ }
+ private Registration() {}
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/description-en-US.txt b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/description-en-US.txt
new file mode 100755
index 000000000000..5a9fbed0f73d
--- /dev/null
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/description-en-US.txt
@@ -0,0 +1,2 @@
+This extension integrates into Calc and offers new Solver engines
+to use for optimizing nonlinear programming models. \ No newline at end of file
diff --git a/nlpsolver/src/description.xml b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/description.xml
index 424b289bb8b7..45fdbd8807e7 100644
--- a/nlpsolver/src/description.xml
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/description.xml
@@ -7,16 +7,11 @@
<name lang="en">Solver for Nonlinear Programming</name>
</display-name>
<publisher>
- <name lang="en" xlink:href="http://www.sun.com/software/star/staroffice/extensions.jsp?cid=925095">Sun Microsystems</name>
+ <name lang="en" xlink:href="http://www.documentfoundation.org">The Document Foundation</name>
</publisher>
<extension-description>
- <src lang="en" xlink:href="description/extensiondescription.txt"/>
+ <src lang="en" xlink:href="description-en-US.txt"/>
</extension-description>
- <registration>
- <simple-license accept-by="admin" default-license-id="en">
- <license-text lang="en" license-id="en" xlink:href="licenses/lgpl-3.0.txt"/>
- </simple-license>
- </registration>
<dependencies>
<OpenOffice.org-minimal-version xmlns:d="http://openoffice.org/extensions/description/2006" d:name="OpenOffice.org 3.0" value="3.0"/>
</dependencies>
diff --git a/nlpsolver/src/uno-extension-manifest.xml b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/manifest.xml
index b6631450a30b..0867cdd961e4 100755..100644
--- a/nlpsolver/src/uno-extension-manifest.xml
+++ b/nlpsolver/src/com/sun/star/comp/Calc/NLPSolver/manifest.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest:manifest xmlns:manifest="http://openoffice.org/2001/manifest">
- <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-component;type=Java"
- manifest:full-path="NLPSolver.jar"/>
+ <manifest:file-entry manifest:media-type="application/vnd.sun.star.uno-components"
+ manifest:full-path="components.rdb"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.help"
manifest:full-path="help"/>
<manifest:file-entry manifest:media-type="application/vnd.sun.star.package-bundle-description"
diff --git a/nlpsolver/src/locale/NLPSolverCommon_en_US.properties b/nlpsolver/src/locale/NLPSolverCommon_en_US.properties
index ee96915b8615..0a84019d89a7 100755
--- a/nlpsolver/src/locale/NLPSolverCommon_en_US.properties
+++ b/nlpsolver/src/locale/NLPSolverCommon_en_US.properties
@@ -2,7 +2,7 @@
NLPSolverCommon.Properties.AssumeNonNegative=Assume Non-Negative Variables
#BaseEvolutionarySolver
-NLPSolverCommon.Properties.SwarmSize=Size of Swam
+NLPSolverCommon.Properties.SwarmSize=Size of Swarm
NLPSolverCommon.Properties.LibrarySize=Size of Library
NLPSolverCommon.Properties.LearningCycles=Learning Cycles
NLPSolverCommon.Properties.GuessVariableRange=Variable Bounds Guessing