OW2 Consortium kelly

Compare Revisions

Ignore whitespace Rev 15 → Rev 16

/tags/arelease/dol/src/org/objectweb/dol/util/configuration/JonasProperties.java
New file
0,0 → 1,74
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasProperties.java,v 1.1.1.1 2005-10-21 18:32:24 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.util.configuration;
 
import com.borland.primetime.properties.GlobalProperty;
 
/**
* Keep the jonas properties
*/
public interface JonasProperties
{
public static final GlobalProperty GENIC_VERBOSE = new GlobalProperty("jonas", "genic.verbose", "false");
public static final GlobalProperty GENIC_KEEPGEN = new GlobalProperty("jonas", "genic.keepgenerated", "false");
public static final GlobalProperty GENIC_VMPARAMS = new GlobalProperty("jonas", "genic.vmparams", "");
public static final GlobalProperty GENIC_MAPPERNAMES = new GlobalProperty("jonas", "genic.mappernames", "");
public static final GlobalProperty GENIC_MAPPERNAMES_LIB = new GlobalProperty("jonas", "genic.mappernames.lib", "");
public static final GlobalProperty GENIC_PROTOCOL_IIOP = new GlobalProperty("jonas", "genic.protocol.iiop", "");
public static final GlobalProperty GENIC_PROTOCOL_JRMP = new GlobalProperty("jonas", "genic.protocol.jrmp", "");
public static final GlobalProperty GENIC_PROTOCOL_JEREMIE = new GlobalProperty("jonas", "genic.protocol.jeremie", "");
 
// GENIC OPTIONS
public static final String GENIC_KEEPGEN_OPTION = "-keepgenerated";
public static final String GENIC_VERBOSE_OPTION = "-verbose";
public static final String GENIC_NOADDINJAR_OPTION = "-noaddinjar";
public static final String GENIC_MAPPERNAMES_OPTION = "-mappernames";
public static final String GENIC_PROTOCOL_OPTION = "-protocols";
public static final String GENIC_IIOP_OPTION = "iiop";
public static final String GENIC_JRMP_OPTION = "jrmp";
public static final String GENIC_JEREMIE_OPTION = "jeremie";
public static final String GENIC_CLASSES = "org.objectweb.jonas.server.Bootstrap org.objectweb.jonas_ejb.genic.GenIC";
public static final String PROPERTY_CATEGORY = "jonas";
 
public static final String COMMERCIAL_NAME = "DOL";
public static final String DOL_VERSION = "0.1";
 
public static final String AUTHORS = "Griffin <dxi@mail.ru>";
public static final String SERVER_NAME = "JOnAS (jetty)";
public static final String SERVER_VERSION = "4.3.x";
public static final String JONAS_DEFAULT_HOMEDIR = "c:/jonas/";
public static final String JONAS_CLASS_START = "org.objectweb.jonas.server.Bootstrap org.objectweb.jonas.server.Server";
public static final String JONAS_STOP_CLASSES = "org.objectweb.jonas.server.Bootstrap org.objectweb.jonas.adm.JonasAdmin -s";
public static final String JONAS_CLASS_ADMIN = "org.objectweb.jonas.server.Bootstrap org.objectweb.jonas.adm.JonasAdmin";
public static final String ADMIN_REMOVE_OPTION = "-r ";
public static final String ADMIN_ADD_OPTION = "-a ";
public static final String ADMIN_LIST_OPTION = "-l ";
public static final String ADMIN_GC = "-gc ";
public static final String JSP_CLASS = "org.apache.jasper.runtime.HttpJspBase";
public static final String GENIC_FILE = "GenICTmpJarU";
 
}
/tags/arelease/dol/src/org/objectweb/dol/util/configuration/JonasSettings.java
New file
0,0 → 1,73
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasSettings.java,v 1.1.1.1 2005-10-21 18:32:24 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.util.configuration;
 
import java.util.HashMap;
 
/**
* Stores settings for the server
*/
public class JonasSettings
{
/**
* Map that stores parameter's value
*/
private static HashMap s_JonasConfig;
 
static
{
s_JonasConfig = new HashMap();
}
 
/**
* Private constructor, not to be called
*/
private JonasSettings()
{
}
 
/**
* This function stores a value in the map
* @param p_ParamName Name of the parameter, not null
* @param p_ParamValue Value of the parameter
*/
public static void setValue(String p_ParamName, String p_ParamValue)
{
s_JonasConfig.put(p_ParamName, p_ParamValue);
}
 
/**
* This function the value of a parameter
* @param p_ParamName Name of the parameter
* @return Value of the parameter, could be null
*/
public static String getValue(String p_ParamName)
{
return (String)s_JonasConfig.get(p_ParamName);
}
 
}
/tags/arelease/dol/src/org/objectweb/dol/util/help/Jonas64x64.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:mime-type
+ application/octet-stream
/tags/arelease/dol/src/org/objectweb/dol/util/help/JonasAboutBox.java
New file
0,0 → 1,94
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasAboutBox.java,v 1.1.1.1 2005-10-21 18:32:36 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.util.help;
 
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JOptionPane;
import org.objectweb.dol.util.configuration.JonasProperties;
import com.borland.jbuilder.JBuilderMenu;
import com.borland.primetime.ide.Browser;
import com.borland.primetime.ide.BrowserAction;
 
/**
* Message for the about box in help menu
*/
public class JonasAboutBox
{
public static final Icon ICON = new ImageIcon(org.objectweb.dol.util.help.JonasAboutBox.class.getResource("Jonas64x64.png"));
public static final String MESSAGE_ABOUT_BOX =
"DOL: JOnAS (jetty) Plugin for JBuilder 2005, Version " + JonasProperties.DOL_VERSION + "\n" +
"Based on code of Kelly project\n"+
"Copyright (C) 2005 Griffin\n" +
"\n" +
"This library is free software; you can redistribute it and/or\n" +
"modify it under the terms of the GNU Lesser General Public\n" +
"License as published by the Free Software Foundation; either\n" +
"version 2.1 of the License, or (at your option) any later version.\n" +
"This library is distributed in the hope that it will be useful,\n" +
"but WITHOUT ANY WARRANTY; without even the implied warranty\n" +
"of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See \n" +
"the GNU Lesser General Public License for more details.\n" +
"You should have received a copy of the GNU Lesser General Public\n" +
"License along with this library; if not, write to the Free Software\n" +
"Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n";
 
public JonasAboutBox()
{
 
JBuilderMenu.GROUP_Help4.add(new BrowserAction("JOnAS Server Plugin")
{
public void actionPerformed(Browser browser)
{
JOptionPane.showConfirmDialog(null,
MESSAGE_ABOUT_BOX,
"JOnAS Server Plugin",
JOptionPane.DEFAULT_OPTION,
JOptionPane.INFORMATION_MESSAGE,
ICON);
}
}
);
}
 
/**
* Creates the JonasAboutBox
* @param byte0
* @param byte1
*/
public static void initOpenTool(byte byte0, byte byte1)
{
try
{
new JonasAboutBox();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
/tags/arelease/dol/src/org/objectweb/dol/util/run/JonasRun.java
New file
0,0 → 1,162
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasRun.java,v 1.1.1.1 2005-10-21 18:32:37 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.util.run;
 
import java.io.File;
import org.objectweb.dol.util.configuration.JonasProperties;
import com.borland.jbuilder.node.JBProject;
import com.borland.jbuilder.runtime.RunJavaProcess;
import com.borland.jbuilder.server.EjbService;
import com.borland.jbuilder.server.Server;
import com.borland.primetime.vfs.Url;
import com.borland.primetime.vfs.VFS;
 
/**
* Class that encapsulate the call to startjavaprocess from RunJavaProcess.
* It gets all the parameters needed by the process
*/
public class JonasRun extends RunJavaProcess
{
private JBProject m_JbProject;
 
/**
* Constructor
* @param jbproject
*/
public JonasRun(JBProject jbproject)
{
m_JbProject = jbproject;
}
 
 
/**
* Starts the java process and gets the other parameters
*
* @param p_ClassToRun
* @param jarName
* @return Process
*/
public Process startJavaProcess(String p_ClassToRun, String jarName)
{
m_JbProject.getPaths().putClassOnFullPath(p_ClassToRun);
File launcherPath = getJdkHomePath().getFileObject();
Url url = new Url(launcherPath);
if(!VFS.exists(url.getRelativeUrl("bin")) && VFS.exists(url.getRelativeUrl("jre")))
{
launcherPath = url.getRelativeUrl("jre").getFileObject();
}
String as[] = null;
// Recupere le repertoire temporaire
File workTempDir = getTempUrl().getFileObject();
 
return startJavaProcess(launcherPath, p_ClassToRun, getClassPath(), getJavaParams(), jarName, as, workTempDir);
}
 
/**
* Gets the temp dir
* @return Url pointing to the tempDir
*/
private Url getTempUrl()
{
String tempDir = System.getProperty("java.io.tmpdir") + "genic";
File genicTemp = new File(tempDir);
genicTemp.mkdir();
return new Url(new File(tempDir));
}
 
/**
* Returns the java parameters for genic first and then the server ones
* @return String the parameters
*/
private String getJavaParams()
{
if(JonasProperties.GENIC_VMPARAMS.getValue() != null &&
JonasProperties.GENIC_VMPARAMS.getValue().length() > 0)
{
return JonasProperties.GENIC_VMPARAMS.getValue();
}
else
{
 
EjbService ejbservice = EjbService.getService(m_JbProject);
Server server = ejbservice.getServer();
// return server.getSetupLauncher().getVmParameters();
 
StringBuffer st = new StringBuffer();
st.append("-Dinstall.root=").append(server.getHomeDirectory().getFile());
st.append(" -Djonas.base=").append(server.getHomeDirectory().getFile());
st.append(" -Djava.security.policy=");
st.append(server.getHomeDirectory().getFile()).append("/conf/java.policy");
st.append(" -Djonas.classpath=");
st.append(" -Djava.endorsed.dirs=").append(server.getHomeDirectory().getFile()).append("/lib/endorsed");
st.append(" -Djonas.default.classloader=true");
st.append(" -Djavax.rmi.CORBA.PortableRemoteObjectClass=org.objectweb.carol.rmi.multi.MultiPRODelegate");
st.append(" -Djava.naming.factory.initial=org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
return st.toString();
}
}
 
/**
* Returns the home path of java
* @return Url
*/
private Url getJdkHomePath()
{
return m_JbProject.getPaths().getJDKPathSet().getHomePath();
}
 
/**
* Returns the class path without [ ]
* @return String the classpath
*/
private String getClassPath()
{
String temp = null;
int indexDebut = 0;
int indexFin = 0;
EjbService ejbservice = EjbService.getService(m_JbProject);
Server server = ejbservice.getServer();
Url classPathUrl[] = server.getClassPath();
StringBuffer classPath = new StringBuffer();
for(int i = 0; i < classPathUrl.length; i++)
{
temp = classPathUrl[i].getFile();
indexDebut = temp.indexOf("[");
if(indexDebut != -1)
{
temp = temp.substring(indexDebut + 1);
}
indexFin = temp.indexOf("]");
if(indexFin != -1)
{
temp = temp.substring(0, indexFin);
}
classPath.append(temp).append(File.pathSeparatorChar);
}
return classPath.toString();
}
}
/tags/arelease/dol/src/org/objectweb/dol/web/JonasXmlSupport.java
New file
0,0 → 1,125
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasXmlSupport.java,v 1.1.1.1 2005-10-21 18:32:37 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.web;
/*
import com.borland.jbuilder.runtime.servlet.ContextDescriptor;
import com.borland.jbuilder.web.DeploymentDescriptorSupport;
import com.borland.jbuilder.web.DescriptorReader;
import com.borland.jbuilder.web.DescriptorWriter;
*/
import com.borland.jbuilder.enterprise.ejb.DeploymentDescriptor;
import com.borland.primetime.ide.Context;
import com.borland.primetime.ide.NodeViewer;
 
/**
* JonasXmlSupport class
*/
public class JonasXmlSupport// implements DeploymentDescriptorSupport
{
// private DescriptorWriter jonasDescWriter;
// private DescriptorReader jonasDescReader;
private JonasXmlWriter jonasDescWriter;
private JonasXmlReader jonasDescReader;
 
/*
static JonasXmlDescriptor a(ContextDescriptor contextdescriptor)
{
return (JonasXmlDescriptor)contextdescriptor.getExtensionModel(org.objectweb.kelly.web.JonasXmlSupport.class);
}
*/
 
/**
* Constructor
*/
public JonasXmlSupport()
{
jonasDescReader = new JonasXmlReader();
jonasDescWriter = new JonasXmlWriter();
}
 
/**
* the name of the descriptor file, e.g. web.xml,...
* @return String name of the descriptor
*/
public String getFileName()
{
return "jonas-web.xml";
}
 
/**
* Returns an implementation that will read from an input stream into the
* ContextDescriptor and any associated extension model object.
* @return DescriptorReader
*/
public JonasXmlReader getReader()
{
return jonasDescReader;
}
 
/**
* Returns an implementation that will write the information in the
* ContextDescriptor and any associated extension model object to an output stream
* @return DescriptorWriter
*/
public JonasXmlWriter getWriter()
{
return jonasDescWriter;
}
 
/**
* Returns a GUI Deployment Descriptor editor for the descriptor file,
* or null if no such editor is available.
* @param context
* @return NodeViewer
*/
public NodeViewer getViewer(Context context)
{
return null;
}
 
/**
* Returns a new instance of any type of object to be stored with the
* ContextDescriptor. The object can be retrieved with
* ContextDescriptor.getExtensionModel, with the DeploymentDescriptorSupport
* implementation's class as the argument. Return null if no extension model used.
* @return Object
*/
public Object newModel()
{
return new JonasXmlDescriptor();
}
 
/**
* Returns a deep-copy clone of the given model object, cannot be null
* @param obj
* @return Object cloned model
*/
public Object cloneModel(Object obj)
{
return ((JonasXmlDescriptor)obj).clone();
}
}
/tags/arelease/dol/src/org/objectweb/dol/web/JonasXmlWriter.java
New file
0,0 → 1,141
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasXmlWriter.java,v 1.1.1.1 2005-10-21 18:32:37 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.web;
 
import java.util.Iterator;
import java.util.Map;
import org.w3c.dom.Element;
//import com.borland.jbuilder.runtime.servlet.ContextDescriptor;
//import com.borland.jbuilder.web.AbstractDescriptorWriter;
 
/**
* JonasXmlWriter class
*/
public class JonasXmlWriter //extends AbstractDescriptorWriter
{
protected JonasXmlDescriptor descriptor;
 
public JonasXmlWriter()
{
}
 
protected void parameters(Map map, String s, String s1)
{
/*
// Griffin
if(map.size() > 0)
{
Element element = super.doc.createElement(s);
super.root.appendChild(element);
Element element1;
java.util.Map.Entry entry;
for(Iterator iterator = map.entrySet().iterator(); iterator.hasNext();
element1.appendChild(textElement("param-value", (String) entry.getValue())))
{
element1 = super.doc.createElement(s1);
element.appendChild(element1);
entry = (java.util.Map.Entry) iterator.next();
element1.appendChild(textElement("param-name", (String) entry.getKey()));
}
}
*/
}
 
protected void references(Map map, String s, String s1, String s2)
{
/*
org.w3c.dom.Element element;
java.util.Map.Entry entry;
for(Iterator iterator = map.entrySet().iterator(); iterator.hasNext(); element.appendChild(textElement(s2, (String)entry.getValue())))
{
element = super.doc.createElement(s);
super.root.appendChild(element);
entry = (java.util.Map.Entry)iterator.next();
element.appendChild(textElement(s1, (String)entry.getKey()));
}
*/
}
 
protected void references()
{
references(descriptor.getResources(), "jonas-resource-env", "resource-env-ref-name", "jndi-name");
references(descriptor.getEjbReferences(), "jonas-ejb-ref", "ejb-ref-name", "jndi-name");
}
 
/* protected void references(Element element, Map map, String s, String s1, String s2)
{
Element element1;
java.util.Map.Entry entry;
for(Iterator iterator = map.entrySet().iterator(); iterator.hasNext();
element1.appendChild(textElement(s2, (String) entry.getValue())))
{
element1 = super.doc.createElement(s);
element.appendChild(element1);
entry = (java.util.Map.Entry) iterator.next();
element1.appendChild(textElement(s1, (String) entry.getKey()));
}
}
 
protected void references()
{
if(descriptor.getResources().size() > 0 || descriptor.getEjbReferences().size() > 0)
{
Element element = super.doc.createElement("jonas-resource");
super.root.appendChild(element);
references(element, descriptor.getResources(), "resource-description", "res-ref-name",
"jndi-name");
references(element, descriptor.getEjbReferences(), "jonas-ejb-ref",
"ejb-ref-name", "jndi-name");
}
}
*/
protected void all()
{
references();
}
 
protected String getRootElementTag()
{
return "jonas-web-app";
}
 
protected String getSystemId()
{
return "http://www.objectweb.org/jonas/dtds/jonas-web-app_3_1.dtd";
}
 
protected String getPublicId()
{
return "-//ObjectWeb//DTD JOnAS Web App 3.1//EN";
}
/*
protected void fetchDescriptor(ContextDescriptor contextdescriptor)
{
descriptor = JonasXmlSupport.a(contextdescriptor);
}
*/
}
/tags/arelease/dol/src/org/objectweb/dol/web/JonasXmlDescriptor.java
New file
0,0 → 1,83
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasXmlDescriptor.java,v 1.1.1.1 2005-10-21 18:32:37 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.web;
 
import java.util.HashMap;
import java.util.Map;
 
/**
* JonasXmlDescriptor class
*/
public class JonasXmlDescriptor implements Cloneable
{
private Map m_EjbReferences;
private Map m_Ressources;
 
public JonasXmlDescriptor()
{
m_Ressources = new HashMap();
m_EjbReferences = new HashMap();
}
 
public Object clone()
{
Object obj;
try
{
JonasXmlDescriptor jonasDescriptor = (JonasXmlDescriptor)super.clone();
jonasDescriptor.m_EjbReferences = new HashMap(m_EjbReferences);
jonasDescriptor.m_Ressources = new HashMap(m_Ressources);
JonasXmlDescriptor jonasDescriptor1 = jonasDescriptor;
return jonasDescriptor1;
}
catch(CloneNotSupportedException clonenotsupportedexception)
{
obj = null;
}
return obj;
}
 
public Map getEjbReferences()
{
return m_EjbReferences;
}
 
public void setEjbReferences(Map p_EjbRef)
{
m_EjbReferences = p_EjbRef;
}
 
public Map getResources()
{
return m_Ressources;
}
 
public void setResources(Map p_Ressources)
{
m_Ressources = p_Ressources;
}
}
/tags/arelease/dol/src/org/objectweb/dol/web/JonasXmlReader.java
New file
0,0 → 1,123
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasXmlReader.java,v 1.1.1.1 2005-10-21 18:32:37 griffin Exp $
* --------------------------------------------------------------------------
*/
//Griffin. Stubs on methods
package org.objectweb.dol.web;
 
import java.util.Map;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
//import com.borland.jbuilder.runtime.servlet.ContextDescriptor;
//import com.borland.jbuilder.web.AbstractDescriptorReader;
 
/**
* JonasXmlReader class
*/
public class JonasXmlReader //extends AbstractDescriptorReader
{
protected JonasXmlDescriptor descriptor;
 
public JonasXmlReader()
{
}
 
protected void parameters(Map map, String s, String s1)
{
/*
NodeList nodelist = super.root.getElementsByTagName(s);
if(nodelist.getLength() > 0)
{
Element element = (Element) nodelist.item(0);
references(element, map, s1, "param-name", "param-value");
}
else
{
map.clear();
}
*/
}
 
protected void references(Element element, Map map, String s, String s1, String s2)
{
/*
map.clear();
NodeList nodelist = element.getElementsByTagName(s);
for(int i = 0; i < nodelist.getLength(); i++)
{
Element element1 = (Element) nodelist.item(i);
map.put(getTextChild(element1, s1), getTextChild(element1, s2));
}
*/
}
 
protected void references(Map map, String s, String s1, String s2)
{
/*
map.clear();
NodeList nodelist = super.root.getElementsByTagName(s);
for(int i = 0; i < nodelist.getLength(); i++)
{
Element element = (Element) nodelist.item(i);
map.put(getTextChild(element, s1), getTextChild(element, s2));
}
*/
}
 
 
protected void references()
{
/*NodeList nodelist = super.root.getElementsByTagName("jonas-resource");
if(nodelist.getLength() > 0)
{
Element element = (Element) nodelist.item(0);
references(element, descriptor.getResources(), "jonas-resource-env", "resource-env-ref-name", "jndi-name");
references(element, descriptor.getEjbReferences(), "jonas-ejb-ref", "ejb-ref-name", "jndi-name");
references(element, descriptor.getEjbReferences(), "jonas-resource", "res-ref-name", "jndi-name");*/
 
references(descriptor.getResources(), "jonas-resource-env", "resource-env-ref-name", "jndi-name");
references(descriptor.getEjbReferences(), "jonas-ejb-ref", "ejb-ref-name", "jndi-name");
//references(descriptor.getEjbReferences(), "jonas-resource", "res-ref-name", "jndi-name");
 
/*}
else
{
descriptor.getResources().clear();
descriptor.getEjbReferences().clear();
}*/
}
 
protected void all()
{
references();
}
 
/*
protected void fetchDescriptor(ContextDescriptor contextdescriptor)
{
descriptor = JonasXmlSupport.a(contextdescriptor);
}
*/
 
}
/tags/arelease/dol/src/org/objectweb/dol/ejb/EjbProperties.java
New file
0,0 → 1,121
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: EjbProperties.java,v 1.1.1.1 2005-10-21 18:31:51 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.ejb;
 
import java.util.Collection;
import java.util.Iterator;
import com.borland.enterprise.xml.api.IEntityBean;
import com.borland.enterprise.xml.api.IProperty;
 
public class EjbProperties
{
/**
* Constructor
*/
public EjbProperties()
{
}
 
/**
* Returns the value of a property or null if not found
* @param p_IEntityBean
* @param p_Prop the name of the property
* @return String the value of the prop
*/
public static String getPropertyValue(IEntityBean p_IEntityBean, String p_Prop)
{
IProperty iproperty = findProperty(p_IEntityBean, p_Prop);
String value = null;
if (iproperty != null)
{
value = iproperty.getPropValue();
}
return value;
}
 
/**
* Sets a property (name, value)
* @param p_IEntityBean
* @param p_PropName
* @param p_PropValue
*/
public static void setPropertyValue(IEntityBean p_IEntityBean, String p_PropName, String p_PropValue)
{
IProperty iproperty = findProperty(p_IEntityBean, p_PropName);
if (iproperty != null)
{
if (p_PropValue == null || p_PropValue.length() == 0)
{
p_IEntityBean.removeProperty(iproperty);
}
else
{
iproperty.setPropValue(p_PropValue);
}
}
else
if (p_PropValue != null && p_PropValue.length() > 0)
{
IProperty iproperty1 = p_IEntityBean.addProperty();
iproperty1.setPropName(p_PropName);
iproperty1.setPropValue(p_PropValue);
iproperty1.setPropType("String");
}
}
 
/**
* Retrieves the property in the entity porperties
* @param p_IEntityBean
* @param p_PropName
* @return IProperty the property if found otherwise null
*/
public static IProperty findProperty(IEntityBean p_IEntityBean, String p_PropName)
{
 
Collection collection = p_IEntityBean.getPropertyList();
IProperty iproperty = null;
boolean foundProp = false;
if (collection != null)
{
Iterator iterator = collection.iterator();
while (iterator != null && iterator.hasNext() && foundProp == false)
{
iproperty = (IProperty) iterator.next();
if (iproperty.getPropName().equals(p_PropName) &&
iproperty.getPropType().equalsIgnoreCase("String"))
{
foundProp = true;
}
}
}
if (foundProp == false)
{
iproperty = null;
}
return iproperty;
}
}
/tags/arelease/dol/src/org/objectweb/dol/ejb/JonasDescriptorConversion.java
New file
0,0 → 1,911
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasDescriptorConversion.java,v 1.1.1.1 2005-10-21 18:32:06 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.ejb;
 
//import com.borland.jbuilder.enterprise.ejb.EjbPropertyElement;
//import com.borland.jbuilder.enterprise.ejb.EjbReference;
import java.io.*;
import java.text.*;
import java.util.*;
 
import com.borland.enterprise.xml.api.*;
import com.borland.enterprise.xml.api.enum.*;
import com.borland.jbuilder.build.*;
import com.borland.jbuilder.enterprise.descriptor.ejb.wrapper.*;
import com.borland.jbuilder.enterprise.ejb.*;
import com.borland.jbuilder.enterprise.module.ejb.*;
import com.borland.primetime.ide.*;
import com.borland.primetime.util.*;
import com.borland.jbuilder.node.JBProject;
import com.borland.primetime.vfs.Url;
import com.borland.jbuilder.jot.JotMethod;
import com.borland.jbuilder.jot.JotClass;
import com.borland.jbuilder.enterprise.descriptor.common.wrapper.ResourceEnvRefWrapper;
import com.borland.jbuilder.enterprise.descriptor.common.wrapper.EjbRefWrapper;
import com.borland.jbuilder.enterprise.descriptor.common.wrapper.ResourceRefWrapper;
import com.borland.primetime.xmt.model.impl.XmtDefaultNode;
 
//import com.borland.jbuilder.enterprise.ejb.EjbPropertyElement;
 
/**
* Class that generates the jonas-ejb-jar.xml
*/
//Griffin
public class JonasDescriptorConversion { //extends AbstractDescriptorConversion
public static final String AUTOMATIC_PK = "automatic-pk";
public static final String PASSIVATION_TIMEOUT = "passivation-timeout";
public static final String MAX_CACHE_SIZE = "max-cache-size";
public static final String MIN_POOL_SIZE = "min-pool-size";
public static final String CLEANUP = "cleanup";
public static final String SHARED = "shared";
 
public static final String CLEANUP_NONE = "none";
public static final String CLEANUP_CREATE = "create";
public static final String CLEANUP_REMOVEDATA = "removedata";
public static final String CLEANUP_REMOVEALL = "removeall";
 
private EjbModuleNode ejbmodulenode;
private BuildReport fbuildreport;
 
// Optional parameters for the DD Tab
private static String optionalParams[][] = {
{
SHARED, "true", "false"}, {
AUTOMATIC_PK, "true", "false"}, {
CLEANUP, CLEANUP_NONE, CLEANUP_CREATE, CLEANUP_REMOVEDATA,
CLEANUP_REMOVEALL}, {
MIN_POOL_SIZE}, {
MAX_CACHE_SIZE}, {
PASSIVATION_TIMEOUT}
};
 
/**
* Constructor
*
* @param adeploymentdescriptor Deployment descriptors from a EJB Module file.
* @param ejbgrpfilenode The EJB Module where the dds parameter was obtained.
* @param buildreport Where to post warning or error messages, or null.
*/
//Griffin.
/*
public JonasAbstractDescriptorConversion(DeploymentDescriptor adeploymentdescriptor[],
EJBGRPFileNode ejbgrpfilenode,
BuildReport buildreport)
*/
public JonasDescriptorConversion( //DeploymentDescriptor adeploymentdescriptor[],
EjbModuleNode ejbfilenode,
BuildReport buildreport)
 
{
// super(adeploymentdescriptor, ejbgrpfilenode, buildreport);
ejbmodulenode = ejbfilenode;
fbuildreport = buildreport;
}
 
/**
* Fetch any properties which are to be surfaced by a vendor-specific EJB
* Property viewer. By default this routine returns null. If the input
* EjbReference is null, then this routine must return a value which is not
* null (an empty array is sufficient) if it wants the EJB property viewer
* to become visible. Once the viewer is activated, it will then call this
* method as needed based on which EJB in the EJB Module is selected.
*
* @param ejbreference Reference for a particular EJB, may be null
*
* @return EjbPropertyElement[] if want the EJB Properties viewer, null if not.
*/
/*
public static EjbPropertyElement[] getPropertyNamesToSurface(EjbReference ejbreference)
{
if (ejbreference == null)
{
return new EjbPropertyElement[0];
}
ArrayList arraylist = new ArrayList();
for (int k = 0; k < optionalParams.length; k++)
{
arraylist.add(new EjbPropertyElement(optionalParams[k]));
}
return (EjbPropertyElement[])arraylist.toArray(new EjbPropertyElement[arraylist.size()]);
}
*/
/**
* Creates the iEjbJar class variable from the Borland deployment descriptors
* provided when this class was constructed.
*
* @param flag True if want build error message output and specified a
* BuildReport object in the constructor.
*
* @return True if successful.
*/
/*
protected boolean createInterfaceFromDescriptors(boolean flag)
{
return super.createInterfaceFromDescriptors(flag);
}
*/
/**
* Verify the deployment descriptors and append any warning/error messages to
* the given MessageView using the given category. Do not modify the EJB Module.
*
* @param mv MessageView to use for any warnings/errors.
* @param mc MessageCategory of mv to use.
*
* @throws java.lang.Exception Fatal error conversion error encountered.
*/
public void verifyDeploymentDescriptors(MessageView messageview,
MessageCategory messagecategory) throws
java.lang.Exception {
int i = 0;
int j = 0;
DateFormat dateformat = DateFormat.getDateTimeInstance(2, 1);
try {
messageview.clearMessages(messagecategory);
String s = dateformat.format(new Date());
//Griffin
// convert(false, true, false);
// super.report.getTotalMessageCount();
// BuildMessage abuildmessage[] = super.report.getAllMessages();
BuildMessage abuildmessage[] = null;
if (abuildmessage != null) {
for (int k = 0; k < abuildmessage.length; k++) {
if (abuildmessage[k].isError()) {
messageview.addMessage(messagecategory,
"Error" + abuildmessage[k].getMessage());
}
if (abuildmessage[k].getType() == BuildMessage.BUILD_WARNING) {
messageview.addMessage(messagecategory,
"Warning : " + abuildmessage[k].getMessage());
}
}
}
}
catch (Exception exception) {
throw new AssertionException(exception.getMessage());
}
}
 
/**
* This routine is called from outer place to initiate the generation of the
* descriptors from information in class variables. It creates zero or more
* entries in ejb-jar.xml.
*
* @throws java.lang.Exception Fatal error conversion error encountered.
*/
public void generate() throws java.lang.Exception {
XMLNode nodeEntity = null;
Collection collection = null;
Collection collection1 = null;
XMLNode nodeEjbJar = null;
Iterator iterator = null;
IEnterpriseBean ienterprisebean = null;
// IEntityBean ientitybean = null;
EntityBeanWrapper ientitybean1 = null;
// IEnterpriseBean ienterprisebean1 = null;
SessionBeanWrapper isessionbean1 = null;
MessageDrivenBeanWrapper imessagedrivenbean1 = null;
XMLNode xmlnodeMDB = null;
CommonEjbWrapper commonEjbWrapper = null;
 
try {
collection = ejbmodulenode.getEjbJarWrapper().
getAllEnterpriseBeanNodeWrappers();
 
// collection = super.iEjbJar.getEjbList();
 
// Root Node of the jonas descriptor
nodeEjbJar = new XMLNode(null, "jonas-ejb-jar");
 
int l = 0;
if (collection != null) {
 
/*
iterator = collection.iterator();
do
{
if(!iterator.hasNext())
{
break;
}
addErrorMessage(" - there");
commonEjbWrapper = (CommonEjbWrapper) iterator.next();
addErrorMessage(" - commonaccEjbWrapper = (CommonAccessibleEjbWrapper) iterator.next();");
if(ienterprisebean instanceof IEntityBean)
{
ientitybean = (IEntityBean) ienterprisebean;
if(ientitybean.getPersistenceTypeEnum() == EnumPersistenceType.CONTAINER &&
!ientitybean.getCmpFieldList().isEmpty())
{
l++;
}
}
}
while(true);
*/
iterator = collection.iterator();
do {
if (!iterator.hasNext()) {
break;
}
// ienterprisebean1 = (IEnterpriseBean) iterator.next();
commonEjbWrapper = (CommonEjbWrapper) iterator.next();
 
// if EJB SESSION
if (commonEjbWrapper instanceof SessionBeanWrapper) {
isessionbean1 = (SessionBeanWrapper) commonEjbWrapper;
XMLNode xmlnodeSession = new XMLNode(nodeEjbJar, "jonas-session");
 
// ejb-name
new XMLNode(xmlnodeSession, "ejb-name",
isessionbean1.getName("error"));
// jndi-name
String jndiName = extrname(isessionbean1.getHome(null));
if (jndiName != null && jndiName.length() > 0) {
new XMLNode(xmlnodeSession, "jndi-name", jndiName);
}
 
// Ajout des elements communs à tous les EJB
generateResourceDescriptor(commonEjbWrapper, xmlnodeSession);
generateResourceEnvDescriptor(commonEjbWrapper, xmlnodeSession);
generateEjbRefDescriptor(commonEjbWrapper, xmlnodeSession);
 
/* //Griffin - I' don't know, where JBuilder store session timeout :(
// Ajout de session timeout
String sessionTimeOut = isessionbean1.getTimeout();
if(sessionTimeOut != null && sessionTimeOut.length() > 0)
{
new XMLNode(xmlnodeSession, "session-timeout", sessionTimeOut);
}
*/
}
 
// if MESSAGE DRIVEN BEAN
else if (commonEjbWrapper instanceof MessageDrivenBeanWrapper) {
imessagedrivenbean1 = (MessageDrivenBeanWrapper) commonEjbWrapper;
xmlnodeMDB = new XMLNode(nodeEjbJar, "jonas-message-driven");
 
// ejb-name
new XMLNode(xmlnodeMDB, "ejb-name",
imessagedrivenbean1.getName("error"));
addErrorMessage(" - " + imessagedrivenbean1.getEjbClass("error"));
// jonas-message-driven-destination
XMLNode xmlNodeDestination = new XMLNode(xmlnodeMDB,
"jonas-message-driven-destination");
String destinationName = imessagedrivenbean1.
getMessageDestinationType("error");
if (destinationName != null && destinationName.length() > 0) {
new XMLNode(xmlNodeDestination, "jndi-name", destinationName);
}
else {
new XMLNode(xmlNodeDestination, "jndi-name");
 
this.addErrorMessage(imessagedrivenbean1.getEjbClass("error") +
" : Element jndi-name of jonas-message-driven-destination must be valued");
 
}
 
// for all ejb
generateResourceDescriptor(commonEjbWrapper, xmlnodeMDB);
generateResourceEnvDescriptor(commonEjbWrapper, xmlnodeMDB);
generateEjbRefDescriptor(commonEjbWrapper, xmlnodeMDB);
}
 
// if EJB ENTITY
else if (commonEjbWrapper instanceof EntityBeanWrapper) {
ientitybean1 = (EntityBeanWrapper) commonEjbWrapper;
 
nodeEntity = new XMLNode(nodeEjbJar, "jonas-entity");
 
new XMLNode(nodeEntity, "ejb-name", ientitybean1.getName("error"));
 
String jndiName = extrname(ientitybean1.getHome("error"));
jndiName = extrname(ientitybean1.getLocalHome("error"));
if (jndiName != null && jndiName.length() > 0) {
new XMLNode(nodeEntity, "jndi-name", jndiName);
}
 
// for all ejb
generateResourceDescriptor(commonEjbWrapper, nodeEntity);
generateResourceEnvDescriptor(commonEjbWrapper, nodeEntity);
generateEjbRefDescriptor(commonEjbWrapper, nodeEntity);
 
// if EJB ENTITY BMP
if (!ientitybean1.isCMPPersistence()) {
if (isModifiedPresent(ientitybean1)) {
new XMLNode(nodeEntity, "is-modified-method-name", "isModified");
}
// Generate JOnAS optional params if valued
generateOptionalJonasParams(ientitybean1, nodeEntity);
}
// if EJB ENTITY CMP
else if (ientitybean1.isCMPPersistence()) {
collection1 = ientitybean1.getCmpFieldNodes();
if (collection1 != null && !collection1.isEmpty()) {
// Ajout is-modified-method-name
if (isModifiedPresent(ientitybean1)) {
new XMLNode(nodeEntity, "is-modified-method-name",
"isModified");
}
 
// Generate JOnAS optional params if valued
generateOptionalJonasParams(ientitybean1, nodeEntity);
 
// jdbc-mapping
generateJdbcMappingDescriptor(ientitybean1, nodeEntity);
}
}
}
}
while (true);
}
String s = getEjbJarDocType();
DeploymentDescriptor deploymentdescriptor = toDescriptor(nodeEjbJar, s,
"jonas-ejb-jar.xml");
// ddList.add(deploymentdescriptor);
}
catch (Exception e) {
e.printStackTrace();
throw e;
}
}
 
private String extrname(String inname) {
int i = inname.indexOf(".");
return inname.substring(i + 1, inname.length());
}
 
/**
* Generates the descriptors for jonas-resource
* @param ienterprisebean
* @param xmlnode
* @throws Exception
*/
protected void generateResourceDescriptor(CommonEjbWrapper ienterprisebean,
XMLNode xmlnode) throws
Exception {
XmtDefaultNode xmtdefnode=null;
ResourceRefWrapper iresourceref=null;
 
Collection collection = ienterprisebean.getResourceRefNodes();
if(collection != null && !collection.isEmpty())
{
for(Iterator iterator = collection.iterator(); iterator.hasNext(); )
{
// iresourceref = (ResourceRefWrapper) iterator.next();
xmtdefnode = (XmtDefaultNode) iterator.next();
iresourceref = new ResourceRefWrapper(xmtdefnode);
 
XMLNode xmlnode1 = new XMLNode(xmlnode, "jonas-resource");
 
if(iresourceref.getName(null) != null && iresourceref.getName(null).length() > 0)
{
new XMLNode(xmlnode1, "res-ref-name", iresourceref.getName(null));
}
else
{
new XMLNode(xmlnode1, "res-ref-name", "");
 
this.addErrorMessage(ienterprisebean.getName(null) +
" : Element res-ref-name of jonas-resource must be valued");
 
}
 
if(iresourceref.getJndiName(null) != null && iresourceref.getJndiName(null).length() > 0)
{
new XMLNode(xmlnode1, "jndi-name", extrname(iresourceref.getJndiName(null)));
}
else
{
new XMLNode(xmlnode1, "jndi-name", "");
 
this.addErrorMessage(ienterprisebean.getName(null) +
" : Element jndi-name of jonas-resource must be valued");
 
}
}
}
 
}
 
/**
* Generates the descriptors for jonas-resource-env
* @param ienterprisebean
* @param xmlnode
* @throws Exception
*/
protected void generateResourceEnvDescriptor(CommonEjbWrapper ienterprisebean,
XMLNode xmlnode) throws
Exception {
 
XMLNode xmlnode1 = null;
XmtDefaultNode xmtdefnode=null;
ResourceEnvRefWrapper iresourceenvref;
Collection collection = ienterprisebean.getResourceEnvRefNodes();
if(collection != null && !collection.isEmpty())
{
for(Iterator iterator = collection.iterator(); iterator.hasNext(); )
{
// iresourceenvref = (ResourceEnvRefWrapper) iterator.next();
xmtdefnode = (XmtDefaultNode) iterator.next();
iresourceenvref = new ResourceEnvRefWrapper(xmtdefnode);
xmlnode1 = new XMLNode(xmlnode, "jonas-resource-env");
 
if(iresourceenvref.getName(null) != null && iresourceenvref.getName(null).length() > 0)
{
new XMLNode(xmlnode1, "resource-env-ref-name", iresourceenvref.getName(null));
}
else
{
new XMLNode(xmlnode1, "resource-env-ref-name", "");
 
this.addErrorMessage(ienterprisebean.getName("error") +
" : Element resource-env-ref-name of jonas-resource-env must be valued");
 
}
 
if(iresourceenvref.getJndiName(null) != null && iresourceenvref.getJndiName(null).length() > 0)
{
new XMLNode(xmlnode1, "jndi-name", extrname(iresourceenvref.getJndiName(null)));
}
else
{
new XMLNode(xmlnode1, "jndi-name", "");
 
this.addErrorMessage(ienterprisebean.getName("error") +
" : Element jndi-name of jonas-resource-env must be valued");
 
}
 
}
}
}
 
/**
* Generates the descriptors for jonas-ejb-ref
* @param ienterprisebean
* @param xmlnode
* @throws Exception
*/
protected void generateEjbRefDescriptor(CommonEjbWrapper ienterprisebean,
XMLNode xmlnode) throws Exception
{
 
EjbRefWrapper iEjbRef;
XmtDefaultNode xmtdefnode=null;
XMLNode xmlnode1 = null;
Collection collection = ienterprisebean.getEjbRefNodes();
if(collection != null && !collection.isEmpty())
{
for(Iterator iterator = collection.iterator(); iterator.hasNext(); )
{
// iEjbRef = (EjbRefWrapper) iterator.next();
xmtdefnode = (XmtDefaultNode) iterator.next();
iEjbRef = new EjbRefWrapper(xmtdefnode);
xmlnode1 = new XMLNode(xmlnode, "jonas-ejb-ref");
if(iEjbRef.getName(null) != null && iEjbRef.getName(null).length() > 0)
{
new XMLNode(xmlnode1, "ejb-ref-name", iEjbRef.getName(null));
}
else
{
new XMLNode(xmlnode1, "ejb-ref-name", "");
 
this.addErrorMessage(ienterprisebean.getName("error") +
" : Element ejb-ref-name of jonas-ejb-ref must be valued");
}
 
//Griffin - I think, there must be .getHome(null)
/*
if(iEjbRef.getJndiName(null) != null && iEjbRef.getJndiName(null).length() > 0)
{
new XMLNode(xmlnode1, "jndi-name", iEjbRef.getJndiName(null));
}
else
{
new XMLNode(xmlnode1, "jndi-name", "");
 
this.addErrorMessage(ienterprisebean.getName("error") +
" : Element jndi-name of jonas-ejb-ref must be valued");
}
*/
 
if(iEjbRef.getHome(null) != null && iEjbRef.getHome(null).length() > 0)
{
new XMLNode(xmlnode1, "jndi-name", extrname(iEjbRef.getHome(null)));
}
else
{
new XMLNode(xmlnode1, "jndi-name", "");
 
this.addErrorMessage(ienterprisebean.getName("error") +
" : Element jndi-name of jonas-ejb-ref must be valued");
}
 
 
}
}
}
 
/**
* Generates the descriptors for jdbc-mapping, making differences between
* CMP 1 and 2
* @param ienterprisebean
* @param xmlnode
* @throws Exception
*/
protected void generateJdbcMappingDescriptor(EntityBeanWrapper ientitybean,
XMLNode xmlnode) throws
Exception {
 
Collection collection = ientitybean.getCmpFieldNodes();
Collection col = null;
XMLNode nodeJdbcMapping = null;
XMLNode nodeCmpField = null;
XMLNode nodeFinderMethod = null;
XMLNode nodeJonasMethod = null;
XMLNode nodeMethodParams = null;
ICmpField icmpfield = null;
IFinder ifinder = null;
String signatureMethod = null;
String nomParam = null;
StringTokenizer stringtokenizer = null;
String nomMethode = null;
int j1 = 0;
int index = 0;
int k1 = 0;
boolean methodParams = true;
 
if (collection != null && !collection.isEmpty()) {
nodeJdbcMapping = new XMLNode(xmlnode, "jdbc-mapping");
//Griffin
if (ientitybean.getDatasourceName() != null &&
ientitybean.getDatasourceName().length() > 0)
// if(super.getBeanDataSourceName(ientitybean) != null && super.getBeanDataSourceName(ientitybean).length() > 0)
{
new XMLNode(nodeJdbcMapping, "jndi-name", ientitybean.getDatasourceName());
}
else {
new XMLNode(nodeJdbcMapping, "jndi-name", "jdbc_1");
this.addWarningMessage(ientitybean.getName(null) +
" : Element jndi-name of jdbc-mapping must be valued, affecting default value jdbc_1");
}
 
// Automatic-pk only for CMP2
//Griffin
// IEntityBean ientbn= new ;
 
// String temp = EjbProperties.getPropertyValue(ientitybean, AUTOMATIC_PK);
 
String temp = "false";
if (temp != null && temp.equals("true")) {
new XMLNode(nodeJdbcMapping, AUTOMATIC_PK, temp);
}
else if (temp != null && temp.equals("false")) {
new XMLNode(nodeJdbcMapping, AUTOMATIC_PK, temp);
}
else if (temp != null && temp.length() > 0) {
 
this.addErrorMessage(ientitybean.getName(null) +
" : The automatic-pk value is incorrect");
}
 
// CMP 1.x attributes
if (ientitybean.isCMP11()) {
if (ientitybean.getTableName(null) != null &&
ientitybean.getTableName(null).length() > 0) {
new XMLNode(nodeJdbcMapping, "jdbc-table-name",
ientitybean.getTableName(null));
}
else {
 
this.addErrorMessage(ientitybean.getName(null) +
" : Element jdbc-table-name of jdbc-mapping must be valued");
}
 
for (Iterator iterator = collection.iterator(); iterator.hasNext(); ) {
icmpfield = (ICmpField) iterator.next();
nodeCmpField = new XMLNode(nodeJdbcMapping, "cmp-field-jdbc-mapping");
 
if (icmpfield.getFieldName() != null &&
icmpfield.getFieldName().length() > 0) {
new XMLNode(nodeCmpField, "field-name", icmpfield.getFieldName());
}
else {
 
this.addErrorMessage(ientitybean.getName(null) +
" : Element field-name of cmp-field-jdbc-mapping must be valued");
}
 
if (icmpfield.getColumnName() != null &&
icmpfield.getColumnName().length() > 0) {
new XMLNode(nodeCmpField, "jdbc-field-name",
icmpfield.getColumnName());
}
else {
 
this.addErrorMessage(ientitybean.getName(null) +
" : Element jdbc-field-name of cmp-field-jdbc-mapping must be valued");
}
}
col = ientitybean.getFinders();
if (col != null && !col.isEmpty()) {
for (Iterator iterator = col.iterator(); iterator.hasNext(); ) {
ifinder = (IFinder) iterator.next();
nodeFinderMethod = new XMLNode(nodeJdbcMapping,
"finder-method-jdbc-mapping");
nodeJonasMethod = new XMLNode(nodeFinderMethod, "jonas-method");
 
if (ifinder.getWhereClause() != null &&
ifinder.getWhereClause().length() > 0) {
new XMLNode(nodeFinderMethod, "jdbc-where-clause",
ifinder.getWhereClause());
}
else {
 
this.addErrorMessage(ientitybean.getName(null) +
" : Element jdbc-where-clause of finder-method-jdbc-mapping must be valued");
}
 
// Parser la chaine pour recuperer le nom de la methode et ses params
signatureMethod = ifinder.getMethodSignature();
if (signatureMethod != null && signatureMethod.length() > 0) {
j1 = signatureMethod.indexOf('(');
if (j1 != -1 && signatureMethod.length() > j1 + 1) {
nomMethode = signatureMethod.substring(0, j1).trim();
index = nomMethode.lastIndexOf(" ");
nomMethode = nomMethode.substring(index, nomMethode.length());
new XMLNode(nodeJonasMethod, "method-name", nomMethode);
for (stringtokenizer = new StringTokenizer(signatureMethod.
substring(j1 + 1),
",)"); stringtokenizer.hasMoreTokens(); ) {
if (methodParams == true) {
nodeMethodParams = new XMLNode(nodeJonasMethod,
"method-params");
methodParams = false;
}
nomParam = stringtokenizer.nextToken().trim();
k1 = nomParam.indexOf(' ');
if (k1 != -1) {
nomParam = nomParam.substring(0, k1);
if (nomParam.length() > 0) {
nomParam = Class.forName(nomParam).getName();
new XMLNode(nodeMethodParams, "method-param", nomParam);
}
}
}
}
}
else {
new XMLNode(nodeJonasMethod, "method-name", "");
nodeMethodParams = new XMLNode(nodeJonasMethod, "method-params");
new XMLNode(nodeMethodParams, "method-param", "");
 
this.addErrorMessage(ientitybean.getName(null) +
" : Problem while finding method-name and method-params (no method signature found)");
}
}
}
}
}
 
}
 
/**
* addWarningMessage
*
* @param string String
*/
private void addWarningMessage(String string) {
this.addErrorMessage(string);
}
 
/**
* Generate optional parameters for Entity Beans if valued
* @param p_EnterpriseBean an EntityBean
* @param p_Node root node (jonas-entity)
*/
protected void generateOptionalJonasParams(EntityBeanWrapper p_EntityBean,
XMLNode p_Node) {
/*
// PASSIVATION-TIMEOUT
String temp = EjbProperties.getPropertyValue(p_EntityBean, PASSIVATION_TIMEOUT);
if(temp != null && temp.length() > 0)
{
try
{
int i = Integer.parseInt(temp);
new XMLNode(p_Node, PASSIVATION_TIMEOUT, temp);
}
catch(NumberFormatException nbf)
{
 
this.addErrorMessage(p_EntityBean.getEjbName() +
" : The passivation-timeout value is incorrect");
 
}
}
 
// SHARED
temp = null;
temp = EjbProperties.getPropertyValue(p_EntityBean, SHARED);
if(temp != null && temp.equals("true"))
{
new XMLNode(p_Node, SHARED, temp);
}
else if(temp != null && temp.equals("false"))
{
new XMLNode(p_Node, SHARED, temp);
}
else if(temp != null && temp.length() > 0)
{
this.addErrorMessage(p_EntityBean.getEjbName() +
" : The shared value is incorrect");
}
 
// MAX CACHE SIZE
temp = null;
temp = EjbProperties.getPropertyValue(p_EntityBean, MAX_CACHE_SIZE);
if(temp != null && temp.length() > 0)
{
try
{
int i = Integer.parseInt(temp);
new XMLNode(p_Node, MAX_CACHE_SIZE, temp);
}
catch(NumberFormatException nbf)
{
this.addErrorMessage(p_EntityBean.getEjbName() +
" : The max-cache-size value is incorrect");
}
}
 
// MIN POOL SIZE
temp = null;
temp = EjbProperties.getPropertyValue(p_EntityBean, MIN_POOL_SIZE);
if(temp != null && temp.length() > 0)
{
try
{
int i = Integer.parseInt(temp);
new XMLNode(p_Node, MIN_POOL_SIZE, temp);
}
catch(NumberFormatException nbf)
{
this.addErrorMessage(p_EntityBean.getEjbName() +
" : The min-pool-size value is incorrect");
}
}
 
// CLEANUP
temp = null;
temp = EjbProperties.getPropertyValue(p_EntityBean, CLEANUP);
if(temp != null && temp.equals(CLEANUP_NONE))
{
new XMLNode(p_Node, CLEANUP, temp);
}
else if(temp != null && temp.equals(CLEANUP_CREATE))
{
new XMLNode(p_Node, CLEANUP, temp);
}
else if(temp != null && temp.equals(CLEANUP_REMOVEALL))
{
new XMLNode(p_Node, CLEANUP, temp);
}
else if(temp != null && temp.equals(CLEANUP_REMOVEDATA))
{
new XMLNode(p_Node, CLEANUP, temp);
}
else if(temp != null && temp.length() > 0)
{
this.addErrorMessage(p_EntityBean.getEjbName() +
" : The cleanup value is incorrect");
}
*/
}
 
/**
* Returns true if a modify method exists
* @param ientitybean
* @return
*/
protected boolean isModifiedPresent(EntityBeanWrapper ientitybean) {
try {
JBProject jbproject = (JBProject) ejbmodulenode.getProject();
JotMethod jotmethod = null;
JotClass jotclass = jbproject.getJotPackages().getClass(ientitybean.
getEjbClass("error"), 1);
JotMethod ajotmethod[] = jotclass.getDeclaredMethods("isModified");
for (int l = 0; l < ajotmethod.length; l++) {
jotmethod = ajotmethod[l];
if (jotmethod.getName().equals("isModified") &&
jotmethod.getParameters().length == 0 &&
jotmethod.getReturnType().getName().equals("boolean")) {
boolean flag = true;
return flag;
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}
return false;
}
 
/**
*
* @return
*/
protected String getEjbJarDocType() {
String s = "<!DOCTYPE jonas-ejb-jar PUBLIC \"-//ObjectWeb//DTD JOnAS 3.2//EN\" \"http://www.objectweb.org/jonas/dtds/jonas-ejb-jar_3_2.dtd\">";
return s;
}
 
/**
* Because I don't know, how add DeploymentDescriptor in project, I do this stupid thing :).
*
* @param xmlnode
* @param s
* @param s1
* @return
* @throws Exception
*/
protected DeploymentDescriptor toDescriptor(XMLNode xmlnode, String s,
String s1) throws
Exception {
ByteArrayOutputStream bytearrayoutputstream = new ByteArrayOutputStream();
try {
XMLPrinter xmlprinter = new XMLPrinter(bytearrayoutputstream, "UTF-8");
xmlprinter.println(s);
xmlprinter.print(xmlnode);
 
//Griffin - Because I don't know, how add DeploymentDescriptor in project, I do it.
 
Url jndurl = new Url(ejbmodulenode.getDescriptorsDirectoryUrl() +
"/jonas-ejb-jar.xml");
 
FileWriter filewriter = new FileWriter(jndurl.getFileObject());
filewriter.write(bytearrayoutputstream.toString());
filewriter.flush();
filewriter.close();
}
finally {
bytearrayoutputstream.close();
}
DeploymentDescriptor deploymentdescriptor = new DeploymentDescriptor(s1);
deploymentdescriptor.setBytes(bytearrayoutputstream.toByteArray());
deploymentdescriptor.setTimestamp(System.currentTimeMillis());
 
return deploymentdescriptor;
}
 
protected void addErrorMessage(String errstring) {
fbuildreport.addBuildError(new BuildMessage(errstring, 2));
System.out.println("JOnAS Plugin - JonasDescriptiorConversion - " +
errstring);
}
 
}
/tags/arelease/dol/src/org/objectweb/dol/service/JonasEjbService.java
New file
0,0 → 1,163
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasEjbService.java,v 1.1.1.1 2005-10-21 18:32:24 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.service;
 
import com.borland.jbuilder.jot.JotCatch;
import com.borland.jbuilder.jot.JotClassSource;
import com.borland.jbuilder.jot.JotCodeBlock;
import com.borland.jbuilder.jot.JotComment;
import com.borland.jbuilder.jot.JotMethodSource;
import com.borland.jbuilder.jot.JotStatement;
import com.borland.jbuilder.jot.JotTry;
import com.borland.jbuilder.jot.JotVariableDeclaration;
import com.borland.jbuilder.server.EjbService;
import com.borland.jbuilder.server.EjbService.Feature;
import com.borland.jbuilder.server.Server;
import com.borland.jbuilder.wizard.ejbclient.EjbTestClientState;
 
/**
* Specific class for Jonas ejbService
*/
public class JonasEjbService extends EjbService
{
private static Feature serviceEjbFeature[];
 
static
{
serviceEjbFeature = (new Feature[]
{
com.borland.jbuilder.server.EjbService.Feature.EJB_1_1,
com.borland.jbuilder.server.EjbService.Feature.EJB_2_0,
com.borland.jbuilder.server.EjbService.Feature.CMP_1x_RELATIONS,
com.borland.jbuilder.server.EjbService.Feature.COLLECTION_MULTI_OBJECT_FINDERS,
com.borland.jbuilder.server.EjbService.Feature.MINIMAL_JARS,
com.borland.jbuilder.server.EjbService.Feature.PRIMITIVE_PRIMARY_KEYS
});
}
 
/**
* Constructor
* @param server The server associated with this service
*/
public JonasEjbService(Server server)
{
super(server);
}
 
/**
* Returns the features of this service
* @return Feature[]
*/
protected com.borland.jbuilder.server.Feature[] getFeatures()
{
return serviceEjbFeature;
}
 
/**
* Returns true because this service supports feature
* @param feature
* @return boolean true
*/
public boolean supportsFeature(Feature feature)
{
return true;
}
 
/**
* This function needs to be overridden if the test client wizard needs to
* generate a special routine for getting the initial context for JNDI lookup.
* The return value will be the name of that routine -- normally something
* like "getInitialContext". In this case the EJB test client wizard will
* generate the following line: "Context ctx = getInitialContext();".
* The default behavior is not to generate a special routine, in which case
* the client will generate the following line:
* "Context ctx = new InitialContext();".
*
* @param ejbtestclientstate The EjbTestClientState object used to generate
* the test client
* @param jotclasssource The JotClassSource object referencing the source of
* the generated EJB test client class
*
* @return String with the name of the generated method (no parens).
* Null by default.
*/
public String createClientGetInitialContext(EjbTestClientState ejbtestclientstate, JotClassSource jotclasssource)
{
String s = "getInitialContext";
JotMethodSource jotmethodsource = jotclasssource.addMethod(null, false, "Context", s);
jotclasssource.addBlankLine(jotmethodsource, true);
jotmethodsource.setModifiers(2);
jotmethodsource.addThrowSpecifier(null, false, "Exception");
JotCodeBlock jotcodeblock = jotmethodsource.getCodeBlock();
JotVariableDeclaration jotvariabledeclaration = jotcodeblock.addVariableDeclaration(null,
false,
/*
ejbtestclientstate.getMinimalClassType("java.util.Properties",
jotclasssource.getDeclaringFile()),
*/
//Griffin
"test",
"properties");
jotvariabledeclaration.setInitializer("null");
JotTry jottry = jotcodeblock.addTryStatement(null,
false,
new String[]
{"Exception e"},
false);
JotCodeBlock jotcodeblock1 = jottry.getCodeBlock();
jotcodeblock1.addStatement(null, false, "properties = new Properties()");
jotcodeblock1.addComment(null, false, JotComment.LINE,
" By default JRMP, if it is not this protocol choose another");
jotcodeblock1.addStatement(null, false,
"properties.put(\"java.naming.factory.initial\", \"com.sun.jndi.rmi.registry.RegistryContextFactory\")");
jotcodeblock1.addStatement(null, false, "properties.put(\"java.naming.provider.url\", \"rmi://localhost:1099\")");
 
JotComment jc = jotcodeblock1.addComment(null, false, JotComment.LINE,
" If protocol used is JEREMIE, decomment these lines");
jotcodeblock1.addBlankLine(jc, true);
jotcodeblock1.addComment(null, false, JotComment.LINE, " properties.put(\"java.naming.factory.initial\", \"org.objectweb.jeremie.libs.services.registry.jndi.JRMIInitialContextFactory\")");
jotcodeblock1.addComment(null, false, JotComment.LINE,
" properties.put(\"java.naming.provider.url\", \"jrmi://localhost:2000\")");
 
jc = jotcodeblock1.addComment(null, false, JotComment.LINE, " If protocol used is IIOP, decomment these lines");
jotcodeblock1.addBlankLine(jc, true);
jotcodeblock1.addComment(null, false, JotComment.LINE,
" properties.put(\"java.naming.factory.initial\", \"org.objectweb.carol.jndi.iiop.IIOPReferenceContextWrapperFactory\")");
jotcodeblock1.addComment(null, false, JotComment.LINE,
" properties.put(\"java.naming.provider.url\", \"iiop://localhost:2001\")");
 
com.borland.jbuilder.jot.JotReturn jotreturn = jotcodeblock1.addReturnStatement(null, false,
"new InitialContext(properties)");
jotcodeblock1.addBlankLine(jotreturn, true);
JotCatch ajotcatch[] = jottry.getCatches();
JotCodeBlock jotcodeblock3 = ajotcatch[0].getCodeBlock();
jotcodeblock3.addStatement(null, false, "System.out.println(\"Error while creating initial context\")");
jotcodeblock3.addStatement(null, false, "throw e");
return s;
}
 
}
/tags/arelease/dol/src/org/objectweb/dol/service/JonasJspServletService.java
New file
0,0 → 1,218
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasJspServletService.java,v 1.1.1.1 2005-10-21 18:32:24 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.service;
 
import java.util.Map;
import org.objectweb.dol.server.JonasServer;
import org.objectweb.dol.util.configuration.JonasProperties;
//import org.objectweb.dol.web.JonasXmlSupport;
import com.borland.jbuilder.build.JspCompiler;
import com.borland.jbuilder.paths.GenericInstallModel;
import com.borland.jbuilder.paths.PathSet;
import com.borland.jbuilder.paths.PathSetManager;
import com.borland.jbuilder.server.JspServletService;
import com.borland.jbuilder.server.JspServletService.Feature;
import com.borland.jbuilder.server.ProjectServerModel;
import com.borland.jbuilder.server.Server;
import com.borland.jbuilder.server.ui.JspServletServiceRunConfigurationPage;
import com.borland.jbuilder.enterprise.ejb.DeploymentDescriptor;
//import com.borland.jbuilder.web.DeploymentDescriptorSupport;
//import com.borland.jbuilder.web.xml.WebXmlSupport;
import com.borland.primetime.properties.PropertyPage;
import com.borland.primetime.util.Version;
import com.borland.primetime.vfs.Url;
 
/**
* Specific class for Jonas JspServletService
*/
public class JonasJspServletService extends JspServletService
{
private static Feature serviceJspFeature[];
// private static DeploymentDescriptorSupport descriptor[];
private static DeploymentDescriptor descriptor[];
private Server m_Server = null;
 
private static final String jspPath[] = {"lib/jetty/ext/jasper-compiler.jar","lib/jetty/ext/jasper-runtime.jar","lib/jetty/ext/ant.jar","lib/jetty/ext/commons-el.jar"};
private static final String servletPath[] = {"lib/jetty/ext/jasper-compiler.jar","lib/jetty/ext/jasper-runtime.jar","lib/jetty/ext/ant.jar","lib/jetty/ext/commons-el.jar"};
 
protected GenericInstallModel jspcInstallModel;
protected GenericInstallModel servletInstallModel;
 
static
{
/* Griffin
descriptor = (new DeploymentDescriptorSupport[] {
new WebXmlSupport(JspServletService.Feature.SERVLET_2_3),
new JonasXmlSupport()});
*/
serviceJspFeature = (new Feature[] {
com.borland.jbuilder.server.JspServletService.Feature.JSP_1_2,
com.borland.jbuilder.server.JspServletService.Feature.SERVLET_2_3});
}
 
protected com.borland.jbuilder.server.Feature[] getFeatures()
{
return serviceJspFeature;
}
 
/**
* Constructor
* @param p_Server
*/
public JonasJspServletService(JonasServer p_Server)
{
super(p_Server);
servletInstallModel = new GenericInstallModel();
servletInstallModel.setClassEntries(servletPath);
jspcInstallModel = new GenericInstallModel();
jspcInstallModel.setClassEntries(jspPath);
}
 
/**
* Returns a Version description of the Servlet API that this container
* supports
* @return Version
*/
public Version getServletVersion()
{
return com.borland.jbuilder.server.JspServletService.Feature.SERVLET_2_3.getVersion();
}
 
/**
* Returns the configuration page for jsp servlet
* @param projectservermodel
* @param map
* @return propertypage
*/
public PropertyPage getRunConfigPropertyPage(ProjectServerModel projectservermodel, Map map)
{
return new JspServletServiceRunConfigurationPage(projectservermodel, map, this);
}
 
/**
* Returns the name of the Servlet API
* @return
*/
protected String getServletApiPathSetName()
{
return String.valueOf(String.valueOf(getServer().getShortNameWithVersion())).concat(" Servlet");
}
 
/**
* Create the Servlet API for JOnAS Tomcat
* @param pathset
*/
protected void buildServletApiPathSet(PathSet pathset)
{
servletInstallModel.attemptPathSet(pathset, getServer().getHomeDirectory());
pathset.save();
}
 
/**
* Returns PathSet for Servlet/JSP API library used by server. It is the
* responsibility of the setup to create this pathset, usually in the
* User home. This way, the project-specific Servlet library can point to it
* for its Servlet API classes. If possible, do not include internal
* implementation classes. If the server is not properly configured,
* this should be an empty pathset.
*
* @return PathSet
*/
public PathSet getServletApiPathSet()
{
PathSet pathset = PathSetManager.getLibrary(getServletApiPathSetName());
if(getServer().isSetup())
{
buildServletApiPathSet(pathset);
}
return pathset;
}
 
/**
* Returns a Version description of the JSP API that this container
* supports; e.g. 1.2
*
* @return Version cannot be null
*/
public Version getJspVersion()
{
return com.borland.jbuilder.server.JspServletService.Feature.JSP_1_2.getVersion();
}
 
/**
* This path is used for JSP CodeInsight, and therefore must contain the
* class named by getJspImplementationClass. If the server's classes contain
* the JSP classes, then this can delegate to getClassPath.
*
* @return classpath array of Urls for each classpath entry. If no classpath
* is set, return an empty string.
*/
public Url[] getJspClassPath()
{
return jspcInstallModel.createPath(jspcInstallModel.getClassEntries(), getServer().getHomeDirectory());
}
 
/**
* Most web servers have a Java-based command-line compiler that can be used
* to pre-compile JSPs at build time to check for errors.
*
* @return compiler interface implementation, or null if the web server does
* not have one
*/
public JspCompiler getJspCompiler()
{
return new com.borland.jbuilder.web.tomcat.JasperJspCompiler(this);
}
 
/**
* CodeInsight for JSPs needs the name of the base JSP implementation class
* e.g. "com.sun.jsp.runtime.HttpJspBase" for JSWDK
* @return String The fully-qualified class name
*/
public String getJspImplementationClass()
{
return JonasProperties.JSP_CLASS;
}
 
/**
* Returns the support info for the deployment descriptors used by the web
* server. At a minimum, a Servlet-API-compliant web server must support the
* standard web.xml file. A standard implementation (WebXmlSupport) is
* provided, but the server may use its own customized support.
* The web server may also use its own proprietary deployment descriptor,
* like JOnAS's jonas-web.xml. The standard support object should be first
* in the array.
*
* @return DeploymentDescriptorSupport[]
*/
/*
public DeploymentDescriptorSupport[] getDeploymentDescriptors()
{
return descriptor;
}
*/
}
/tags/arelease/dol/src/org/objectweb/dol/service/JonasMessageService.java
New file
0,0 → 1,41
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasMessageService.java,v 1.1.1.1 2005-10-21 18:32:24 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.service;
 
import com.borland.jbuilder.server.MessageService;
import org.objectweb.dol.server.JonasServer;
 
/**
* Specific class for Jonas MessageService
*/
public class JonasMessageService extends MessageService
{
public JonasMessageService(JonasServer p_JonasServer)
{
super(p_JonasServer);
}
}
/tags/arelease/dol/src/org/objectweb/dol/service/JonasNamingService.java
New file
0,0 → 1,42
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasNamingService.java,v 1.1.1.1 2005-10-21 18:32:24 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.service;
 
import org.objectweb.dol.server.JonasServer;
import com.borland.jbuilder.server.NamingService;
 
/**
* Specific class for Jonas NamingService
*/
public class JonasNamingService extends NamingService
{
public JonasNamingService(JonasServer p_JonasServer)
{
super(p_JonasServer);
}
 
}
/tags/arelease/dol/src/org/objectweb/dol/service/JonasDeployService.java
New file
0,0 → 1,666
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasDeployService.java,v 1.1.1.1 2005-10-21 18:32:24 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.service;
 
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import org.objectweb.dol.server.JonasLauncher;
import org.objectweb.dol.server.JonasServer;
import org.objectweb.dol.util.configuration.JonasProperties;
import org.objectweb.dol.util.run.JonasRun;
import com.borland.jbuilder.node.JBProject;
import com.borland.jbuilder.node.JarFileNode;
import com.borland.jbuilder.paths.PathSet;
import com.borland.jbuilder.paths.PathSetManager;
import com.borland.jbuilder.runtime.DeployListener;
import com.borland.jbuilder.runtime.JavaProcess;
import com.borland.jbuilder.server.DeployService;
import com.borland.primetime.ide.Browser;
import com.borland.primetime.ide.MessageView;
import com.borland.primetime.node.FileNode;
import com.borland.primetime.node.Node;
import com.borland.primetime.node.Project;
import com.borland.primetime.properties.GlobalBooleanProperty;
import com.borland.primetime.properties.MultipleNodeProperty;
import com.borland.primetime.properties.PropertyPage;
import com.borland.primetime.properties.PropertyPageFactory;
import com.borland.primetime.runtime.RunConfiguration;
import com.borland.primetime.util.Platform;
import com.borland.primetime.vfs.Url;
import com.borland.primetime.vfs.VFS;
import com.borland.jbuilder.runtime.server.DeployJavaProcessTracker;
import com.borland.jbuilder.enterprise.module.ejb.EjbModuleNode;
import com.borland.jbuilder.enterprise.module.ModuleNode;
import com.borland.primetime.build.BuildProcess;
import com.borland.jbuilder.build.BuildReport;
import org.objectweb.dol.util.configuration.JonasSettings;
import java.io.DataInputStream;
import com.borland.primetime.util.Strings;
import com.borland.jbuilder.build.CommandMaker;
import com.borland.jbuilder.build.BuildMessage;
import com.borland.jbuilder.enterprise.module.ejb.EjbModuleType;
import com.borland.jbuilder.enterprise.module.ModuleDescriptorsDirectoryNode;
import java.util.List;
import org.objectweb.dol.ejb.JonasDescriptorConversion;
import com.borland.jbuilder.enterprise.module.ModuleStubsBuildTask;
 
/**
* Manage the deployment of nodes
*/
public class JonasDeployService
extends DeployService {
public JonasDeployService(JonasServer p_Server) {
super(p_Server);
}
 
/**
* This method will be called from DeployRunner to perform a selected deploy
* action on archives selected from the project view.
* The default implementation will get the getDeployRunConfiguration()
* configuration, and if that's not null, it will call DeployRunner.deploy(...)
* with the propertyMap in that RunConfiguration.
* Override this if you have a more complicated way to deploy your archives
* than just calling a command line -- this routine is basically designed to
* run some command line that knows how to perform a deploy action.
*
* @param projectthe current JBProject
* @param deployNodes the selected deployable archive nodes (FileNode objects)
* @param deployAction deploy action (deploy/redeploy...)deployListener -
* @param deployListener Listener for certain deploy actions (can be null)
*/
public void contextDeploy(Browser browser,
JBProject project,
java.util.ArrayList deployNodes,
int deployAction,
DeployListener deployListener) {
String archivePath = null;
String archiveExtension = null;
String archiveName = null;
Url urlNode = null;
Url urlTarget = null;
JarFileNode archiveNodeArray = null;
Iterator deployableNodesList = null;
int nbArchivesToDeploy = 0;
int index = 0;
boolean isEjbJar = false;
boolean newDeployment = false;
JonasLauncher jonasLauncher = (JonasLauncher)this.getServer().
getSetupLauncher();
JonasRun jRun = new JonasRun(project);
Process process = null;
 
//Griffin
System.out.println("contextDeploy JOnASDeployService");
 
try {
for (deployableNodesList = deployNodes.iterator();
deployableNodesList.hasNext(); ) {
if (deployAction == this.LIST_ACTION) {
process = jRun.startJavaProcess(JonasProperties.JONAS_CLASS_ADMIN +
" " +
JonasProperties.ADMIN_LIST_OPTION,
" ");
 
BufferedReader input = new BufferedReader(new InputStreamReader(
process.getInputStream()));
String temp = null;
int count = 0;
while (input.ready() == false && count < 5) {
// On attend que le flux soit ready
Thread.currentThread().sleep(500L);
count++;
}
// Reinit the messages list
browser.getMessageView().clearMessages(MessageView.CATEGORY_LOG);
while ( (temp = input.readLine()) != null) {
// Adds a message to the messageView
browser.getMessageView().addMessage(MessageView.CATEGORY_LOG, temp);
}
 
// Waits for the end of the process
process.waitFor();
}
// Contains the node and his companion Node
archiveNodeArray = (JarFileNode) deployableNodesList.next();
archivePath = archiveNodeArray.getUrl().getFile();
archiveName = archivePath.substring(archivePath.lastIndexOf("/") + 1);
archiveExtension = archiveName.substring(archiveName.indexOf(".") + 1);
urlNode = new Url("file",
String.valueOf(archiveNodeArray.getUrl().getFile()));
 
// Gets the home dir with the right separator
String homeDir = this.getServer().getHomeDirectory().getFile();
if (Platform.WIN32) {
homeDir = homeDir.replace('/', '\\');
}
 
if (archiveExtension.equalsIgnoreCase(JarFileNode.EXTENSION)) {
// EjbJar
isEjbJar = true;
 
urlTarget = new Url("file",
String.valueOf(homeDir) +
String.valueOf(File.separatorChar + "ejbjars" +
File.separatorChar + "autoload" +
File.separatorChar + archiveName));
}
else if (archiveExtension.equalsIgnoreCase(JarFileNode.WAR_EXTENSION)) {
// WAR
urlTarget = new Url("file",
String.valueOf(homeDir) +
String.valueOf(File.separatorChar + "webapps" +
File.separatorChar + "autoload" +
File.separatorChar + archiveName));
}
else if (archiveExtension.equalsIgnoreCase(JarFileNode.EAR_EXTENSION)) {
// EAR
urlTarget = new Url("file",
String.valueOf(homeDir) +
String.valueOf(File.separatorChar + "apps" +
File.separatorChar + "autoload" +
File.separatorChar + archiveName));
}
else if (archiveExtension.equalsIgnoreCase(JarFileNode.RAR_EXTENSION)) {
// RAR
urlTarget = new Url("file",
String.valueOf(homeDir) +
String.valueOf(File.separatorChar + "rars" +
File.separatorChar + "autoload" +
File.separatorChar + archiveName));
}
 
if (urlTarget != null) {
// IF DEPLOY or REDEPLOY ACTION
if (deployAction == this.DEPLOY_ACTION ||
deployAction == this.REDEPLOY_ACTION) {
try {
// Adds the url to the list of the archives deployed
if (!jonasLauncher.containsDeployedUrl(urlTarget)) {
jonasLauncher.addDeployedUrl(urlTarget);
newDeployment = true;
}
// if archive is an ejbjar
if (isEjbJar == true) {
PathSet clientLib = PathSetManager.getLibrary(getServer().
getClientLibraryName());
// Update of the client classpath to add the ejbjar
clientLib.setClassPath(clientLib.addUniquePath(clientLib.
getClassPath(),
urlTarget));
clientLib.save();
isEjbJar = false;
}
 
if (newDeployment == true) {
// Copy the archive into the autoload dir
VFS.copy(urlNode, urlTarget);
// New archive to deploy
process = jRun.startJavaProcess(JonasProperties.
JONAS_CLASS_ADMIN + " " +
JonasProperties.
ADMIN_ADD_OPTION,
urlTarget.getFile());
process.waitFor();
}
else {
// Call JonasAdmin to take this new archive
process = jRun.startJavaProcess(JonasProperties.
JONAS_CLASS_ADMIN + " " +
JonasProperties.
ADMIN_REMOVE_OPTION,
urlTarget.getFile());
process.waitFor();
 
// Necessary because of lock pb on windows
// Call the gc to bypass the bug
process = jRun.startJavaProcess(JonasProperties.
JONAS_CLASS_ADMIN + " " +
JonasProperties.ADMIN_GC,
" ");
// Waits for the end of the process
process.waitFor();
 
// Copy the archive into the autoload dir
if (VFS.exists(urlTarget)) {
VFS.delete(urlTarget);
}
 
VFS.copy(urlNode, urlTarget);
 
process = jRun.startJavaProcess(JonasProperties.
JONAS_CLASS_ADMIN + " " +
JonasProperties.
ADMIN_ADD_OPTION,
urlTarget.getFile());
process.waitFor();
}
}
catch (Exception e) {
e.printStackTrace();
browser.getMessageView().addMessage(MessageView.CATEGORY_ERROR,
"Error while trying to deploy " + urlNode.getFile());
}
}
// IF UNDEPLOY ACTION
else if (deployAction == this.UNDEPLOY_ACTION) {
try {
// Remove the bean of the container jonas
process = jRun.startJavaProcess(JonasProperties.JONAS_CLASS_ADMIN +
" " +
JonasProperties.
ADMIN_REMOVE_OPTION,
urlTarget.getFile());
// Waits for the end of the process
process.waitFor();
 
// Necessary because of lock pb on windows
// Call the gc to bypass the bug
process = jRun.startJavaProcess(JonasProperties.JONAS_CLASS_ADMIN +
" " +
JonasProperties.ADMIN_GC,
" ");
// Waits for the end of the process
process.waitFor();
 
if (jonasLauncher.containsDeployedUrl(urlTarget)) {
jonasLauncher.removeDeployedUrl(urlTarget);
}
if (VFS.exists(urlTarget)) {
VFS.delete(urlTarget);
}
}
catch (Exception e) {
e.printStackTrace();
browser.getMessageView().addMessage(MessageView.CATEGORY_ERROR,
"Error while trying to undeploy " + urlTarget.getFile());
}
}
}
}
}
catch (Exception e) {
e.printStackTrace();
browser.getMessageView().addMessage(MessageView.CATEGORY_ERROR,
"Error during the deploy process : " +
e.getMessage());
}
finally {
archivePath = null;
archiveExtension = null;
archiveName = null;
urlNode = null;
urlTarget = null;
archiveNodeArray = null;
deployableNodesList = null;
jRun = null;
process = null;
}
}
 
/**
* This function is used to figure out which deploy actions the associated
* Server supports -- by default all deploy actions are supported. Some
* Servers, however, have restrictions on their deploy capabilities. This
* value is used, for instance, to add the right click deploy actions on a
* node, based on which actions are supported. The value is the result of
* a logical OR (|) of the supported deployActions found in this class
* (static members named _ACTION)
*
* @param deployNodes an ArrayList of FileNodes to be deployed
* @return an int specifying all supported deploy actions for this Service.
*/
public int getSupportedDeployActions(ArrayList deployNodes) {
return this.DEPLOY_ACTION | this.UNDEPLOY_ACTION | this.REDEPLOY_ACTION |
this.LIST_ACTION;
}
 
public JavaProcess createJavaProcess() {
return super.createJavaProcess();
}
 
public java.util.SortedMap customizeOtherEarContent(Node earNode,
java.util.SortedMap content) {
return super.customizeOtherEarContent(earNode, content);
}
 
 
public void finishDeployAction(DeployJavaProcessTracker tracker,
JBProject jbProject, int deployAction) {
super.finishDeployAction(tracker, jbProject, deployAction);
}
 
public GlobalBooleanProperty getAddProjectLibrariesOnDeployGlobalProperty() {
return super.getAddProjectLibrariesOnDeployGlobalProperty();
}
 
public MultipleNodeProperty getAddProjectLibrariesOnDeployNodeProperty() {
return super.getAddProjectLibrariesOnDeployNodeProperty();
}
 
public GlobalBooleanProperty getAddProjectOutputPathOnDeployGlobalProperty() {
return super.getAddProjectOutputPathOnDeployGlobalProperty();
}
 
public MultipleNodeProperty getAddProjectOutputPathOnDeployNodeProperty() {
return super.getAddProjectOutputPathOnDeployNodeProperty();
}
 
public java.util.List getAllDeployableNodeNames(Project project,
boolean mustExist) {
return super.getAllDeployableNodeNames(project, mustExist);
}
 
public java.util.List getAllDeployableNodes(Project project) {
return super.getAllDeployableNodes(project);
}
 
public Node getCompanionNode(Node node) {
return super.getCompanionNode(node);
}
 
public FileNode getDeployableNode(Node node) {
return super.getDeployableNode(node);
}
 
public PropertyPageFactory getDeployPropertyPageFactory(Node node) {
return super.getDeployPropertyPageFactory(node);
}
 
public RunConfiguration getDeployRunConfiguration(java.util.ArrayList
deployNodes,
int deployAction, JBProject project) {
return super.getDeployRunConfiguration(deployNodes, deployAction, project);
}
 
public java.lang.String[] getEnvironment(Project project) {
return super.getEnvironment(project);
}
 
public java.lang.String[] getExcludeDeployableNodeReasons(Project project,
Url[] nodes) {
return super.getExcludeDeployableNodeReasons(project, nodes);
}
 
public PropertyPage getProjectPropertiesPage(Project project) {
return super.getProjectPropertiesPage(project);
}
 
public boolean preStartDeployAction(DeployJavaProcessTracker
tracker, JBProject jbProject,
int deployAction) {
return super.preStartDeployAction(tracker, jbProject, deployAction);
}
 
public boolean supportsDeployAtServerStartup() {
return super.supportsDeployAtServerStartup();
}
 
public boolean supportsGuiToolDeploy() {
return super.supportsGuiToolDeploy();
}
 
public void postProcessBuild(BuildProcess buildprocess, ModuleNode moduleNode,
JarFileNode jarfilenode)
{
Url jarFileUrl = null;
Url ioTempDirUrl = null;
StringBuffer jarUpdate = null;
String ioTempDir = null;
CommandMaker commandmaker = null;
JonasRun genicRun = null;
Process genIcProcess = null;
Process jarProcess = null;
String genIcCommandLine = null;
DataInputStream errorStream = null;
DataInputStream inputStream = null;
EjbModuleNode ejbmodulenode=null;
List templist=null;
 
//Griffin
 
if (moduleNode.getModuleType().getClass() != EjbModuleType.class) {
return;
}
 
JBProject jbproject = (JBProject) moduleNode.getProject();
BuildReport buildreport = new BuildReport();
 
String errorMessage = "Invocation Error for JOnAS GenIC.";
String isSetup = (String) JonasSettings.getValue("SETUP");
 
// if the server is configured
if (isSetup == null || !isSetup.equals("true")) {
buildreport.addBuildError(new BuildMessage(errorMessage, 2));
}
 
// If no errors
if (buildreport.getErrorCount() == 0) {
// Gets the temp dir
ioTempDir = System.getProperty("java.io.tmpdir");
ioTempDirUrl = new Url(new File(ioTempDir));
if (!VFS.exists(ioTempDirUrl)) {
String errorTempDir = Strings.format(
"Temporary directory does not exist: {0}",
ioTempDirUrl.getFile());
buildreport.addBuildError(new BuildMessage(errorTempDir, 1));
// Stops the build
buildprocess.cancel();
}
// Gets the url of the jarFile
jarFileUrl = jarfilenode.getUrl();
buildprocess.fireBuildStatus(Strings.format("Running GenIC on {0}...",
jarFileUrl.getName()), false);
 
try {
commandmaker = new CommandMaker(errorMessage);
genicRun = new JonasRun(jbproject);
// Start process GenIC
genIcProcess = genicRun.startJavaProcess(JonasProperties.GENIC_CLASSES +
" " +
getGenIcOptions(jarFileUrl.getFile()),
"\""+jarFileUrl.getFile()+"\"");
genIcCommandLine = genicRun.getCommandLine();
 
// Show the command line
buildprocess.fireBuildMessage(jarFileUrl.getFullName(),
genIcCommandLine);
 
if (genIcProcess == null) {
buildreport.addBuildError(new BuildMessage(errorMessage, 2));
}
else {
BufferedReader input = new BufferedReader(new InputStreamReader(
genIcProcess.getInputStream()));
String temp = null;
int count = 0;
while (input.ready() == false && count < 5) {
// On attend que le flux soit ready
Thread.currentThread().sleep(1000L);
count++;
}
 
temp=null;
//Griffin - Çäåñü ñóùåñòâóåò ïðîáëåìà ñ ïîòîêîì. Ïðè îøèáî÷íîì çàâåðøåíèè readLine ìîæåò ïîâèñíóòü,
// ïîêà íå çàêðûòü èíòåðïðåòàòîð âðó÷íóþ. Ïåðåäåëàòü íà read().
while ( (temp = input.readLine()) != null) {
buildprocess.fireBuildMessage(jarFileUrl.getFullName(),
temp);
}
 
commandmaker.report(buildreport, genIcProcess, genIcCommandLine);
}
 
// Wait for the end of the process
genIcProcess.waitFor();
}
catch (Exception exception1) {
buildreport.addBuildError(new BuildMessage(exception1.getMessage(), 2));
buildprocess.cancel();
}
// if messages
BuildMessage abuildmessage[] = buildreport.getAllMessages();
if (abuildmessage != null) {
boolean flag1 = false;
for (int i = 0; i < abuildmessage.length; i++) {
if (!abuildmessage[i].isError() &&
(buildreport.isBuildSuccessful() || !abuildmessage[i].isWarning())) {
continue;
}
if (!flag1 && genIcCommandLine != null) {
buildprocess.fireBuildProblem(jarFileUrl, false, genIcCommandLine,
-1, -1, null);
flag1 = true;
}
buildprocess.fireBuildProblem(jarFileUrl,
abuildmessage[i].isError(),
abuildmessage[i].getMessage(),
abuildmessage[i].getLineNumber(),
abuildmessage[i].getColumnNumber(),
null);
}
}
}
}
 
/**
* Gets the options parameters to run GenIC
* @return String the paramaters
*/
private String getGenIcOptions(String p_JarFilePath) {
StringBuffer st = new StringBuffer();
 
// Verbose option
if (JonasProperties.GENIC_VERBOSE.getValue() != null &&
JonasProperties.GENIC_VERBOSE.getValue().length() > 0) {
if (JonasProperties.GENIC_VERBOSE.getValue().equalsIgnoreCase("true")) {
st.append(JonasProperties.GENIC_VERBOSE_OPTION).append(" ");
}
}
 
// Keepgenerated option
if (JonasProperties.GENIC_KEEPGEN.getValue() != null &&
JonasProperties.GENIC_KEEPGEN.getValue().length() > 0) {
if (JonasProperties.GENIC_KEEPGEN.getValue().equalsIgnoreCase("true")) {
st.append(JonasProperties.GENIC_KEEPGEN_OPTION).append(" ");
}
}
 
// Mappernames option
if (JonasProperties.GENIC_MAPPERNAMES.getValue() != null &&
JonasProperties.GENIC_MAPPERNAMES.getValue().length() > 0) {
st.append(JonasProperties.GENIC_MAPPERNAMES_OPTION).append(" ");
// List seperated by commas
st.append(JonasProperties.GENIC_MAPPERNAMES.getValue()).append(" ");
}
 
// Protocol option
ArrayList temp = new ArrayList();
if (JonasProperties.GENIC_PROTOCOL_IIOP.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_IIOP.getValue().equalsIgnoreCase("true") ||
JonasProperties.GENIC_PROTOCOL_JEREMIE.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_JEREMIE.getValue().equalsIgnoreCase(
"true") ||
JonasProperties.GENIC_PROTOCOL_JRMP.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_JRMP.getValue().equalsIgnoreCase("true")) {
st.append(JonasProperties.GENIC_PROTOCOL_OPTION).append(" ");
 
if (JonasProperties.GENIC_PROTOCOL_IIOP.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_IIOP.getValue().equalsIgnoreCase(
"true")) {
temp.add(JonasProperties.GENIC_IIOP_OPTION);
}
if (JonasProperties.GENIC_PROTOCOL_JEREMIE.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_JEREMIE.getValue().equalsIgnoreCase(
"true")) {
temp.add(JonasProperties.GENIC_JEREMIE_OPTION);
}
if (JonasProperties.GENIC_PROTOCOL_JRMP.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_JRMP.getValue().equalsIgnoreCase(
"true")) {
temp.add(JonasProperties.GENIC_JRMP_OPTION);
}
 
for (int j = 0; j < temp.size(); j++) {
if (j > 0) {
st.append(",").append(temp.get(j));
}
else {
st.append(temp.get(j));
}
}
}
return st.toString();
}
 
public void updatePostCompileBuildTask (ModuleStubsBuildTask task, BuildProcess buildProcess, ModuleNode moduleNode)
{
BuildReport buildreport = new BuildReport();
 
ModuleDescriptorsDirectoryNode mdtm=moduleNode.getDescriptorsNode();
 
//Griffin
// if (!mdtm.canCreateNewFile()) {
// buildreport.addBuildError(new BuildMessage("Can't create description file.", 2));
// return;
//}
if (moduleNode.getModuleType().getClass() != EjbModuleType.class) {
return;
}
 
JonasDescriptorConversion jdesc = new JonasDescriptorConversion((EjbModuleNode)moduleNode,buildreport);
 
try {
jdesc.generate();
}
catch (Exception ex) {
buildreport.addBuildError(new BuildMessage(ex.getMessage(), 2));
}
 
BuildMessage abuildmessage[] = buildreport.getAllMessages();
if (abuildmessage != null) {
boolean flag1 = false;
for (int i = 0; i < abuildmessage.length; i++) {
if (!abuildmessage[i].isError() &&
(buildreport.isBuildSuccessful() || !abuildmessage[i].isWarning())) {
continue;
}
 
buildProcess.fireBuildProblem(moduleNode.getArchiveUrl(),
abuildmessage[i].isError(),
abuildmessage[i].getMessage(),
abuildmessage[i].getLineNumber(),
abuildmessage[i].getColumnNumber(),
null);
 
}
}
}
 
}
/tags/arelease/dol/src/org/objectweb/dol/server/JonasServer.java
New file
0,0 → 1,283
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasServer.java,v 1.1.1.1 2005-10-21 18:32:09 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.server;
 
import java.io.File;
import java.awt.Component;
 
import org.objectweb.dol.service.JonasEjbService;
import org.objectweb.dol.service.JonasJspServletService;
import org.objectweb.dol.service.JonasNamingService;
import org.objectweb.dol.util.configuration.JonasProperties;
import org.objectweb.dol.util.configuration.JonasSettings;
import org.objectweb.dol.server.JonasLauncher;
import com.borland.jbuilder.server.Server;
import com.borland.jbuilder.server.ServerLauncher;
import com.borland.jbuilder.server.ServerManager;
import com.borland.jbuilder.server.ServerPropertyGroup;
import com.borland.primetime.vfs.Url;
import com.borland.primetime.vfs.VFS;
 
/**
* Class that represents a JonasServer
*/
public class JonasServer extends Server
{
 
/**
* Constructor
*/
public JonasServer(String p_ServerName)
{
super(p_ServerName);
}
 
/**
*
* @param byte0
* @param byte1
*/
public static void initOpenTool(byte byte0, byte byte1)
{
ServerManager.registerServer(new JonasServer(JonasProperties.SERVER_NAME));
}
 
/**
* Registers the server's services
*/
public void registerServices()
{
 
ServerManager.registerService(new JonasEjbService(this));
ServerManager.registerService(new JonasJspServletService(this));
ServerManager.registerService(new JonasNamingService(this));
ServerManager.registerService(new org.objectweb.dol.service.JonasMessageService(this));
ServerManager.registerService(new org.objectweb.dol.service.JonasDeployService(this));
}
 
 
/**
* @return name used to refer to the Server. Should not be null.
*/
public String getDefaultName()
{
return JonasProperties.SERVER_NAME;
}
 
/**
* @return version used to refer to the Server -- this string cannot
* contain any spaces. Should not be null.
*/
public String getDefaultVersion()
{
return JonasProperties.SERVER_VERSION;
}
 
/**
* This function returns the default home directory for this Server
*
* @return Url with the default home directory for this Server.
* Should not be null.
*/
public Url getDefaultHomeDirectory()
{
return new Url("file", JonasProperties.JONAS_DEFAULT_HOMEDIR);
}
 
/**
* This function returns the array of default directories/.jars that are
* necessary to run this Server. The user will be able to modify this list.
*
* @return Url[] The default classpath for this Server
*/
public Url[] getDefaultClassPath()
{
 
Url aurl[] = new Url[2];
// Récupération du Home directory
String homeDir = getDefaultHomeDirectory().getFile();
// Terminaison de la chaine avec /
if(!homeDir.endsWith("/"))
{
homeDir = String.valueOf(homeDir) + String.valueOf('/');
}
 
// Ajout des lib nécessaires dans le classpath
aurl[0] = new Url("zip", String.valueOf((new StringBuffer(String.valueOf(String.valueOf('[')))).append(homeDir).append("lib/common/ow_jonas_bootstrap.jar]")));
// Ajout de repertoire de config de JOnAS
aurl[1] = new Url("zip", String.valueOf((new StringBuffer(String.valueOf(String.valueOf('[')))).append(homeDir).append("conf]")));
 
return aurl;
}
 
/**
* This function is useful if the Server has to be configured before it can
* actually be used. It lets the Server return a string that indicates why
* the setup directory might be invalid. In most cases the setupDirectory
* will be the homeDirectory of the Server. If there are no problems, the
* return value is null.
*
* @param p_SetupDir The directory used to configure the Server (its home)
*
* @return A string indicating why the directory is invalid.
*/
public String isValidSetupDirectory(String p_SetupDir)
{
if(!p_SetupDir.endsWith("/"))
{
p_SetupDir = String.valueOf(p_SetupDir) + String.valueOf('/');
}
String exists = getFile(p_SetupDir, "lib/jetty/ext/jasper-compiler.jar");
 
if(exists == null)
{
exists = getFile(p_SetupDir, "lib/client.jar");
}
if(exists == null)
{
exists = getFile(p_SetupDir, "lib/common/ow_jonas_bootstrap.jar");
}
 
if(exists == null)
{
createClientLibrary(p_SetupDir);
}
 
return exists;
}
 
/**
* Factory method that returns a new instance of a ServerLauncher
* associated with this particular server setup. Run configuration settings
* are applied to this newly created instance. Not that you wouldn't, but
* Server implementions must return instances of the same type of
* ServerLauncher implementation. Don't get fancy and dynamically generate
* different types on ServerLauncher depending on setup/config state.
*
* @return a new instance
*/
public ServerLauncher newLauncher()
{
return new JonasLauncher(this);
}
 
/**
* The debugger needs the names of the packages that comprise the server
* so that tracing for those classes can be disabled. The package names
* may include a trailing asterisk as a wildcard
*
* @return array of package names
*/
public String[] getPackages()
{
String packages[] = new String[1];
packages[0] = "org.objectweb.jonas.server.*";
return packages;
}
 
/**
* Override this function to return a classpath containing classes necessary
* for a client application to access this application server.
*
* @param p_InstallPath - Directory where Server is installed. This is
* passed just in case the home directory hasn't been updated yet with the new path.
*
* @return Url[] Containing valid classpath entries for the client library.
*/
public Url[] getClientLibraryClassPath(String p_InstallPath)
{
if(p_InstallPath == null || p_InstallPath.equals(""))
{
p_InstallPath = getHomeDirectory().getFile();
}
String installPath = p_InstallPath.endsWith("/") ? p_InstallPath : String.valueOf(p_InstallPath) + String.valueOf('/');
Url aurl[] = new Url[4];
aurl[0] = new Url("zip", String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String.valueOf('[')))).append(installPath).append("lib/jetty/ext/jasper-compiler.jar").append(']'))));
aurl[1] = new Url("zip", String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String.valueOf('[')))).append(installPath).append("lib/jetty/ext/jasper-runtime.jar").append(']'))));
aurl[2] = new Url("zip", String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String.valueOf('[')))).append(installPath).append("lib/common/ow_jonas_bootstrap.jar").append(']'))));
aurl[3] = new Url("zip", String.valueOf(String.valueOf((new StringBuffer(String.valueOf(String.valueOf('[')))).append(installPath).append("lib/client.jar").append(']'))));
return aurl;
}
 
/**
* Checks that the server can be started; in particular by knowing where
* the server JARs are.
*
* @return whether server is configured.
*/
public boolean isSetup()
{
boolean flag = ServerPropertyGroup.isEnterpriseFunctionalityAvailable();
createClientLibrary(getHomeDirectory().getFile());
if(flag && (getHomeDirectory() == null || !VFS.exists(getHomeDirectory()) || !libraryExists(getClientLibraryName())))
{
flag = false;
}
if(flag)
{
JonasSettings.setValue("SETUP", "true");
}
return flag;
}
 
/**
* Return null or the message why the file does not exist
* @param p_StartPath
* @param p_EndPath
* @return String
*/
private String getFile(String p_StartPath, String p_EndPath)
{
String s2 = null;
File file = new File(String.valueOf(p_StartPath) + String.valueOf(p_EndPath));
if(!file.exists())
{
s2 = String.valueOf(file.getAbsoluteFile()) + " is required";
}
return s2;
}
 
/**
* This function checks if this Server has been configured. If not
* configured, and a CustomConfigurationPage exists for this Server
* (or it is just required to go through the Configure Servers dialog),
* a message dialog will come up indicating that this Server has not been
* configured yet.
*
* @param p_Component The host to use for the message dialog that might
* come up as a result of this function call
*
* @return true if the user needs to go through the Configure Servers
* dialog and if the configuration has been completed successfully,
* false otherwise.
*/
public boolean checkSetup(Component p_Component)
{
return true;
}
 
}
/tags/arelease/dol/src/org/objectweb/dol/server/JonasServerConfigurationPage.java
New file
0,0 → 1,323
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasServerConfigurationPage.java,v 1.1.1.1 2005-10-21 18:32:13 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.server;
 
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import javax.swing.BorderFactory;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import org.objectweb.dol.util.configuration.JonasProperties;
import com.borland.jbuilder.JBuilderHelp;
import com.borland.jbuilder.server.BasicConfigurationPageAccess;
import com.borland.jbuilder.server.CustomConfigurationPage;
import com.borland.primetime.help.HelpTopic;
 
 
/**
* Extends the configuration of the server (GenIC options)
*/
public class JonasServerConfigurationPage extends CustomConfigurationPage implements JonasProperties
{
private JCheckBox m_GenIcVerbose;
private JCheckBox m_GenIcKeepGenerated;
private JCheckBox m_ProtocolIiop;
private JCheckBox m_ProtocolJeremie;
private JCheckBox m_ProtocolJrmp;
private JTextField m_GenIcVmOptions;
private JTextField m_GenIcMapperNames;
 
/**
* Constructor
* @param p_BasicConfigurationPageAccess
*/
public JonasServerConfigurationPage(BasicConfigurationPageAccess p_BasicConfigurationPageAccess)
{
super(p_BasicConfigurationPageAccess);
createCustomPage();
}
 
/**
* This function create the graphic components visible in the personalisation
* page
*/
private void createCustomPage()
{
this.setLayout(new GridBagLayout());
 
this.setBorder(BorderFactory.createTitledBorder("GenIC Options"));
 
// CheckBox GenIC Verbose
m_GenIcVerbose = new JCheckBox("Verbose");
 
// CheckBox GenIC Verbose
m_GenIcKeepGenerated = new JCheckBox("Keepgenerated");
 
// JLabel for the choice of the protocol
JLabel genIcProtocol = new JLabel("Protocol :");
 
// JComboBox for GenIC protocols
JPanel panelProtocols = new JPanel();
m_ProtocolIiop = new JCheckBox("iiop");
m_ProtocolJeremie = new JCheckBox("jeremie");
m_ProtocolJrmp = new JCheckBox("jrmp");
panelProtocols.add(m_ProtocolIiop);
panelProtocols.add(m_ProtocolJeremie);
panelProtocols.add(m_ProtocolJrmp);
 
// Label for VM options
JLabel GenIcVmOptionsLabel = new JLabel("VM Parameters :");
 
// TextField GenIC Vm Options
m_GenIcVmOptions = new JTextField();
m_GenIcVmOptions.setSize(50, 50);
m_GenIcVmOptions.setEditable(true);
m_GenIcVmOptions.setAutoscrolls(true);
m_GenIcVmOptions.setColumns(50);
 
// Label for mappernames
JLabel GenIcMapperNamesLabel = new JLabel("Mappernames :");
 
// TextField GenIC mappernames
m_GenIcMapperNames = new JTextField();
m_GenIcMapperNames.setSize(50, 50);
m_GenIcMapperNames.setEditable(true);
m_GenIcMapperNames.setAutoscrolls(true);
m_GenIcMapperNames.setColumns(50);
 
// Empty label to make space
JLabel emptyLabel = new JLabel(" ");
 
this.add(m_GenIcVerbose, new GridBagConstraints(0, 1, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 6, 6), 0, 0));
this.add(m_GenIcKeepGenerated, new GridBagConstraints(1, 1, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 6, 0), 0, 0));
this.add(genIcProtocol, new GridBagConstraints(0, 2, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 6, 0), 0, 0));
this.add(panelProtocols, new GridBagConstraints(1, 2, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 6, 0), 0, 0));
this.add(GenIcVmOptionsLabel, new GridBagConstraints(0, 3, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 6, 6), 0, 0));
this.add(m_GenIcVmOptions, new GridBagConstraints(1, 3, 2, 1, 1.0D, 0.0D, 10, 2, new Insets(0, 0, 6, 0), 0, 0));
this.add(GenIcMapperNamesLabel,new GridBagConstraints(0, 4, 1, 1, 0.0D, 0.0D, 17, 0, new Insets(0, 0, 6, 0), 0, 0));
this.add(m_GenIcMapperNames, new GridBagConstraints(1, 4, 1, 1, 1.0D, 0.0D, 10, 2, new Insets(0, 0, 6, 0), 0, 0));
this.add(emptyLabel, new GridBagConstraints(1, 6, 1, 1, 1.0D, 1.0D, 17, 0, new Insets(0, 0, 6, 0), 0, 0));
}
 
/**
* This function sets the default values
*/
public void setToDefaults()
{
// default these 2 options are selected
m_ProtocolJeremie.setSelected(true);
m_ProtocolJrmp.setSelected(true);
}
 
/**
* Method that checks if the page is valid
* @return boolean valid true if the page is valid
*/
public boolean isPageValid()
{
// this page is always valid, it is just some options configuration
return true;
}
 
/**
* Method that returns true if the page is modified
* @return boolean true if page modified
*/
public boolean isModified()
{
return true;
}
 
/**
* this function returns the HelpTopic associated with server configuration
* @return HelpTopic
*/
 
public HelpTopic getHelpTopic()
{
return JBuilderHelp.TOPIC_DConfigureServers;
}
 
/**
* This function reads the properties already loaded
*/
public void readProperties()
{
// Read prop for GenIC Verbose
if(JonasProperties.GENIC_VERBOSE.getValue() != null &&
JonasProperties.GENIC_VERBOSE.getValue().equalsIgnoreCase("true"))
{
m_GenIcVerbose.setSelected(true);
}
else
{
m_GenIcVerbose.setSelected(false);
}
 
// Read prop for GenIC keepGenerated
if(JonasProperties.GENIC_KEEPGEN.getValue() != null &&
JonasProperties.GENIC_KEEPGEN.getValue().equalsIgnoreCase("true"))
{
m_GenIcKeepGenerated.setSelected(true);
}
else
{
m_GenIcKeepGenerated.setSelected(false);
}
 
// Read prop for GenIC Protocol
boolean noneSelected = true;
if(JonasProperties.GENIC_PROTOCOL_IIOP.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_IIOP.getValue().equalsIgnoreCase("true"))
{
m_ProtocolIiop.setSelected(true);
noneSelected = false;
}
else
{
m_ProtocolIiop.setSelected(false);
}
if(JonasProperties.GENIC_PROTOCOL_JEREMIE.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_JEREMIE.getValue().equalsIgnoreCase("true"))
{
m_ProtocolJeremie.setSelected(true);
noneSelected = false;
}
else
{
m_ProtocolJeremie.setSelected(false);
}
if(JonasProperties.GENIC_PROTOCOL_JRMP.getValue() != null &&
JonasProperties.GENIC_PROTOCOL_JRMP.getValue().equalsIgnoreCase("true"))
{
m_ProtocolJrmp.setSelected(true);
noneSelected = false;
}
else
{
m_ProtocolJrmp.setSelected(false);
}
if(noneSelected == true)
{
// Default values
m_ProtocolJrmp.setSelected(true);
m_ProtocolJeremie.setSelected(true);
}
 
 
// Read prop for GenIC VM params
if(JonasProperties.GENIC_VMPARAMS.getValue() != null &&
JonasProperties.GENIC_VMPARAMS.getValue().length() > 0)
{
m_GenIcVmOptions.setText(JonasProperties.GENIC_VMPARAMS.getValue());
}
 
// Read prop for GenIC mappernames
if(JonasProperties.GENIC_MAPPERNAMES.getValue() != null)
{
m_GenIcMapperNames.setText(JonasProperties.GENIC_MAPPERNAMES.getValue());
}
}
 
/**
* This function is called when the properties have to be saved
*/
public void writeProperties()
{
// Write prop for verbose mode
if(m_GenIcVerbose.isSelected() == true)
{
JonasProperties.GENIC_VERBOSE.setValue("true");
}
else
{
JonasProperties.GENIC_VERBOSE.setValue("false");
}
 
// Write prop for keepgenerated
if(m_GenIcKeepGenerated.isSelected() == true)
{
JonasProperties.GENIC_KEEPGEN.setValue("true");
}
else
{
JonasProperties.GENIC_KEEPGEN.setValue("false");
}
 
boolean noneSelected = true;
// Write prop for protocol
if(m_ProtocolJeremie.isSelected() == true)
{
JonasProperties.GENIC_PROTOCOL_JEREMIE.setValue("true");
noneSelected = false;
}
else
{
JonasProperties.GENIC_PROTOCOL_JEREMIE.setValue("false");
}
if(m_ProtocolJrmp.isSelected() == true)
{
JonasProperties.GENIC_PROTOCOL_JRMP.setValue("true");
noneSelected = false;
}
else
{
JonasProperties.GENIC_PROTOCOL_JRMP.setValue("false");
}
if(m_ProtocolIiop.isSelected() == true)
{
JonasProperties.GENIC_PROTOCOL_IIOP.setValue("true");
noneSelected = false;
}
else
{
JonasProperties.GENIC_PROTOCOL_IIOP.setValue("false");
}
if(noneSelected == true)
{
// Default values
JonasProperties.GENIC_PROTOCOL_JEREMIE.setValue("true");
JonasProperties.GENIC_PROTOCOL_JRMP.setValue("true");
}
 
// Write prop for VM Params
if(m_GenIcVmOptions.getText() != null)
{
JonasProperties.GENIC_VMPARAMS.setValue(m_GenIcVmOptions.getText());
}
 
// Write prop for mappernames
if(m_GenIcMapperNames.getText() != null)
{
JonasProperties.GENIC_MAPPERNAMES.setValue(m_GenIcMapperNames.getText());
}
}
 
}
/tags/arelease/dol/src/org/objectweb/dol/server/JonasLauncher.java
New file
0,0 → 1,574
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasLauncher.java,v 1.1.1.1 2005-10-21 18:32:09 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.server;
 
import java.io.BufferedReader;
import java.io.File;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.objectweb.dol.util.configuration.JonasProperties;
import com.borland.jbuilder.debugger.DebugPropertyGroup;
import com.borland.jbuilder.node.JBProject;
import com.borland.jbuilder.node.JarFileNode;
import com.borland.jbuilder.paths.JDKPathSet;
import com.borland.jbuilder.paths.PathSet;
import com.borland.jbuilder.paths.PathSetManager;
import com.borland.jbuilder.runtime.JavaProcess;
import com.borland.jbuilder.runtime.RunJavaProcessTracker;
import com.borland.jbuilder.runtime.ServerRunner;
import com.borland.jbuilder.server.DeployService;
import com.borland.jbuilder.server.PureJavaServerLauncher;
import com.borland.jbuilder.server.Server;
import com.borland.primetime.ide.Browser;
import com.borland.primetime.node.Node;
import com.borland.primetime.util.CommandRunner;
import com.borland.primetime.util.VetoException;
import com.borland.primetime.util.Wait;
import com.borland.primetime.vfs.Url;
import com.borland.primetime.vfs.VFS;
import org.objectweb.dol.service.JonasDeployService;
 
/**
* Manage the jonas server (start, stop, ...)
*/
public class JonasLauncher extends PureJavaServerLauncher
{
private JBProject m_Project;
private ArrayList m_ArchiveDeployed = new ArrayList();
 
/**
* Constructor
* @param p_JonasServer The server
*/
public JonasLauncher(Server p_JonasServer)
{
super(p_JonasServer);
}
 
/**
* Post tasks
*/
public void postStop()
{
// Delete the client library and recreate it to delete the path of the
// ejbjars
PathSetManager.getLibrary(getServer().getClientLibraryName()).delete();
getServer().createClientLibrary(getServer().getHomeDirectory().getFile());
 
// Deletes the deployed files
Url archive = null;
Iterator i = null;
for(i = m_ArchiveDeployed.iterator(); i.hasNext();)
{
archive = (Url)i.next();
if(VFS.exists(archive))
{
try
{
VFS.delete(archive);
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
m_ArchiveDeployed.clear();
}
 
/**
* This function is called before the server process is launched. It gives a
* server a chance to do some pre-startup tasks, if necessary. The server
* can return false to abort the normal startup process.
*
* @return boolean indicating whether the appserver can be run.
*/
public boolean preStart()
{
 
String archivePath = null;
String archiveExtension = null;
String archiveName = null;
String archives[] = null;
JonasDeployService deployService = null;
// JonasDeployServiceJB7 deployServiceJB7 = null;
DeployService deployServices[] = null;
// JonasDeployServiceJB7 deployServicesJB7[] = null;
Url urlNode = null;
Url urlTarget = null;
List listNodes = null;
Node archiveNodeArray[] = null;
Iterator deployableNodesList = null;
int nbArchivesToDeploy = 0;
int index = 0;
boolean deployable = false;
boolean isEjbJar = false;
 
try
{
 
deployServices = DeployService.getServices(m_Project);
// deployService = (JonasDeployService) DeployService.getService(m_Project);
// Gets the list of nodes that can be deployed
listNodes = deployService.getAllDeployableNodes(m_Project);
 
// Gets the name of the archives to deploy
 
for (int myi=0; myi<deployServices.length;myi++)
{
deployService = (JonasDeployService)deployServices[myi];
listNodes = deployService.getAllDeployableNodes(m_Project);
archives = super.getArchivesToDeployOnRun();
 
for (deployableNodesList = listNodes.iterator();
deployableNodesList.hasNext(); ) {
// Contains the node and his companion Node
archiveNodeArray = (Node[]) deployableNodesList.next();
archivePath = ( (JarFileNode) archiveNodeArray[1]).getUrl().getFile();
archiveName = archivePath.substring(archivePath.lastIndexOf("/") + 1);
nbArchivesToDeploy = archives.length;
index = 0;
deployable = false;
while (index < nbArchivesToDeploy && deployable == false) {
if (archives[index].equals(archiveName)) {
deployable = true;
}
index++;
}
 
if (deployable) {
archiveExtension = archiveName.substring(archiveName.indexOf(".") + 1);
urlNode = new Url("file",
String.valueOf( ( (JarFileNode) archiveNodeArray[1]).
getUrl().getFile()));
if (archiveExtension.equalsIgnoreCase(JarFileNode.EXTENSION)) {
// EjbJar
isEjbJar = true;
 
urlTarget = new Url("file",
String.valueOf(this.getServer().getHomeDirectory().
getFile()) +
String.valueOf(File.separatorChar + "ejbjars" +
File.separatorChar + "autoload" +
File.separatorChar + archiveName));
}
else if (archiveExtension.equalsIgnoreCase(JarFileNode.WAR_EXTENSION)) {
// WAR
urlTarget = new Url("file",
String.valueOf(this.getServer().getHomeDirectory().
getFile()) +
String.valueOf(File.separatorChar + "webapps" +
File.separatorChar + "autoload" +
File.separatorChar + archiveName));
}
else if (archiveExtension.equalsIgnoreCase(JarFileNode.EAR_EXTENSION)) {
// EAR
urlTarget = new Url("file",
String.valueOf(this.getServer().getHomeDirectory().
getFile()) +
String.valueOf(File.separatorChar + "apps" +
File.separatorChar + "autoload" +
File.separatorChar + archiveName));
}
else if (archiveExtension.equalsIgnoreCase(JarFileNode.RAR_EXTENSION)) {
// RAR
urlTarget = new Url("file",
String.valueOf(this.getServer().getHomeDirectory().
getFile()) +
String.valueOf(File.separatorChar + "rars" +
File.separatorChar + "autoload" +
File.separatorChar + archiveName));
}
 
try {
if (urlTarget != null) {
// Copy the archive into the autoload dir
VFS.copy(urlNode, urlTarget);
// Adds the url to the list of the archives deployed
m_ArchiveDeployed.add(urlTarget);
// if archive is an ejbjar
if (isEjbJar == true) {
PathSet clientLib = PathSetManager.getLibrary(getServer().
getClientLibraryName());
Url classPath[] = clientLib.getClassPath();
Url newClassPath[] = new Url[classPath.length + 1];
int i;
for (i = 0; i < classPath.length; i++) {
newClassPath[i] = classPath[i];
}
newClassPath[i] = urlTarget;
// Update of the client classpath to add the ejbjar
clientLib.setClassPath(newClassPath);
//clientLib.setClassPath(clientLib.addUniquePath(clientLib.getClassPath(), urlNode));
clientLib.save();
isEjbJar = false;
}
}
}
catch (Exception exception) {
exception.printStackTrace();
}//catch
}//if deployable
}//for
}
}//try
catch(Exception e)
{
e.printStackTrace();
}
finally
{
archivePath = null;
archiveExtension = null;
archiveName = null;
archives = null;
deployService = null;
urlNode = null;
urlTarget = null;
listNodes = null;
archiveNodeArray = null;
deployableNodesList = null;
}
return true;
 
}
 
/**
* Configures this particular launcher instance with a set of services to
* simulate a run. This service set is not validated, and the propertyMap,
* tracker, and workDir fields are set to null.
*
* @param project The project using this server
* @param propertyMap Arrays of services, no duplicates, no particular
* order; should not be empty, should not be null
* @param tracker
* @param workDir
*
* @throws VetoException
*/
public void configureLauncher(JBProject project,
java.util.Map propertyMap,
RunJavaProcessTracker tracker,
Url workDir)
throws VetoException
{
m_Project = project;
super.configureLauncher(project, propertyMap,tracker, workDir);
}
 
/**
* This function returns the default VM parameters
*
* @return String The VM parameters
*/
public String getDefaultVmParameters()
{
StringBuffer st = new StringBuffer();
st.append("-Dinstall.root=").append(this.getServer().getDefaultHomeDirectory().getFile());
st.append(" -Djonas.base=").append(this.getServer().getDefaultHomeDirectory().getFile());
st.append(" -Djava.security.policy=");
st.append(this.getServer().getDefaultHomeDirectory().getFile()).append("/conf/java.policy");
// st.append(" -Djonas.classpath=");
st.append(" -Djava.endorsed.dirs=").append(this.getServer().getDefaultHomeDirectory().getFile()).append("/lib/endorsed");
st.append(" -Djonas.default.classloader=true");
st.append(" -Djavax.rmi.CORBA.PortableRemoteObjectClass=org.objectweb.carol.rmi.multi.MultiPRODelegate");
st.append(" -Djava.naming.factory.initial=org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory");
 
return st.toString();
}
 
/**
* These VM parameters are ones without which the server will not run. Unless
* it is really necessary, you don't want to resort to using this function.
* These params will not be shown to the user in any UI, and will be added to
* the front of the VM parameter list for the server, when it will be run.
*
* @return the vm parameters without which this server cannot be run; may be
* an empty string, but should not be null
*/
public String getDefaultNecessaryVmParameters()
{
return "";
}
 
/**
*
* @return the arguments with which this server should be run; may be an
* empty string, but should not be null.
*/
public String getDefaultArguments()
{
return "";
}
 
/**
* These arguments are ones without which the server will not run. Unless it
* is really necessary, you don't want to resort to using this function.
* These args will not be shown to the user in any UI, and will be added to
* the front of the argument list for the server, when it will be run.
*
* @return the arguments without which this server cannot be run; may be
* an empty string, but should not be null.
*/
public String getDefaultNecessaryArguments()
{
return "";
}
 
public void preStop()
{
forceShutdown();
}
 
/**
* It is the class that must be launch to start the server
* @return String The name of the class(es)
*/
public String getDefaultClassName()
{
return JonasProperties.JONAS_CLASS_START;
}
 
/**
*
* @return String The command
*/
public String getCommand()
{
return "";
}
 
 
/**
* Returns the class Path without char [ ]
* @return String classPath
*/
private String getClassPath()
{
String temp = null;
int indexDebut = 0;
int indexFin = 0;
 
Url classPathUrl[] = getServer().getClassPath();
StringBuffer classPath = new StringBuffer();
for(int i = 0; i < classPathUrl.length; i++)
{
temp = classPathUrl[i].getFile();
indexDebut = temp.indexOf("[");
if(indexDebut != -1)
{
temp = temp.substring(indexDebut + 1);
}
indexFin = temp.indexOf("]");
if(indexFin != -1)
{
temp = temp.substring(0, indexFin);
}
classPath.append(temp).append(File.pathSeparatorChar);
}
return classPath.toString();
}
 
 
public boolean forceShutdown()
{
ServerRunner.removeRunningLauncher(this);
 
/* Griffin
if(DebugPropertyGroup.isRemoteAttach(getPropertyMap()))
{
return false;
}
*/
JonasStopper stopper = new JonasStopper(this);
if(stopper != null)
{
Wait wait = new Wait(stopper.getWaitTime() * 1000);
Thread thread = new Thread(stopper, "Sending stop to server");
thread.start();
try
{
do
{
Thread.sleep(250L);
}
while(stopper.sendingStop() && !wait.done());
}
catch(InterruptedException interruptedexception)
{
return false;
}
if(wait.done())
{
thread.interrupt();
}
return stopper.stopSent();
}
else
{
return false;
}
}
 
protected com.borland.jbuilder.server.ServerLauncher.Stopper getStopper()
{
return null;
}
 
class JonasStopper implements com.borland.jbuilder.server.ServerLauncher.Stopper
{
private final JonasLauncher m_Launcher;
boolean c;
boolean b;
 
/**
* Constructor
* @param ajonaslauncher JonasLauncher
*/
JonasStopper(JonasLauncher ajonaslauncher)
{
m_Launcher = ajonaslauncher;
b = true;
c = false;
}
 
public boolean stopSent()
{
return c;
}
 
public boolean sendingStop()
{
return b;
}
 
/**
* Returns the time to wait
* @return int
*/
public int getWaitTime()
{
return 100;
}
 
/**
* Run method
*/
public void run()
{
try
{
String s = makeCommandLine(m_Launcher.getTracker().getBrowser(), m_Launcher.getServer());
try
{
Process process = CommandRunner.exec(s);
 
BufferedReader bufferedreader = new BufferedReader(new InputStreamReader(process.getInputStream()));
BufferedReader bufferedreader1 = new BufferedReader(new InputStreamReader(process.getErrorStream()));
do
{
try
{
c = process.exitValue() == 0;
break;
}
catch(IllegalThreadStateException illegalthreadstateexception)
{
Thread.sleep(50L);
}
}
while(true);
}
catch(Exception exception)
{}
}
finally
{
b = false;
}
}
 
/**
* Creates the command line to stop jonas
* @param browser
* @param server
* @return String the command line
*/
private String makeCommandLine(Browser browser, Server server)
{
Object obj = null;
char c1 = File.pathSeparatorChar;
JDKPathSet jdkpathset = server.getAssociatedJdk();
if(jdkpathset == null)
{
com.borland.primetime.node.Project project = browser.getActiveProject();
if(project instanceof JBProject)
{
jdkpathset = ((JBProject) project).getPaths().getJDKPathSet();
}
else
{
jdkpathset = PathSetManager.getJDK("");
}
}
StringBuffer stringbuffer = new StringBuffer();
stringbuffer.append(jdkpathset.getHomePath().getFile());
stringbuffer.append(File.separatorChar).append("bin").append(File.separatorChar);
stringbuffer.append(JavaProcess.getJavaLauncher());
String s = server.getHomeDirectory().getFile();
StringBuffer stringbuffer1 = new StringBuffer(" -classpath ");
stringbuffer1.append(getClassPath());
stringbuffer.append(stringbuffer1.toString());
stringbuffer.append(" ").append(getVmParameters()).append(" ");
stringbuffer.append(JonasProperties.JONAS_STOP_CLASSES);
return stringbuffer.toString();
}
}
 
public void addDeployedUrl(Url p_Url)
{
m_ArchiveDeployed.add(p_Url);
}
 
public boolean containsDeployedUrl(Url p_Url)
{
return m_ArchiveDeployed.contains(p_Url);
}
 
public Iterator getDeployedUrl()
{
return m_ArchiveDeployed.iterator();
}
 
public void removeDeployedUrl(Url p_Url)
{
m_ArchiveDeployed.remove(p_Url);
}
 
}
/tags/arelease/dol/src/org/objectweb/dol/server/JonasServerConfigurationPageFactory.java
New file
0,0 → 1,57
/*
* DOL : Plugin JOnAS for JBuilder 2005
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or any later version.
*
* This library 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 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA
*
* Initial developer(s): ____________________________________.
* Contributor(s): ______________________________________.
*
* --------------------------------------------------------------------------
* $Id: JonasServerConfigurationPageFactory.java,v 1.1.1.1 2005-10-21 18:32:13 griffin Exp $
* --------------------------------------------------------------------------
*/
 
package org.objectweb.dol.server;
 
import org.objectweb.dol.util.configuration.JonasProperties;
import com.borland.jbuilder.server.BasicConfigurationPageAccess;
import com.borland.jbuilder.server.CustomConfigurationPage;
import com.borland.jbuilder.server.CustomConfigurationPageFactory;
import com.borland.jbuilder.server.ServerManager;
 
/**
* Permit to add a customconfigurationpage
*/
public class JonasServerConfigurationPageFactory extends CustomConfigurationPageFactory
{
public JonasServerConfigurationPageFactory()
{
super();
}
 
public static void initOpenTool(byte majorVersion, byte minorVersion)
{
ServerManager.registerCustomConfigurationPageFactory(new JonasServerConfigurationPageFactory(),
JonasProperties.SERVER_NAME,
JonasProperties.SERVER_VERSION);
}
 
protected CustomConfigurationPage createCustomConfigurationPage(BasicConfigurationPageAccess basicConfigurationPageAccess)
{
return new JonasServerConfigurationPage(basicConfigurationPageAccess);
}
 
}
/tags/arelease/dol/src/META-INF/manifest.mf
New file
0,0 → 1,4
Implementation-Vendor: Griffin.
Implementation-Version: 0.1
Implementation-Title: DOL, 2005 org.objectweb.dol.ejb.JonasTargeting
OpenTools-Ejb: org.objectweb.dol.server.JonasServer org.objectweb.dol.util.help.JonasAboutBox org.objectweb.dol.server.JonasServerConfigurationPageFactory
/tags/arelease/dol/dol.html
New file
0,0 → 1,66
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>JBuilder Project DOL.jpx</title>
</head>
<body>
<h1>Project DOL Notes</h1>
<hr>
<table border="0">
<tr>
<th align="left" valign="top">Title:DOL</th>
<td align="left" valign="top">
<!-- Type Title below -->
</td>
 
</tr>
<tr>
<th align="left" valign="top">Author: Griffin <a href="mailto:dxi@mail.ru">dxi@mail.ru</a> </th>
<td align="left" valign="top">
<!-- Type Author below -->
</td>
</tr>
<tr>
<th align="left" valign="top">Description: JOnAS (jetty) server plug-in for JBuilder 2005</th>
<td align="left" valign="top">
<!-- Type Description below -->
</td>
</tr>
</table>
<hr>
<h2>Features...</h2>
<ol>
<li>GenIC postprocess of compiled EJBs.
<li>Deployment support of EJB, WAR and EAR modules.
</ol>
<h2>Things to do...</h2>
<ol>
<!-- Edit this section to keep track of your to do items -->
<li>JOnAS (tomcat) support.
<li>Standalone JOnAS support.
<li>Generate jonas-web.xml.
<li>Fix all bugs. :)
</ol>
<h2>Bugs...</h2>
<ol>
<li>When GenIC generate any error, JBuilder build process hang, because no output from GenIC process to stdout, <br> and java BufferedReader haven't timeout for read(). :( </li>
<li>Any bug, what you can imagine. :)
</ol>
<h2>Installation ...</h2>
<ol>
<li>Shutdown JBuilder</li>
<li>Copy dol*.jar into your JBuilder plugin directory in $Jbuilder_home\lib\ext\
<li>Start JBuilder
<li>Configure JOnAS.</li>
</ol>
<h2>Configuration</h2>
<ol>
<li>Go to menu Tool/Configure servers.</li>
<li>Normally you can view JonAS (jetty) 4.3.x in the list. Choose it and enable it.
<li>You must now configure the path to Home directory. You can modify other default parameters. You must choose into class tab the path to your JDBC driver correponding of your mappernames. It will automatically add these librairies to the classpath when JOnAS starts.
<li>In the second tab, you can configure GenIC with various options (verbose, keepgenerated, mappernames).
<li>Your JonAS Server configuration is finished, so choose ok button.
<li>The JOnAS server is enabled.
</ol>
</body>
</html>