ServerInstancepublic class ServerInstance extends Object implements Serializable
Fields Summary |
---|
private String | host | private String | ad_host | private transient PropertyChangeSupport | propertySupport | private String | nameHolds value of property name. | private String | dispName | private String | passwordHolds value of property password. | private int | portHolds value of property port. | private int | ad_port | private String | userNameHolds value of property userName. | public static String | pw_editor | transient boolean | checkAlreadyDone | transient boolean | IAS_Running | transient boolean | checkDone | transient boolean | KJS_Running | transient boolean | instRunning | transient boolean | isEnabled | private transient com.sun.enterprise.admin.servermodel.ServerInstanceManager | manager | private transient com.sun.enterprise.admin.servermodel.AppServerInstance | instance | String | depName | static final ResourceBundle | bundle | private int | debugPort |
Constructors Summary |
---|
public ServerInstance(String SOM_name, String serv_name, int serv_port, String username, String passwd)Creates new ServerInstance // NOI18N
propertySupport = new PropertyChangeSupport ( this );
userName = username;
password = passwd;
dispName = SOM_name;
name = serv_name;
port = serv_port;
ad_host = serv_name.substring(serv_name.indexOf("(")+1, serv_name.indexOf(":"));//NOI18N
ad_port = Integer.parseInt( serv_name.substring(serv_name.indexOf(":")+1, serv_name.indexOf(")")) );//NOI18N
| public ServerInstance(String SOM_name, String serv_name, int serv_port)
this(SOM_name,serv_name,serv_port,"admin","admin123");//NOI18N
| public ServerInstance(String SOM_name, String serv_name)
this(SOM_name,serv_name,-1);
|
Methods Summary |
---|
public void | Apply(com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String server = this.getName();
try{
Reporter.info("---------------------Applying changes to Server Instance"); // NOI18N
class ApplyThread extends Thread{
public void run () {
try{
getSelectedInstance().applyChanges();
messenger.setStatusText(java.text.MessageFormat.format(bundle.getString("Msg_Applyed"), new Object[] {server}) ); //NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, afe.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(server);
}
}//run
}
ApplyThread appl = new ApplyThread();
appl.start();
Reporter.info("---------------------After Applying changes to Server Instance"); // NOI18N
while(appl.isAlive()){
Thread.sleep(500);
}
Reporter.info("---------------------Finished Applying changes to Server Instance"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public void | Disable(java.lang.String resName, java.lang.String resType, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String server = this.getName();
try{
Reporter.info("---------------------Before Disabling Resource"); // NOI18N
class DisableThread extends Thread{
public void run () {
try{
if(resType.trim().indexOf(".ear") != -1){ // NOI18N
DeployedApplicationComponentBean component = getSelectedInstance().getDeployedApplication(resName);
component.disable();
}else{
if(resType.trim().indexOf(".jar") != -1){ // NOI18N
DeployedEJBModuleComponentBean component = getSelectedInstance().getDeployedEJBModule(resName);
component.disable();
}else if(resType.trim().indexOf(".war") != -1){ // NOI18N
DeployedWebModuleComponentBean component = getSelectedInstance().getDeployedWebModule(resName);
component.disable();
}else{
Reporter.info("####### UNKNOWN Archive Type");//NOI18N
}
}//else
getSelectedInstance().applyChanges();
messenger.setStatusText(java.text.MessageFormat.format(bundle.getString("Msg_FinDisable"), new Object[] {server}) ); //NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, afe.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(server);
}
}//run
}
DisableThread disThread = new DisableThread();
disThread.start();
Reporter.info("---------------------After Disabling Resource"); // NOI18N
while(disThread.isAlive()){
Thread.sleep(500);
}
Reporter.info("---------------------Finished Disabling Resource"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public void | Enable(java.lang.String resName, java.lang.String resType, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String server = this.getName();
try{
Reporter.info("---------------------Enabling Resource"); // NOI18N
class EnableThread extends Thread{
public void run () {
try{
if(resType.trim().indexOf(".ear") != -1){ // NOI18N
DeployedApplicationComponentBean component = getSelectedInstance().getDeployedApplication(resName);
component.enable();
}else{
if(resType.trim().indexOf(".jar") != -1){ // NOI18N
DeployedEJBModuleComponentBean component = getSelectedInstance().getDeployedEJBModule(resName);
component.enable();
}else if(resType.trim().indexOf(".war") != -1){ // NOI18N
DeployedWebModuleComponentBean component = getSelectedInstance().getDeployedWebModule(resName);
component.enable();
}else{
Reporter.info("####### UNKNOWN Archive Type");//NOI18N
}
}//else
getSelectedInstance().applyChanges();
messenger.setStatusText(java.text.MessageFormat.format(bundle.getString("Msg_FinEnable"), new Object[] {server}) ); //NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, afe.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(server);
}
}//run
}
EnableThread enThread = new EnableThread();
enThread.start();
Reporter.info("---------------------After Enabling Resource"); // NOI18N
while(enThread.isAlive()){
Thread.sleep(500);
}
Reporter.info("---------------------Finished Enabling Resource"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public void | OverwriteConfig()
getSelectedInstance().overwriteChanges();
| public static boolean | ServName(java.lang.String value, java.util.List serv, java.lang.String nod_name, com.sun.enterprise.admin.util.HostAndPort hostport, java.lang.String uName, java.lang.String passwd)
boolean exists = false;
value = value + "(" + nod_name + ")";//NOI18N
for(int i=0; i<serv.size(); i++){
IServerInstanceBean instance = (IServerInstanceBean) serv.get(i);
String inst = instance.getName();
if(inst.equals(value))
exists = true;
}//for
Iterator it = ServerInstanceManagerFactory.getFactory().getServerInstanceManager(hostport,uName,passwd).getAllServerInstances();
while (it.hasNext()){
String inst1 = ((AppServerInstance)it.next()).toString();
if(inst1.equals(value))
exists = true;
}
return exists;
| public void | Undeploy(java.lang.String resName, java.lang.String resType, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String server = this.getName();
try{
Reporter.info("---------------------Before Undeploy "); // NOI18N
class UndeployThread extends Thread{
public void run () {
try{
if(resType.trim().indexOf(".ear") != -1){ // NOI18N
getSelectedInstance().undeployApplication(resName);
}else{
if(resType.trim().indexOf(".war") != -1){ // NOI18N
getSelectedInstance().undeployModule(resName, DeploymentConstants.WAR);
}else if(resType.trim().indexOf(".jar") != -1){ // NOI18N
getSelectedInstance().undeployModule(resName, DeploymentConstants.EJB);
}else if(resType.trim().indexOf(".rar") != -1){ // NOI18N
getSelectedInstance().undeployModule(resName, DeploymentConstants.RAR);
}
}//else
getSelectedInstance().applyChanges();
messenger.setStatusText(java.text.MessageFormat.format(bundle.getString("Msg_FinUndeploy"), new Object[] {server}) ); //NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, afe.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(server);
}
}//run
}
UndeployThread undeploy = new UndeployThread();
undeploy.start();
Reporter.info("---------------------After Undeploy"); // NOI18N
while(undeploy.isAlive()){
Thread.sleep(500);
}
Reporter.info("---------------------Finished Undeploy"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public void | addPropertyChangeListener(java.beans.PropertyChangeListener listener)
initPropertyChangeSupport();
propertySupport.addPropertyChangeListener (listener);
| public static com.sun.enterprise.admin.util.HostAndPort | configurInstance(java.lang.String host_name, int port_no)
HostAndPort hp = new HostAndPort(host_name, port_no);
return hp;
| public void | createResource(java.lang.String fname)
getSelectedInstance().createResource(fname);
getSelectedInstance().applyChanges();
//Apply(); // this causes the IDE to hang
| public void | deleteJdbc(java.lang.String resourceName, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String server = this.getName();
try{
Reporter.info("---------------------Before deleting Jdbc"); // NOI18N
class deleteJdbcThread extends Thread{
public void run () {
try{
getSelectedInstance().deleteJDBCResource(resourceName);
}catch(DeploymentException de){
messenger.setNotify(de.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, de.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, afe.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(server);
}
}
}//deleteJDBCThread
deleteJdbcThread delJdbc = new deleteJdbcThread();
delJdbc.start();
Reporter.info("---------------------After deleting Registered Jdbc "); // NOI18N
while(delJdbc.isAlive()){
//wait
}
getSelectedInstance().applyChanges();
Reporter.info("---------------------Finished deleting Registered Jdbc"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public void | deleteResource(java.lang.String resourceName, java.lang.String resType, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String server = this.getName();
try{
Reporter.info("---------------------Before deleting resource"); // NOI18N
class deleteResourceThread extends Thread{
public void run () {
try{
if (resType.equals("JDBC")) // NOI18N
getSelectedInstance().deleteJDBCResource(resourceName);
else if (resType.equals("CP")) // NOI18N
getSelectedInstance().deleteJDBCConnectionPool(resourceName);
else if (resType.equals("JMS")) // NOI18N
getSelectedInstance().deleteJMSResource(resourceName);
else if (resType.equals("PMF")) // NOI18N
getSelectedInstance().deletePersistenceManagerFactoryResource(resourceName);
else if (resType.equals("Mail")) // NOI18N
getSelectedInstance().deleteJavaMailResource(resourceName);
else
Reporter.error(bundle.getString("Err_NoResource"));
}catch(DeploymentException de){
messenger.setNotify(de.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, de.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, afe.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(server);
}
}
}//deleteResourceThread
deleteResourceThread del = new deleteResourceThread();
del.start();
Reporter.info("---------------------After deleting registered resource"); // NOI18N
while(del.isAlive()){
//wait
}
getSelectedInstance().applyChanges();
Reporter.info("---------------------Finished deleting Registered Resource"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public boolean | deployEarFile(java.lang.String earPath, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String path = earPath;
Reporter.info(earPath);
Iterator it = null;
InetAddress IP = null;
boolean deploySuccess = true;
try{
IP = InetAddress.getByName(this.getAdminHost());
Socket s = new Socket (IP, this.getAdminPort());
s.close ();
try{
Reporter.info("Getting App Name");//NOI18N
String appName = path.substring(path.lastIndexOf(File.separator)+1, path.lastIndexOf("."));//NOI18N
boolean exists = false;
Reporter.info(appName);
try{
it = getSelectedInstance().getDeployedApplications();
}catch( AFException e){
throw new DeploymentException(e.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, e.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
throw new AFRuntimeStoreException(afre.getLocalizedMessage());
}
messenger.setProgressMessage(bundle.getString("ExsistingAppCheck"));//NOI18N
messenger.setProgressLevel(30);
while (it.hasNext())
{
depName = it.next().toString();
// System.out.println("Deployed App: " + depName);
if(depName.equalsIgnoreCase(appName)){
exists = true;
break;
}
}
Reporter.info(getSelectedInstance().getDeployedApplication(appName));
if(exists){
Reporter.info("Calling Redeploy");//NOI18N
messenger.setProgressMessage( bundle.getString("RedeployMessage"));//NOI18N
messenger.setProgressLevel(55);
deploySuccess = getSelectedInstance().redeployApplication(path,appName);
}else{
Reporter.info("Calling Deploy");//NOI18N
messenger.setProgressMessage( bundle.getString("DeployMessage"));//NOI18N
messenger.setProgressLevel(55);
deploySuccess = getSelectedInstance().deployApplication(path, appName, true, null, true, false, false);
}
/*
try{
it = getSelectedInstance().getDeployedApplications();
}catch(AFException ex){
throw new DeploymentException(ex.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, ex.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
throw new AFRuntimeStoreException(afre.getLocalizedMessage());
}
*/
messenger.setProgressLevel(90);
/*ludo Why??? try{
Thread.sleep(10000);// remove when status is available from som
}catch (Exception e){
}
**/
messenger.setProgressLevel(100);
}catch(AFTargetNotFoundException te){
throw new DeploymentException(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(DeploymentException de){
throw new DeploymentException(de.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, de.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(this.getName());
}
}catch(java.net.UnknownHostException e){
throw new DeploymentException(e.getLocalizedMessage());
}catch(java.io.IOException con){
throw new DeploymentException(con.getLocalizedMessage());
}
return deploySuccess;
| public boolean | deployEjbJarFile(java.lang.String ejbJarName, java.lang.String ejbjarfilePath, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String path = ejbjarfilePath;
Iterator it = null;
Reporter.info(ejbjarfilePath);
InetAddress IP = null;
boolean deploySuccess = true;
try{
IP = InetAddress.getByName(this.getAdminHost());
Socket s = new Socket (IP, this.getAdminPort());
s.close ();
try{
//String ejbJarName = path.substring(path.lastIndexOf(File.separator)+1, path.lastIndexOf("."));//NOI18N
Reporter.info("EjbJar Name" + ejbJarName);//NOI18N
boolean exists = false;
try{
it = getSelectedInstance().getDeployedEJBModules();
}catch( AFException e){
throw new DeploymentException(e.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, e.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
throw new AFRuntimeStoreException(afre.getLocalizedMessage());
}
messenger.setProgressMessage( bundle.getString("ExsistingModuleCheck"));//NOI18N
messenger.setProgressLevel(30);
while (it.hasNext())
{
depName = it.next().toString();
// System.out.println("Deployed App: " + depName);
if(depName.equalsIgnoreCase(ejbJarName)){
exists = true;
break;
}
}
messenger.setProgressMessage( bundle.getString("DeployEjbJar"));//NOI18N
if(exists){
Reporter.info("Calling Redeploy");//NOI18N
messenger.setProgressMessage( bundle.getString("RedeployModuleMessage")); //NOI18N
messenger.setProgressLevel(55);
deploySuccess = getSelectedInstance().redeployEJBJarModule(path, ejbJarName);
}else{
Reporter.info("Calling Deploy");//NOI18N
messenger.setProgressMessage( bundle.getString("DeployModuleMessage")); //NOI18N
messenger.setProgressLevel(55);
deploySuccess = getSelectedInstance().deployEJBJarModule(path, ejbJarName);
}
messenger.setProgressLevel(90);
/* try{
Thread.sleep(10000);// remove when status is available from som
}catch (Exception e){
Reporter.verbose("Error while waiting for request to be completed");//NOI18N
}*/
messenger.setProgressLevel(100);
}catch(AFTargetNotFoundException te){
throw new DeploymentException(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(DeploymentException de){
throw new DeploymentException(de.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, de.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(this.getName());
}
}catch(java.net.UnknownHostException e){
throw new DeploymentException(e.getLocalizedMessage());
}catch(java.io.IOException con){
throw new DeploymentException(con.getLocalizedMessage());
}
return deploySuccess;
| public boolean | deployRARFile(java.lang.String rarfilePath, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String path = rarfilePath;
Iterator it = null;
Reporter.info(rarfilePath);
InetAddress IP = null;
boolean deploySuccess = true;
try{
IP = InetAddress.getByName(this.getAdminHost());
Socket s = new Socket (IP, this.getAdminPort());
s.close ();
try{
String rarName = path.substring(path.lastIndexOf(File.separator)+1, path.lastIndexOf("."));//NOI18N
Reporter.info("rar Name" + rarName);//NOI18N
boolean exists = false;
try{
it = getSelectedInstance().getDeployedConnectors();
}catch( AFException e){
throw new DeploymentException(e.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, e.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
throw new AFRuntimeStoreException(afre.getLocalizedMessage());
}
if(messenger != null) messenger.setProgressMessage( bundle.getString("ExsistingModuleCheck"));//NOI18N
if(messenger != null) messenger.setProgressLevel(30);
while (it.hasNext())
{
depName = it.next().toString();
// System.out.println("Deployed App: " + depName);
if(depName.equalsIgnoreCase(rarName)){
exists = true;
break;
}
}
if(messenger != null) messenger.setProgressMessage( bundle.getString("DeployRar"));//NOI18N
if(exists){
Reporter.info("Calling Redeploy");//NOI18N
if(messenger != null) messenger.setProgressMessage( bundle.getString("RedeployModuleMessage")); //NOI18N
deploySuccess = getSelectedInstance().redeployConnectorModule(path, rarName);
}else{
Reporter.info("Calling Deploy");//NOI18N
if(messenger != null) messenger.setProgressMessage( bundle.getString("DeployModuleMessage")); //NOI18N
deploySuccess = getSelectedInstance().deployConnectorModule(path, rarName);
}
if(messenger != null) messenger.setProgressLevel(90);
/* try{
Thread.sleep(10000);// remove when status is available from som
}catch (Exception e){
Reporter.verbose("Error while waiting for request to be completed");//NOI18N
}*/
if(messenger != null) messenger.setProgressLevel(100);
}catch(AFTargetNotFoundException te){
throw new DeploymentException(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(DeploymentException de){
throw new DeploymentException(de.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, de.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(this.getName());
}
}catch(java.net.UnknownHostException e){
throw new DeploymentException(e.getLocalizedMessage());
}catch(java.io.IOException con){
throw new DeploymentException(con.getLocalizedMessage());
}
return deploySuccess;
| public boolean | deployWarFile(java.lang.String warPath, java.lang.String waName, java.lang.String contextRoot, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String path = warPath;
Reporter.info("Context Root" + contextRoot + "War Path" + warPath);//NOI18N
Iterator it = null;
InetAddress IP = null;
boolean deploySuccess = true;
try{
IP = InetAddress.getByName(this.getAdminHost());
Socket s = new Socket (IP, this.getAdminPort());
s.close ();
try{
String webAppName = waName; // path.substring(path.lastIndexOf(File.separator)+1, path.lastIndexOf("."));
Reporter.info("webAppName is : " + webAppName);//NOI18N
boolean exists = false;
try{
it = getSelectedInstance().getDeployedWebModules();
}catch( AFException e){
throw new DeploymentException(e.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, e.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
throw new AFRuntimeStoreException(afre.getLocalizedMessage());
}
messenger.setProgressMessage( bundle.getString("ExsistingModuleCheck"));//NOI18N
messenger.setProgressLevel(30);
while (it.hasNext())
{
depName = it.next().toString();
if(depName.equalsIgnoreCase(webAppName)){
exists = true;
break;
}
}
messenger.setProgressMessage( bundle.getString("DeployWar"));//NOI18N
if(exists){
Reporter.info("Calling Redeploy");//NOI18N
messenger.setProgressMessage( bundle.getString("RedeployModuleMessage")); //NOI18N
messenger.setProgressLevel(55);
deploySuccess = getSelectedInstance().redeployWarModule(path, webAppName, contextRoot);
}else{
Reporter.info("Calling Deploy");//NOI18N
messenger.setProgressMessage( bundle.getString("DeployModuleMessage")); //NOI18N
messenger.setProgressLevel(55);
deploySuccess = getSelectedInstance().deployWarModule(path, webAppName, contextRoot, true, null, true, false, false);
}
messenger.setProgressLevel(90);
/*ludo why try{
Thread.sleep(10000);// remove when status is available from som
}catch (Exception e){
Reporter.verbose("Error while waiting for request to be completed");//NOI18N
}*/
messenger.setProgressLevel(100);
}catch(AFTargetNotFoundException te){
throw new DeploymentException(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(DeploymentException de){
throw new DeploymentException(de.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, de.getLocalizedMessage(), bundle.getString ("ErrorDeploying"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
messenger.ConfigXmlChanged(this.getName());
}
}catch(java.net.UnknownHostException e){
throw new DeploymentException(e.getLocalizedMessage());
}catch(java.io.IOException con){
throw new DeploymentException(con.getLocalizedMessage());
}
return deploySuccess;
| public java.lang.String | getAdminHost()
return ad_host;
| public int | getAdminPort()
return ad_port;
| public java.lang.String | getConnectorUrl()
/* Reporter.info("####### getting the URLConnection ####"); // NOI18N
try{
if(!getSelectedInstance().isRunning()){
Reporter.info("####### SLEEPING FOR 10000 seconds ####"); // NOI18N
Thread.sleep(10000);
}
Thread.sleep(10000); //isRunning return true before the server is fully initialize
}catch(Exception e){
e.printStackTrace();
}
Reporter.info("####### getting the URLConnection after sleep ####"); // NOI18N*/
return "http://"+this.getName().substring(this.getName().indexOf("(")+1, this.getName().indexOf(":")+1)+
getPort(); //NOI18N
| public java.lang.String | getDisplayName()
return dispName;
| public java.lang.String | getHost()
return host;
| public int | getJPDAPortNumber()
int p = getSelectedInstance().getServerStatus().getDebugPort();
Reporter.verbose("getJPDAPortNumber() returns " + p); //NOI18N
return p;
| public java.lang.String | getName()Getter for property name.
return name;
| public int | getORBPort()
Integer portObj = (Integer) getSelectedInstance().getORBComponent().getIiopListener("orb-listener-1").getAttribute("port"); //NOI18N
int port = portObj.intValue();
Reporter.verbose("getORBPort() returns " + port); //NOI18N
return port;
| public java.lang.String | getPassword()Getter for property password.
pw_editor = password;
return password;
| public int | getPort()Getter for property port.
return port;
| public java.lang.String | getPrivatePassword()invisible Getter for property password.
String pw = getPassword();
String passw = "";//NOI18N
for(int i=0; i<pw.length(); i++)
passw = passw + "*";//NOI18N
return passw;
| private synchronized com.sun.enterprise.admin.servermodel.AppServerInstance | getSelectedInstance()
if(instance == null){
Reporter.info("Initializing instance");//NOI18N
String host = this.getName().substring(this.getName().indexOf("(")+1, this.getName().indexOf(":"));//NOI18N
int port = Integer.parseInt( this.getName().substring(this.getName().indexOf(":")+1, this.getName().indexOf(")")) );//NOI18N
HostAndPort hostPort = new HostAndPort(host, port);
Reporter.info("getSelectedInstance " + this.getName().substring(0, this.getName().indexOf("(")));//NOI18N
Reporter.info(hostPort);
manager = ServerInstanceManagerFactory.getFactory().getServerInstanceManager(hostPort,userName,password);
Reporter.assertIt(manager);
instance = manager.getServerInstance(this.getName().substring(0, this.getName().indexOf("(")));//NOI18N
Reporter.assertIt(instance);
}
return instance;
| public java.lang.String | getUserName()Getter for property userName.
return userName;
| private void | initEngine()
//if (null == ec) {
// ec = new EngineController(getHost(),Integer.toString(getPort()),getUserName(),
// getPassword(),KSRPCPacket.GXADMIN_ENGTYPE_KJS);
//} // ec is not null
| private void | initPropertyChangeSupport()
if(propertySupport==null)
propertySupport = new PropertyChangeSupport ( this );
| public boolean | isEnabled(java.lang.String resName, java.lang.String resType, com.sun.enterprise.tools.common.ui.UIMessenger messenger)
final String server = this.getName();
Reporter.info("---------------------Before checking if resource is enabled"); // NOI18N
try{
if(resType.trim().indexOf(".ear") != -1){ // NOI18N
DeployedApplicationComponentBean component = getSelectedInstance().getDeployedApplication(resName);
isEnabled = component.isEnabled();
}else{
if(resType.trim().indexOf(".war") != -1){ // NOI18N
DeployedWebModuleComponentBean component = getSelectedInstance().getDeployedWebModule(resName);
isEnabled = component.isEnabled();
}else if(resType.trim().indexOf(".jar") != -1){ // NOI18N
DeployedEJBModuleComponentBean component = getSelectedInstance().getDeployedEJBModule(resName);
isEnabled = component.isEnabled();
}
}//else
//messenger.setStatusText(java.text.MessageFormat.format(bundle.getString("Msg_Applyed"), new Object[] {server}) );
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, afe.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}catch(AFRuntimeStoreException afre){
//messenger.ConfigXmlChanged(server);
}
Reporter.info("---------------------Finished checking if resource is enabled"); // NOI18N
return isEnabled;
| public boolean | isLocal()
try{
String host=InetAddress.getLocalHost().getHostName();
return host.equals (getHost());
}
catch(java.net.UnknownHostException e){
throw new DeploymentException(e.getLocalizedMessage());
//JOptionPane.showMessageDialog(null, e.getLocalizedMessage(), bundle.getString ("Error"), JOptionPane.ERROR_MESSAGE);//NOI18N
}
| public boolean | isRunning()
instRunning = false;
instRunning = getSelectedInstance().isRunning();
return instRunning;
| public boolean | isUp()
if (checkAlreadyDone==true)
return IAS_Running;
//IAS_Running = ServerAccess.isKASAlive(getPort(), 1);
checkAlreadyDone = true;
Timer aTimer = new Timer();
TimerTask task = new TimerTask(){
public void run() {
synchronized (this) {
checkAlreadyDone = false;
}
}
};
aTimer.schedule(task,2000);
return IAS_Running;
| public void | registerDatasource(java.lang.String xmlFile)
//IASDeployer iasDeployer = new IASDeployer();
//iasDeployer.registerDatasource(this, xmlFile);
| public void | removeEngineController()
//if (null != ec) {
// ec.disconnect();
// ec =null;
// }
| public void | removePropertyChangeListener(java.beans.PropertyChangeListener listener)
initPropertyChangeSupport();
propertySupport.removePropertyChangeListener (listener);
| public void | restart()
try{
Reporter.info("---------------------RESTART"); // NOI18N
class RestartThread extends Thread{
public void run () {
try{
getSelectedInstance().restart();
Reporter.info("---------------------AFTER RESTART-------------"); // NOI18N
}catch(AFTargetNotFoundException te){
//JOptionPane.showMessageDialog(null, bundle.getString ("Err_NoTarget"), bundle.getString ("Err_RestartServer"), JOptionPane.ERROR_MESSAGE);//NOI18N
te.printStackTrace();
}catch(DeploymentException de){
//JOptionPane.showMessageDialog(null, de.getLocalizedMessage(), bundle.getString ("Err_RestartServer"), JOptionPane.ERROR_MESSAGE);//NOI18N
de.printStackTrace();
}catch(ControlException ce){
//JOptionPane.showMessageDialog(null, ce.getLocalizedMessage(), bundle.getString ("Err_RestartServer"), JOptionPane.ERROR_MESSAGE);//NOI18N
ce.printStackTrace();
}catch(AFException afe){
//JOptionPane.showMessageDialog(null, afe.getLocalizedMessage(), bundle.getString ("Err_RestartServer"), JOptionPane.ERROR_MESSAGE);//NOI18N
afe.printStackTrace();
}
}
}
RestartThread restart = new RestartThread();
restart.start();
//Thread.sleep(5000);
//while(restart.isAlive()){
//wait
//}
Reporter.info("---------------------Ready after restart"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public void | setAdminHost(java.lang.String value)
String oldValue = ad_host;
ad_host = value;
initPropertyChangeSupport();
propertySupport.firePropertyChange ("ad_host", oldValue, ad_host);//NOI18N
| public void | setAdminPort(int value)
int oldValue = ad_port;
ad_port = value;
initPropertyChangeSupport();
propertySupport.firePropertyChange ("ad_port", oldValue, ad_port);//NOI18N
| public void | setDisplayName(java.lang.String value)Setter for property name.
String oldValue = dispName;
dispName = value;
initPropertyChangeSupport();
propertySupport.firePropertyChange ("displayname", oldValue, dispName);//NOI18N
//ServerInstanceManager.getInstance().getServerInstance(name); needs to be setServerInstanceName()
| public void | setHost(java.lang.String value)
String oldValue = host;
host = value;
initPropertyChangeSupport();
propertySupport.firePropertyChange ("host", oldValue, host);//NOI18N
| public void | setName(java.lang.String value)Setter for property name.
String oldValue = name;
name = value;
initPropertyChangeSupport();
propertySupport.firePropertyChange ("name", oldValue, name);//NOI18N
//ServerInstanceManager.getInstance().getServerInstance(name); needs to be setServerInstanceName()
| public void | setPassword(java.lang.String value)Setter for property password.
String oldValue = host;
password = value;
initPropertyChangeSupport();
propertySupport.firePropertyChange ("password", oldValue, password);//NOI18N
| public void | setPort(int value)Setter for property port.
Reporter.info("Setting Server Port to " + value);//NOI18N
String oldValue = host;
port = value;
initPropertyChangeSupport();
propertySupport.firePropertyChange ("port", null, null);//NOI18N
| public void | setUserName(java.lang.String value)Setter for property userName.
String oldValue = host;
userName = value;
initPropertyChangeSupport();
propertySupport.firePropertyChange ("userName", oldValue, userName);//NOI18N
| public int | startInDebugMode(com.sun.enterprise.tools.common.ui.UIMessenger messenger)
debugPort = -1;
try{
Reporter.info("---------------------STARTANYKJS"); // NOI18N
class StartDebugThread extends Thread{
public void run() {
try{
if(!getSelectedInstance().isRunning()){
debugPort = getSelectedInstance().startInDebugMode();
}
Reporter.info("---------------------AFTER START-------------"); // NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
}catch(DeploymentException de){
messenger.setNotify(de.getLocalizedMessage());
}catch(InstanceAlreadyRunningException iare){
messenger.setNotify(iare.getLocalizedMessage());
}catch(ControlException ce){
messenger.setNotify(ce.getLocalizedMessage());
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
}
}
}
StartDebugThread debug_server = new StartDebugThread();
debug_server.start();
Thread.sleep(500);
while(debug_server.isAlive()){
Thread.sleep(1000);
}
Reporter.info("---------------------Ready after start"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
return debugPort;
| public int | startInDebugMode()
debugPort = -1;
Reporter.info("---------------------STARTANYKJS"); // NOI18N
if(!getSelectedInstance().isRunning()){
debugPort = getSelectedInstance().startInDebugMode();
}
Reporter.info("---------------------AFTER START-------------"); // NOI18N
return debugPort;
| public void | startInstance(com.sun.enterprise.tools.common.ui.UIMessenger messenger)
try{
Reporter.info("---------------------STARTANYKJS"); // NOI18N
class StartThread extends Thread{
public void run () {
try{
if(!getSelectedInstance().isRunning()){
getSelectedInstance().start();
}
Reporter.info("---------------------AFTER START-------------"); // NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
}catch(DeploymentException de){
messenger.setNotify(de.getLocalizedMessage());
}catch(InstanceAlreadyRunningException iare){
messenger.setNotify(iare.getLocalizedMessage());
}catch(ControlException ce){
messenger.setNotify(ce.getLocalizedMessage());
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
}
}
}
StartThread start_server = new StartThread();
start_server.start();
// Thread.sleep(500);
while(start_server.isAlive()){
Thread.sleep(1000);
}
Reporter.info("---------------------Ready after start"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public boolean | startInstance()
Reporter.info("---------------------STARTANYKJS"); // NOI18N
boolean status = false;
if(!getSelectedInstance().isRunning()){
status = getSelectedInstance().start();
}
Reporter.info("---------------------AFTER START-------------"); // NOI18N
return status;
// messenger.setErrorMsg(bundle.getString ("Err_NoTarget"), bundle.getString ("Err_StartServer"));* //NOI18N
| public void | stopInstance(com.sun.enterprise.tools.common.ui.UIMessenger messenger)
try{
Reporter.info("---------------------stopInstance"); // NOI18N
class StopThread extends Thread{
public void run () {
try{
if(getSelectedInstance().isRunning()){
getSelectedInstance().stop();
}
Reporter.info("---------------------AFTER STOP-------------"); // NOI18N
}catch(AFTargetNotFoundException te){
messenger.setNotify(te.getLocalizedMessage());
}catch(DeploymentException de){
messenger.setNotify(de.getLocalizedMessage());
}catch(InstanceNotRunningException inre){
messenger.setNotify(inre.getLocalizedMessage());
}catch(ControlException ce){
messenger.setNotify(ce.getLocalizedMessage());
}catch(AFException afe){
messenger.setNotify(afe.getLocalizedMessage());
}
}
}
StopThread stop_server = new StopThread();
stop_server.start();
Thread.sleep(500);
while(stop_server.isAlive()){
Thread.sleep(1000);
}
Reporter.info("---------------------After stop server"); // NOI18N
}catch(Exception e){
e.printStackTrace();
}
| public boolean | stopInstance()
Reporter.info("---------------------STARTANYKJS"); // NOI18N
boolean status = false;
if(getSelectedInstance().isRunning())
status = getSelectedInstance().stop();
Reporter.info("---------------------AFTER START-------------"); // NOI18N
return status;
| public void | useManualConfig()
getSelectedInstance().useManualChanges();
|
|