Skip to content

Commit

Permalink
exposing ORYX.EDITOR again for external use
Browse files Browse the repository at this point in the history
  • Loading branch information
Tihomir Surdilovic committed Jan 17, 2011
1 parent b6b18f5 commit 53a9700
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public void configure(HttpServlet servlet) {

@Override
public byte[] load(HttpServletRequest req, String uuid, String ext, String loadExt, String usr, String pwd) {
String inputLine;
String processjson = "";

try {
Expand Down Expand Up @@ -135,16 +134,16 @@ private String doHttpUrlConnectionAction(String desiredUrl) throws Exception {
}
return stringBuilder.toString();
} catch (Exception e) {
_logger.error(e.getMessage(), e);
_logger.error("Unable to connect to Gunvor. Is it running? [" + e.getMessage() + "]");
// don't blow up, we will just show the default process
return "";
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException ioe) {
_logger.error(ioe.getMessage(), ioe);
// don't blow up, we will just show the default process
_logger.error("Unable to read from Gunvor. [" + ioe.getMessage() + "]");
// don't blow up, we will just show the default process
return "";
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ public IUUIDBasedRepository createRepository() {

public IUUIDBasedRepository lookupRepository(String name) {
if(name == null || !factories.containsKey(name)) {
return factories.get("default");
IUUIDBasedRepository repo = factories.get("default");
return repo;
} else {
return factories.get(name);
IUUIDBasedRepository repo = factories.get(name);
return repo;
}
}
};
Expand Down Expand Up @@ -153,25 +155,12 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S

private IDiagramProfile getProfile(HttpServletRequest req, String profileName) {
IDiagramProfile profile = null;
// get the profile, either through the OSGi DS or by using the default one:
if (getClass().getClassLoader() instanceof BundleReference) {
final BundleContext bundleContext = ((BundleReference) getClass().getClassLoader()).getBundle().getBundleContext();
ServiceReference ref = bundleContext.getServiceReference(IDiagramProfileService.class.getName());
if (ref == null) {
throw new IllegalArgumentException(profileName + " is not registered");
}
IDiagramProfileService service = (IDiagramProfileService) bundleContext.getService(ref);
profile = service.findProfile(req, profileName);
} else if ("default".equals(profileName)) {
profile = new DefaultProfileImpl(getServletContext(), false);
} else {
// check w/o BundleReference
IDiagramProfileService service = new ProfileServiceImpl();
service.init(getServletContext());
profile = service.findProfile(req, profileName);
if(profile == null) {
throw new IllegalArgumentException("Cannot determine the profile to use for interpreting models");
}

IDiagramProfileService service = new ProfileServiceImpl();
service.init(getServletContext());
profile = service.findProfile(req, profileName);
if(profile == null) {
throw new IllegalArgumentException("Cannot determine the profile to use for interpreting models");
}
return profile;
}
Expand Down
5 changes: 3 additions & 2 deletions src/main/webapp/js/Core/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -773,7 +773,7 @@ ORYX.Editor = {
* Serializes a call to toJSON().
* @return {String} Returns JSON representation as string.
*/
getSerializedJSON: function(){
getSerializedJSON: function() {
return Ext.encode(this.getJSON());
},

Expand Down Expand Up @@ -1797,7 +1797,7 @@ ORYX.Editor.createByUrl = function(modelUrl, config){
var editorConfig = Ext.decode(transport.responseText);
editorConfig = Ext.applyIf(editorConfig, config);
new ORYX.Editor(editorConfig);

if ("function" == typeof(config.onSuccess)) {
config.onSuccess(transport);
}
Expand Down Expand Up @@ -1998,6 +1998,7 @@ ORYX.Editor.checkClassType = function( classInst, classType ) {
return classInst == classType
}
};

ORYX.Editor.makeExtModalWindowKeysave = function(facade) {
Ext.override(Ext.Window,{
beforeShow : function(){
Expand Down
3 changes: 2 additions & 1 deletion src/main/webapp/js/Plugins/uuidRepository.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,6 @@ window.onOryxResourcesLoaded = function() {
});
}
// finally open the editor:
new ORYX.Editor(editor_parameters);
var editor = new ORYX.Editor(editor_parameters);
ORYX.EDITOR = editor;
};
2 changes: 1 addition & 1 deletion src/main/webapp/profiles/drools.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<profiles>
<profile name="drools" stencilset="bpmn2.0">
<!-- <plugin name="ORYX.Plugins.Toolbar" /> -->
<!-- <plugin name="ORYX.Plugins.Toolbar" /> -->
<plugin name="ORYX.Plugins.UUIDRepositorySave" />
<plugin name="ORYX.Plugins.ShapeMenuPlugin" />
<plugin name="ORYX.Plugins.ShapeRepository" />
Expand Down

0 comments on commit 53a9700

Please sign in to comment.