Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.openejb.webadmin.clienttools;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.ejb.Stateless;
import javax.ejb.RemoteHome;
import org.apache.openejb.webadmin.HttpRequest;
import org.apache.openejb.webadmin.HttpResponse;
import org.apache.openejb.webadmin.HttpSession;
import org.apache.openejb.webadmin.WebAdminBean;
import org.apache.openejb.webadmin.HttpHome;
import org.apache.openejb.assembler.classic.ContainerInfo;
import org.apache.openejb.assembler.classic.EnterpriseBeanInfo;
import org.apache.openejb.config.ConfigurationFactory;
import org.apache.openejb.core.CoreDeploymentInfo;
import org.apache.openejb.assembler.classic.ContainerInfo;
import org.apache.openejb.assembler.classic.EnterpriseBeanInfo;
import org.apache.openejb.assembler.classic.OpenEjbConfiguration;
import org.apache.openejb.assembler.classic.AppInfo;
import org.apache.openejb.assembler.classic.EjbJarInfo;
import org.apache.openejb.config.ConfigurationFactory;
import org.apache.openejb.loader.SystemInstance;
import org.apache.openejb.spi.ContainerSystem;
import org.apache.openejb.DeploymentInfo;
import org.apache.openejb.BeanType;
/**
* @author David Blevins
*/
@Stateless(name = "ClientTools/ViewEjb")
@RemoteHome(HttpHome.class)
public class ViewEjbBean extends WebAdminBean implements Constants {
public void preProcess(HttpRequest request, HttpResponse response)
throws IOException {
}
public void postProcess(HttpRequest request, HttpResponse response)
throws IOException {
}
public void writeHtmlTitle(PrintWriter out) throws IOException {
out.write("Client Tools -- EJB Viewer");
}
public void writePageTitle(PrintWriter out) throws IOException {
out.write("EJB Viewer");
}
public void writeBody(PrintWriter out) throws IOException {
try {
String ejb = request.getQueryParameter("ejb");
if (ejb == null) {
OpenEjbConfiguration configuration = SystemInstance.get().getComponent(OpenEjbConfiguration.class);
for (AppInfo appInfo : configuration.containerSystem.applications) {
for (EjbJarInfo ejbJarInfo : appInfo.ejbJars) {
for (EnterpriseBeanInfo bean : ejbJarInfo.enterpriseBeans) {
out.print(""+ejbImg+" "+bean.ejbDeploymentId+" ");
}
}
}
} else {
printEjb(ejb, out, request.getSession());
}
} catch (Exception e) {
out.println("FAIL: ");
out.print(e.getMessage());
// throw e;
//return;
}
}
public void printEjb(String name, PrintWriter out, HttpSession session)
throws Exception {
SystemInstance system = SystemInstance.get();
ContainerSystem containerSystem = system.getComponent(ContainerSystem.class);
String id = (name.startsWith("/")) ? name.substring(1, name.length()) : name;
org.apache.openejb.DeploymentInfo ejb = containerSystem.getDeploymentInfo(id);
if (ejb == null) {
out.print("No such EJB: " + id);
return;
}
String type = null;
switch (ejb.getComponentType()) {
case CMP_ENTITY :
type = "EntityBean with Container-Managed Persistence";
break;
case BMP_ENTITY :
type = "EntityBean with Bean-Managed Persistence";
break;
case STATEFUL :
type = "Stateful SessionBean";
break;
case STATELESS :
type = "Stateless SessionBean";
break;
case SINGLETON:
type = "Singleton SessionBean";
break;
case MANAGED:
type = "Managed SessionBean";
break;
default :
type = "Unkown Bean Type";
break;
}
out.print("" + type + " ");
out.print("