Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
<classpathentry kind="lib" path="war/WEB-INF/lib/commons-io-2.0.1.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/flexjson-2.1.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwt-servlet.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwtupload-0.6.3-compat.jar" sourcepath="/home/sfbs/.m2/repository/com/googlecode/gwtupload/gwtupload/0.6.3-compat/gwtupload-0.6.3-compat-sources.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/gwtupload-0.6.3-compat.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/log4j-1.2.16.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/dml-1.1.3.jar" sourcepath="/dml"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/fenix-framework-core-1.1.3.jar" sourcepath="/fenix-framework-core"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/dml-fenix-1.1.3.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/dml"/>
<classpathentry combineaccessrules="false" kind="src" path="/dml-fenix"/>
<classpathentry combineaccessrules="false" kind="src" path="/fenix-framework-core"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/antlr-2.7.7.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/commons-lang-2.6.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/joda-time-1.6.2.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/slf4j-api-1.7.2.jar"/>
<classpathentry kind="lib" path="war/WEB-INF/lib/fenix-framework-core-dml-2.4.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
9 changes: 6 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

<target name="init">
<mkdir dir="${build}" />

</target>

<target name="clean">
Expand Down Expand Up @@ -51,15 +50,19 @@
</classpath>
</javac>
</target>

<target name="war" depends="compile,compile-javascript">

<target name="war-only">
<copy file="configuration.properties" todir="war/WEB-INF/classes"/>
<manifest file="MANIFEST.MF">
<attribute name="Main-Class" value="fenixDomainBrowser.server.Start" />
</manifest>
<war basedir="war" destfile="fdb.war" webxml="war/WEB-INF/web.xml">
<webinf dir="war/WEB-INF/">
<include name="**/*.jar" />
<include name="configuration.properties"/>
</webinf>
</war>
</target>
<target name="war" depends="compile,compile-javascript, war-only">
</target>
</project>
2 changes: 2 additions & 0 deletions configuration.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#comma separated list of dml urls
dml.path=/home/testEnv/fdb/fenix-webapp/target/dmls
1 change: 0 additions & 1 deletion src/fenixDomainBrowser/client/ClassSelected.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
Expand Down
1 change: 0 additions & 1 deletion src/fenixDomainBrowser/client/CustomButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.Element;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Image;

Expand Down
5 changes: 0 additions & 5 deletions src/fenixDomainBrowser/client/DashBoard.java
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
package fenixDomainBrowser.client;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.client.Window;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HasText;
import com.google.gwt.user.client.ui.Widget;

public class DashBoard extends Composite {
Expand Down
4 changes: 2 additions & 2 deletions src/fenixDomainBrowser/client/Interface.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,10 @@ public void onClick(ClickEvent event) {
public void onClick(ClickEvent arg0) {
final PopupPanel popupPanel = new PopupPanel();
popupPanel.setWidth("500px");
popupPanel.add(new Label("Loading DML from SVN ..."));
popupPanel.add(new Label("Loading DML from GitHub ..."));
popupPanel.center();
popupPanel.show();
RELAY.freshDML(new LoadClassesCallback(popupPanel, "Loading DML from SVN ...", "Fenix Live",
RELAY.freshDML(new LoadClassesCallback(popupPanel, "Loading DML from GitHub ...", "Fenix Live",
"net.sourceforge.fenixedu.domain"));
}
});
Expand Down
51 changes: 51 additions & 0 deletions src/fenixDomainBrowser/server/ConfigurationProperties.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package fenixDomainBrowser.server;

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

import org.apache.commons.lang.StringUtils;

public class ConfigurationProperties {
private static Properties props;

static {
props = new Properties();
try {
props.load(ConfigurationProperties.class.getResourceAsStream("/configuration.properties"));
} catch (IOException e) {
e.printStackTrace();
}
}

public static Map<String, URL> getDMLUrls() {
Map<String, URL> urls = new HashMap<String, URL>();
String dmlPath = (String) props.get("dml.path");

if (StringUtils.isEmpty(dmlPath)) {
dmlPath = "/tmp/dmls/";
}

File[] listFiles = new File(dmlPath).listFiles(new FilenameFilter() {

@Override
public boolean accept(File dir, String name) {
return name.endsWith(".dml");
}
});

for (File file : listFiles) {
try {
urls.put(file.getName(), file.toURL());
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
return urls;
}
}
27 changes: 12 additions & 15 deletions src/fenixDomainBrowser/server/DomainModelProvider.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package fenixDomainBrowser.server;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
Expand All @@ -16,15 +14,13 @@
import java.util.List;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;

import pt.ist.fenixframework.pstm.DML;
import pt.ist.fenixframework.pstm.dml.FenixDomainModel;
import pt.ist.fenixframework.pstm.dml.FenixDomainModelWithOCC;
import pt.ist.fenixframework.DomainModelParser;
import pt.ist.fenixframework.dml.DomainClass;
import pt.ist.fenixframework.dml.DomainModel;
import pt.ist.fenixframework.dml.Slot;
import sun.misc.BASE64Decoder;
import dml.DomainClass;
import dml.Slot;
import fenixDomainBrowser.client.NewFilesPopup.OpenFilesState;
import fenixDomainBrowser.server.graphvizAdapter.Dot;
import fenixDomainBrowser.shared.ClassBean;
Expand Down Expand Up @@ -71,17 +67,18 @@ public DomainModelDefinitions(List<String> data) {

public class LoadedDomainModel {

private FenixDomainModel domainModel;
private DomainModel domainModel;
private DomainModelDefinitions domainModelDefinitions;
private HashMap<String, List<String>> subclasses = new HashMap<String, List<String>>();
private final HashMap<String, List<String>> subclasses = new HashMap<String, List<String>>();

public LoadedDomainModel(DomainModelDefinitions dmd) {
List<URL> domainModelURLs = new ArrayList<URL>();
try {
for (String string : dmd.fileNames) {
domainModelURLs.add(new File(string).toURL());
}
domainModel = DML.getDomainModelForURLs(FenixDomainModelWithOCC.class, domainModelURLs, true);
// domainModel = DML.getDomainModelForURLs(DomainModelWithOCC.class, domainModelURLs, true);
domainModel = DomainModelParser.getDomainModel(domainModelURLs);
} catch (Exception e) {
throw new RuntimeException("error loading DML",e);
}
Expand Down Expand Up @@ -110,7 +107,7 @@ public DomainModelDefinitions getDomainModelDefinitions() {
}
}

private HashMap<DomainModelSignatures, LoadedDomainModel> domainModels = new HashMap<DomainModelSignatures, DomainModelProvider.LoadedDomainModel>();
private final HashMap<DomainModelSignatures, LoadedDomainModel> domainModels = new HashMap<DomainModelSignatures, DomainModelProvider.LoadedDomainModel>();

public DomainModelProvider() {
}
Expand All @@ -134,11 +131,11 @@ public LoadedDomainModel getLoadedDomainModel(FDBState state) {
return domainModels.get(state.getSignature());
}

public FenixDomainModel getDomainModel(DomainModelSignatures signature) {
public DomainModel getDomainModel(DomainModelSignatures signature) {
return getLoadedDomainModel(signature).domainModel;
}

public FenixDomainModel getDomainModel(FDBState signature) {
public DomainModel getDomainModel(FDBState signature) {
return getDomainModel(signature.getSignature());
}

Expand Down Expand Up @@ -193,7 +190,7 @@ public void loadFromDomainModelDomainModelDefinitions(DomainModelDefinitions dmd
fos.close();

ZipFile zipFile = new ZipFile(tempZipFile);
ZipEntry entry = (ZipEntry) zipFile.entries().nextElement();
ZipEntry entry = zipFile.entries().nextElement();

InputStream eis = zipFile.getInputStream(entry);
byte[] buffer = new byte[1024];
Expand Down
Loading