Author: chris.laprun(a)jboss.com
Date: 2009-04-23 12:49:20 -0400 (Thu, 23 Apr 2009)
New Revision: 13266
Added:
modules/jopr-plugin/
modules/jopr-plugin/trunk/
modules/jopr-plugin/trunk/build/
modules/jopr-plugin/trunk/build/licences/
modules/jopr-plugin/trunk/build/licences/JBossEULA.txt
modules/jopr-plugin/trunk/build/misc/
modules/jopr-plugin/trunk/build/misc/codeguide.html
modules/jopr-plugin/trunk/build/pom.xml
modules/jopr-plugin/trunk/plugin/
modules/jopr-plugin/trunk/plugin/pom.xml
modules/jopr-plugin/trunk/plugin/src/
modules/jopr-plugin/trunk/plugin/src/main/
modules/jopr-plugin/trunk/plugin/src/main/assemble/
modules/jopr-plugin/trunk/plugin/src/main/assemble/portal-management-sar.xml
modules/jopr-plugin/trunk/plugin/src/main/java/
modules/jopr-plugin/trunk/plugin/src/main/java/org/
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalDiscovery.java
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalEventPoller.java
modules/jopr-plugin/trunk/plugin/src/main/resources/
modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/
modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
modules/jopr-plugin/trunk/pom.xml
modules/jopr-plugin/trunk/portal-management-service/
modules/jopr-plugin/trunk/portal-management-service/pom.xml
modules/jopr-plugin/trunk/portal-management-service/src/
modules/jopr-plugin/trunk/portal-management-service/src/main/
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml
modules/jopr-plugin/trunk/portal-management/
modules/jopr-plugin/trunk/portal-management/pom.xml
modules/jopr-plugin/trunk/portal-management/src/
modules/jopr-plugin/trunk/portal-management/src/main/
modules/jopr-plugin/trunk/portal-management/src/main/java/
modules/jopr-plugin/trunk/portal-management/src/main/java/org/
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/Portal.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/WSRPPortletManagement.java
Log:
Initial import of JOPR plugin. Still needs a lot of work but the project is setup now.
Added: modules/jopr-plugin/trunk/build/licences/JBossEULA.txt
===================================================================
--- modules/jopr-plugin/trunk/build/licences/JBossEULA.txt (rev
0)
+++ modules/jopr-plugin/trunk/build/licences/JBossEULA.txt 2009-04-23 16:49:20 UTC (rev
13266)
@@ -0,0 +1,106 @@
+LICENSE AGREEMENT
+JBOSS(r)
+
+This License Agreement governs the use of the Software Packages and any updates to the
Software
+Packages, regardless of the delivery mechanism. Each Software Package is a collective
work
+under U.S. Copyright Law. Subject to the following terms, Red Hat, Inc. ("Red
Hat") grants to
+the user ("Client") a license to the applicable collective work(s) pursuant to
the
+GNU Lesser General Public License v. 2.1 except for the following Software Packages:
+(a) JBoss Portal Forums and JBoss Transactions JTS, each of which is licensed pursuant to
the
+GNU General Public License v.2;
+
+(b) JBoss Rules, which is licensed pursuant to the Apache License v.2.0;
+
+(c) an optional download for JBoss Cache for the Berkeley DB for Java database, which is
licensed under the
+(open source) Sleepycat License (if Client does not wish to use the open source version
of this database,
+it may purchase a license from Sleepycat Software);
+
+and (d) the BPEL extension for JBoss jBPM, which is licensed under the Common Public
License v.1,
+and, pursuant to the OASIS BPEL4WS standard, requires parties wishing to redistribute to
enter various
+royalty-free patent licenses.
+
+Each of the foregoing licenses is available at
http://www.opensource.org/licenses/index.php.
+
+1. The Software. "Software Packages" refer to the various software modules
that are created and made available
+for distribution by the
JBoss.org open source community at
http://www.jboss.org. Each
of the Software Packages
+may be comprised of hundreds of software components. The end user license agreement for
each component is located in
+the component's source code. With the exception of certain image files identified in
Section 2 below,
+the license terms for the components permit Client to copy, modify, and redistribute the
component,
+in both source code and binary code forms. This agreement does not limit Client's
rights under,
+or grant Client rights that supersede, the license terms of any particular component.
+
+2. Intellectual Property Rights. The Software Packages are owned by Red Hat and others
and are protected under copyright
+and other laws. Title to the Software Packages and any component, or to any copy,
modification, or merged portion shall
+remain with the aforementioned, subject to the applicable license. The "JBoss"
trademark, "Red Hat" trademark, the
+individual Software Package trademarks, and the "Shadowman" logo are registered
trademarks of Red Hat and its affiliates
+in the U.S. and other countries. This agreement permits Client to distribute unmodified
copies of the Software Packages
+using the Red Hat trademarks that Red Hat has inserted in the Software Packages on the
condition that Client follows Red Hat's
+trademark guidelines for those trademarks located at
http://www.redhat.com/about/corporate/trademark/. Client must abide by
+these trademark guidelines when distributing the Software Packages, regardless of whether
the Software Packages have been modified.
+If Client modifies the Software Packages, then Client must replace all Red Hat trademarks
and logos identified at
+http://www.jboss.com/company/logos, unless a separate agreement with Red Hat is executed
or other permission granted.
+Merely deleting the files containing the Red Hat trademarks may corrupt the Software
Packages.
+
+3. Limited Warranty. Except as specifically stated in this Paragraph 3 or a license for
a particular
+component, to the maximum extent permitted under applicable law, the Software Packages
and the
+components are provided and licensed "as is" without warranty of any kind,
expressed or implied,
+including the implied warranties of merchantability, non-infringement or fitness for a
particular purpose.
+Red Hat warrants that the media on which Software Packages may be furnished will be free
from defects in
+materials and manufacture under normal use for a period of 30 days from the date of
delivery to Client.
+Red Hat does not warrant that the functions contained in the Software Packages will meet
Client's requirements
+or that the operation of the Software Packages will be entirely error free or appear
precisely as described
+in the accompanying documentation. This warranty extends only to the party that purchases
the Services
+pertaining to the Software Packages from Red Hat or a Red Hat authorized distributor.
+
+4. Limitation of Remedies and Liability. To the maximum extent permitted by applicable
law, the remedies
+described below are accepted by Client as its only remedies. Red Hat's entire
liability, and Client's
+exclusive remedies, shall be: If the Software media is defective, Client may return it
within 30 days of
+delivery along with a copy of Client's payment receipt and Red Hat, at its option,
will replace it or
+refund the money paid by Client for the Software. To the maximum extent permitted by
applicable law,
+Red Hat or any Red Hat authorized dealer will not be liable to Client for any incidental
or consequential
+damages, including lost profits or lost savings arising out of the use or inability to
use the Software,
+even if Red Hat or such dealer has been advised of the possibility of such damages. In
no event shall
+Red Hat's liability under this agreement exceed the amount that Client paid to Red
Hat under this
+Agreement during the twelve months preceding the action.
+
+5. Export Control. As required by U.S. law, Client represents and warrants that it:
+(a) understands that the Software Packages are subject to export controls under the
+U.S. Commerce Department's Export Administration Regulations ("EAR");
+
+(b) is not located in a prohibited destination country under the EAR or U.S. sanctions
regulations
+(currently Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria);
+
+(c) will not export, re-export, or transfer the Software Packages to any prohibited
destination, entity,
+or individual without the necessary export license(s) or authorizations(s) from the U.S.
Government;
+
+(d) will not use or transfer the Software Packages for use in any sensitive nuclear,
chemical or
+biological weapons, or missile technology end-uses unless authorized by the U.S.
Government by
+regulation or specific license;
+
+(e) understands and agrees that if it is in the United States and exports or transfers
the Software
+Packages to eligible end users, it will, as required by EAR Section 740.17(e), submit
semi-annual
+reports to the Commerce Department's Bureau of Industry & Security (BIS), which
include the name and
+address (including country) of each transferee;
+
+and (f) understands that countries other than the United States may restrict the import,
use, or
+export of encryption products and that it shall be solely responsible for compliance with
any such
+import, use, or export restrictions.
+
+6. Third Party Programs. Red Hat may distribute third party software programs with the
Software Packages
+that are not part of the Software Packages and which Client must install separately.
These third party
+programs are subject to their own license terms. The license terms either accompany the
programs or
+can be viewed at
http://www.redhat.com/licenses/. If Client does not agree to abide by
the applicable
+license terms for such programs, then Client may not install them. If Client wishes to
install the programs
+on more than one system or transfer the programs to another party, then Client must
contact the licensor
+of the programs.
+
+7. General. If any provision of this agreement is held to be unenforceable, that shall
not affect the
+enforceability of the remaining provisions. This License Agreement shall be governed by
the laws of the
+State of North Carolina and of the United States, without regard to any conflict of laws
provisions,
+except that the United Nations Convention on the International Sale of Goods shall not
apply.
+
+Copyright 2006 Red Hat, Inc. All rights reserved.
+"JBoss" and the JBoss logo are registered trademarks of Red Hat, Inc.
+All other trademarks are the property of their respective owners.
+
+ Page 1 of 1 18 October 2006
Added: modules/jopr-plugin/trunk/build/misc/codeguide.html
===================================================================
--- modules/jopr-plugin/trunk/build/misc/codeguide.html (rev 0)
+++ modules/jopr-plugin/trunk/build/misc/codeguide.html 2009-04-23 16:49:20 UTC (rev
13266)
@@ -0,0 +1,133 @@
+<html>
+
+<head>
+<style type="text/css">
+pre { border-style:solid; border-width:thin; padding:5px; background-color:#EEEEFF;}
+span.bad { text-decoration:line-through; }
+span.important { font-weight:bold; color:red; }
+</style>
+</head>
+
+<body>
+
+<h2>Coding Conventions</h2>
+
+<h3>Some more general guidelines</h3>
+<ul>
+<li>Fully qualified imports should be used, rather than importing
x.y.*.</li>
+<li>Use newlines for opening braces, so that the top and bottom braces can be
visually matched.</li>
+<li>Aid visual separation of logical steps by introducing newlines and appropriate
comments above them.</li>
+</ul>
+
+
+<h3>A class that conforms to JBoss coding guidelines</h3>
+
+<pre>
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2007, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 (at your option) any later version. *
+ * *
+ * This software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package x;
+
+// <span class="important">Explicit imports</span>
+import a.b.C1; // <span class="important">good</span>
+import a.b.C2;
+import a.b.C3;
+
+// <span class="important">Do not write</span>
+<span class="bad">import a.b.*;</span> // <span
class="important">bad</span>
+
+// <span class="important">DO NOT USE "TAB" TO INDENT CODE USE
*3* SPACES FOR PORTABILITY AMONG EDITORS</span>
+
+/**
+ * A description of this class.
+ *
+ * @see SomeRelatedClass.
+ *
+ * @version <tt>$Revision: 7755 $</tt>
+ * @author <a href="mailto:{email}">{full
name}</a>
+ */
+public class X
+ extends Y
+ implements Z
+{
+ public void startService() throws Exception
+ {
+ // Use the newline for the opening bracket so we can match top
+ // and bottom bracket visually
+
+ Class cls = Class.forName(dataSourceClass);
+ vendorSource = (XADataSource)cls.newInstance();
+
+ // Jump a line between logically distinct <span
class="important">steps</span> and add<
+ // line of comment to it
+ cls = vendorSource.getClass();
+
+ // Comment lines <span class="important">always</span> start
with an uppercase
+ // except if it is the second line
+ if(properties != null)
+ {
+
+ try
+ {
+ }
+ catch (IOException ioe)
+ {
+ }
+ for (Iterator i = props.entrySet().iterator(); i.hasNext();)
+ {
+
+ // Get the name and value for the attributes
+ Map.Entry entry = (Map.Entry) i.next();
+ String attributeName = (String) entry.getKey();
+ String attributeValue = (String) entry.getValue();
+
+ // Print the debug message
+ log.debug("Setting attribute '" + attributeName + "'
to '" + attributeValue + "'");
+
+ // get the attribute
+ Method setAttribute =
+ cls.getMethod("set" + attributeName, new Class[] { String.class
});
+
+ // And set the value
+ setAttribute.invoke(vendorSource, new Object[] { attributeValue });
+ }
+ }
+
+ <span class="bad">// this is a <span
class="important">bad</span> comment line because it starts with a
lower case</span>
+ vendorSource.getXAConnection().close();
+
+ // Bind in JNDI
+ bind(new InitialContext(), "java:/"+getPoolName(),
+ new Reference(vendorSource.getClass().getName(),
+ getClass().getName(), null));
+
+ // Block must always be delimited explicitely
+ if (0 == 0)
+ <span class="important">{</span>
+ System.out.println(true);
+ <span class="important">}</span>
+
+ }
+}
+</pre>
+</body>
+</html>
Property changes on: modules/jopr-plugin/trunk/build/misc/codeguide.html
___________________________________________________________________
Name: svn:executable
+ *
Added: modules/jopr-plugin/trunk/build/pom.xml
===================================================================
--- modules/jopr-plugin/trunk/build/pom.xml (rev 0)
+++ modules/jopr-plugin/trunk/build/pom.xml 2009-04-23 16:49:20 UTC (rev 13266)
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ This pom functions as a default configuration. The subproject
+ poms each inherit configuration from this one.
+
+ When adding version information for an artifact please do the following
+ - add a version property for the specific version
+ - add a dependency in the dependencyManagement section which refers to
+ the property
+-->
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal</groupId>
+ <artifactId>jboss-portal-parent</artifactId>
+ <version>1.0.0</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.jopr</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <name>JBoss Portal JOPR Plugin Parent</name>
+ <description>JBoss Portal JOPR Plugin</description>
+
+ <!--All artifacts versions should be defined here-->
+ <properties>
+ <version.commons.logging>1.1</version.commons.logging>
+ <version.rhq>1.2.0.Beta1</version.rhq>
+ <version.portal>2.7.1.GA</version.portal>
+ <version.portlet>trunk-SNAPSHOT</version.portlet>
+ <version.jboss>4.2.3.GA</version.jboss>
+ </properties>
+
+
+ <!--JBoss reporitories to be able to grab jboss-portal-parent pom-->
+ <repositories>
+ <repository>
+ <id>repository.jboss.org</id>
+ <name>JBoss Repository</name>
+ <layout>default</layout>
+ <
url>http://repository.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ <repository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshots Repository</name>
+ <layout>default</layout>
+ <
url>http://snapshots.jboss.org/maven2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+
+ <!--Sample additional plugin repository. This one is not needed if you don't
use maven-antrun-extended-plugin
+ (used in module-c)-->
+ <pluginRepositories>
+ <pluginRepository>
+ <
id>java.net maven repository</id>
+ <
url>http://download.java.net/maven/2/</url>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <dependencyManagement>
+ <!-- The parent pom manages the inter-dependencies of the modules. -->
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${version.commons.logging}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${version.rhq}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ <version>${version.rhq}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-native-system</artifactId>
+ <version>${version.rhq}</version>
+ </dependency>
+
+ <!-- add your dependencies here -->
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>core</artifactId>
+ <version>${version.portal}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>jems</artifactId>
+ <version>${version.portal}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>server</artifactId>
+ <version>${version.portal}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-management</artifactId>
+ <version>${version.portlet}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-federation</artifactId>
+ <version>${version.portlet}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system</artifactId>
+ <version>${version.jboss}</version>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
+ <version>${version.jboss}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+</project>
Added: modules/jopr-plugin/trunk/plugin/pom.xml
===================================================================
--- modules/jopr-plugin/trunk/plugin/pom.xml (rev 0)
+++ modules/jopr-plugin/trunk/plugin/pom.xml 2009-04-23 16:49:20 UTC (rev 13266)
@@ -0,0 +1,70 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.jopr</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>plugin</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal JOPR Plugin</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-native-system</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>jems</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.jopr</groupId>
+ <artifactId>portal-management</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- won't compile otherwise due to reliance of JOPR plugin API on
hibernate/JPA annotations -->
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-annotations</artifactId>
+ <version>3.3.1.GA</version>
+ </dependency>
+
+ </dependencies>
+
+ <!--<build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>-->
+
+</project>
\ No newline at end of file
Added: modules/jopr-plugin/trunk/plugin/src/main/assemble/portal-management-sar.xml
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/assemble/portal-management-sar.xml
(rev 0)
+++
modules/jopr-plugin/trunk/plugin/src/main/assemble/portal-management-sar.xml 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,58 @@
+<assembly>
+ <id>server</id>
+ <formats>
+ <format>war</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+
+ <fileSet>
+ <file>src/main/resources/META-INF/jboss-service.xml</file>
+ <outputDirectory></outputDirectory>
+ </fileSet>
+
+ <fileSet>
+ <directory>target/classes</directory>
+ <outputDirectory>WEB-INF/classes</outputDirectory>
+ </fileSet>
+
+ </fileSets>
+
+ <!--<dependencySets>
+
+
+ <dependencySet>
+ <outputDirectory>WEB-INF/lib</outputDirectory>
+ <includes>
+
+ <include>org.jboss.portal.common:common-common</include>
+ <include>org.jboss.portal.common:common-portal</include>
+ <include>org.jboss.portal.common:common-mc</include>
+ <include>org.jboss.portal.web:web-web</include>
+ <include>org.jboss.portal.portlet:portlet-portlet</include>
+ <include>org.jboss.portal.portlet:portlet-controller</include>
+ <include>org.jboss.portal.portlet:portlet-mc</include>
+ <include>org.jboss.portal.portlet:portlet-samples</include>
+
<include>org.jboss.portal.presentation:presentation-presentation</include>
+
+
<include>org.jboss.portal.presentation:presentation-classic</include>
+
+ <include>org.jboss.portal.presentation:presentation-ajax</include
>
+ <include>com.google.gwt:gwt-servlet</include>
+
+ <include>javax.ccpp:ccpp</include>
+ <include>javax.portlet:portlet-api</include>
+
+ <include>org.jboss:jboss-common-core</include>
+ <include>org.jboss.microcontainer:jboss-kernel</include>
+ <include>org.jboss.microcontainer:jboss-dependency</include>
+ <include>org.jboss:jboss-reflect</include>
+ <include>org.jboss:jboss-mdr</include>
+ <include>org.jboss:jbossxb</include>
+
+ </includes>
+ </dependencySet>
+ </dependencySets>-->
+
+</assembly>
Added:
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java
===================================================================
---
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java
(rev 0)
+++
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalComponent.java 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,237 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 (at your option) any later version. *
+ * *
+ * This software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.jopr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jboss.portal.jems.as.JMX;
+import org.jboss.portal.server.Server;
+import org.jboss.portal.management.Portal;
+import org.jboss.mx.util.MBeanServerLocator;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.event.EventContext;
+import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationContext;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+
+import javax.management.ObjectName;
+import javax.management.MalformedObjectNameException;
+import javax.management.MBeanServer;
+import java.util.Set;
+
+
+public class PortalComponent implements ResourceComponent, MeasurementFacet,
OperationFacet, ConfigurationFacet,
+ CreateChildResourceFacet, DeleteResourceFacet
+{
+ private final Log log = LogFactory.getLog(this.getClass());
+
+ private static final int CHANGEME = 1; // TODO remove or change this
+
+
+ public static final String DUMMY_EVENT = "portal-jopr-pluginDummyEvent"; //
Same as in Plugin-Descriptor
+
+ EventContext eventContext;
+
+ private static final String PORTAL_SERVICE_SERVER =
"portal:service=Server";
+ private Server portalServer;
+
+ private static final String PORTAL_MANAGEMENT_SERVICE =
"portal.management:service=Management,type=Portal,name=Default";
+ private Portal portal;
+
+
+ /**
+ * Return availability of this resource
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
+ */
+ public AvailabilityType getAvailability()
+ {
+ return isRegistered(PORTAL_SERVICE_SERVER) ? AvailabilityType.UP :
AvailabilityType.DOWN;
+ }
+
+
+ /**
+ * Start the resource connection
+ *
+ * @see
org.rhq.core.pluginapi.inventory.ResourceComponent#start(org.rhq.core.pluginapi.inventory.ResourceContext)
+ */
+ public void start(ResourceContext context) throws InvalidPluginConfigurationException,
Exception
+ {
+
+ Configuration conf = context.getPluginConfiguration();
+
+ portalServer = (Server) JMX.getMBeanProxy(Server.class, PORTAL_SERVICE_SERVER);
+
+ portal = (Portal) JMX.getMBeanProxy(Portal.class, PORTAL_MANAGEMENT_SERVICE);
+
+ eventContext = context.getEventContext();
+ PortalEventPoller eventPoller = new PortalEventPoller();
+ eventContext.registerEventPoller(eventPoller, 60);
+
+ }
+
+
+ /**
+ * Tear down the rescource connection
+ *
+ * @see org.rhq.core.pluginapi.inventory.ResourceComponent#stop()
+ */
+ public void stop()
+ {
+
+
+ eventContext.unregisterEventPoller(DUMMY_EVENT);
+ }
+
+
+ /**
+ * Gather measurement data
+ *
+ * @see
org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport,
+ * java.util.Set)
+ */
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
metrics) throws Exception
+ {
+
+ for (MeasurementScheduleRequest req : metrics)
+ {
+ if (req.getName().equals("portletNumber"))
+ {
+ MeasurementDataNumeric res = new MeasurementDataNumeric(req,
Double.valueOf(CHANGEME));
+ report.addData(res);
+ }
+ // TODO add more metrics here
+ }
+ }
+
+
+ public void startOperationFacet(OperationContext context)
+ {
+
+ }
+
+
+ /**
+ * Invokes the passed operation on the managed resource
+ *
+ * @param name Name of the operation
+ * @param params The method parameters
+ * @returns An operation result
+ */
+ public OperationResult invokeOperation(String name, Configuration params) throws
Exception
+ {
+
+ OperationResult res = new OperationResult();
+ if ("dummyOperation".equals(name))
+ {
+ // TODO implement me
+
+ }
+ return res;
+ }
+
+
+ /**
+ * Load the configuration from a resource into the configuration
+ *
+ * @return The configuration of the resource
+ * @see org.rhq.core.pluginapi.configuration.ConfigurationFacet
+ */
+ public Configuration loadResourceConfiguration()
+ {
+ // TODO supply code to load the configuration from the resource into the plugin
+ return null;
+ }
+
+ /**
+ * Write down the passed configuration into the resource
+ *
+ * @param report The configuration updated by the server
+ * @see org.rhq.core.pluginapi.configuration.ConfigurationFacet
+ */
+ public void updateResourceConfiguration(ConfigurationUpdateReport report)
+ {
+ // TODO supply code to update the passed report into the resource
+ }
+
+ /**
+ * Create a child resource
+ *
+ * @see org.rhq.core.pluginapi.inventory.CreateChildResourceFacet
+ */
+ public CreateResourceReport createResource(CreateResourceReport report)
+ {
+ // TODO supply code to create a child resource
+
+ return null; // TODO change this
+ }
+
+ /**
+ * Delete a child resource
+ *
+ * @see org.rhq.core.pluginapi.inventory.DeleteResourceFacet
+ */
+ public void deleteResource() throws Exception
+ {
+ // TODO supply code to delete a child resource
+ }
+
+ private static ObjectName createObjectName(String name)
+ {
+ ObjectName objecName;
+ try
+ {
+ objecName = new ObjectName(name);
+ }
+ catch (MalformedObjectNameException e)
+ {
+ throw new IllegalArgumentException("'" + name + "' is not
a valid ObjectName");
+ }
+ return objecName;
+ }
+
+ public static boolean isRegistered(String name)
+ {
+ MBeanServer server = MBeanServerLocator.locateJBoss();
+ return server.isRegistered(createObjectName(name));
+ }
+
+ public String getVersion()
+ {
+ return portalServer.getVersion().toString();
+ }
+}
\ No newline at end of file
Added:
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalDiscovery.java
===================================================================
---
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalDiscovery.java
(rev 0)
+++
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalDiscovery.java 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,65 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 (at your option) any later version. *
+ * *
+ * This software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.jopr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+import org.jboss.portal.jopr.PortalComponent;
+
+import java.util.HashSet;
+import java.util.Set;
+
+
+/** Discovery class */
+public class PortalDiscovery implements
ResourceDiscoveryComponent<PortalComponent>
+{
+ private final Log log = LogFactory.getLog(this.getClass());
+
+
+ /** Run the discovery */
+ public Set<DiscoveredResourceDetails>
discoverResources(ResourceDiscoveryContext<PortalComponent> discoveryContext) throws
Exception
+ {
+
+ Set<DiscoveredResourceDetails> discoveredResources = new
HashSet<DiscoveredResourceDetails>();
+
+ /**
+ * A discovered resource must have a unique key, that must
+ * stay the same when the resource is discovered the next
+ * time
+ */
+ DiscoveredResourceDetails detail = new
DiscoveredResourceDetails(discoveryContext.getResourceType(), "Portal",
+ discoveryContext.getParentResourceComponent().getVersion(),
"1.0.0.Alpha1", "Monitoring of JBoss Portal resources", null, null);
+
+
+ // Add to return values
+ discoveredResources.add(detail);
+ log.info("Discovered new Portal");
+
+ return discoveredResources;
+
+ }
+}
\ No newline at end of file
Added:
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalEventPoller.java
===================================================================
---
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalEventPoller.java
(rev 0)
+++
modules/jopr-plugin/trunk/plugin/src/main/java/org/jboss/portal/jopr/PortalEventPoller.java 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,73 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 (at your option) any later version. *
+ * *
+ * This software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+
+package org.jboss.portal.jopr;
+
+
+import org.rhq.core.domain.event.Event;
+import org.rhq.core.pluginapi.event.EventPoller;
+import org.jboss.portal.jopr.PortalComponent;
+
+import java.util.HashSet;
+import java.util.Set;
+
+
+public class PortalEventPoller implements EventPoller
+{
+
+ public PortalEventPoller()
+ {
+
+ }
+
+
+ /**
+ * Return the type of events we handle
+ *
+ * @see org.rhq.core.pluginapi.event.EventPoller#getEventType()
+ */
+ public String getEventType()
+ {
+ return PortalComponent.DUMMY_EVENT;
+ }
+
+
+ /**
+ * Return collected events
+ *
+ * @see org.rhq.core.pluginapi.event.EventPoller#poll()
+ */
+ public Set<Event> poll()
+ {
+ Set<Event> eventSet = new HashSet<Event>();
+ // TODO add your events here. Below is an example that
+ /*
+ synchronized (events) {
+ eventSet.addAll(events);
+ events.clear();
+ }
+ */
+ return eventSet;
+ }
+
+}
\ No newline at end of file
Added: modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
===================================================================
--- modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml
(rev 0)
+++ modules/jopr-plugin/trunk/plugin/src/main/resources/META-INF/rhq-plugin.xml 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,35 @@
+<?xml version="1.0"?>
+<plugin name="portal-jopr-plugin"
+ displayName="JBossPortalPlugin"
+ package="org.jboss.portal.jopr.plugin"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="urn:xmlns:rhq-plugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+
+ <server name="portal-jopr-plugin"
+ discovery="PortalDiscovery"
+ class="PortalComponent"
+ singleton="true"
+ supportsManualAdd="true"
+ createDeletePolicy="both">
+
+ <!--<plugin-configuration>
+ --><!-- TODO add your own here --><!--
+ </plugin-configuration>-->
+
+ <operation name="refreshPortletList" description="Refreshes the
portlet list"/>
+
+ <metric property="portletNumber" displayName="Display the number
of currently deployed portlets"/>
+
+ <!--<event name="portal-jopr-pluginDummyEvent"/>-->
+
+ <!--<resource-configuration>
+ --><!-- TODO supply your configuration parameters --><!--
+ </resource-configuration>-->
+
+
+ </server>
+
+
+</plugin>
\ No newline at end of file
Added: modules/jopr-plugin/trunk/pom.xml
===================================================================
--- modules/jopr-plugin/trunk/pom.xml (rev 0)
+++ modules/jopr-plugin/trunk/pom.xml 2009-04-23 16:49:20 UTC (rev 13266)
@@ -0,0 +1,37 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.jboss.portal.jopr</groupId>
+ <artifactId>module-aggregator</artifactId>
+ <packaging>pom</packaging>
+ <name>JBoss Portal JOPR Plugin Module (aggregator)</name>
+ <version>1.0.0-SNAPSHOT</version>
+ <
url>http://www.jboss.org/jbossportal</url>
+
+ <dependencies/>
+
+ <!--Repository definition needed to deploy artifacts into JBoss maven
repositories-->
+ <distributionManagement>
+ <repository>
+ <!--Copy the distribution jar file to a local checkout of the maven
repository
+ - This variable can be set in $MAVEN_HOME/conf/settings.xml-->
+ <id>repository.jboss.org</id>
+ <url>file://${jboss.repository.root}</url>
+ </repository>
+ <snapshotRepository>
+ <id>snapshots.jboss.org</id>
+ <name>JBoss Snapshot Repository</name>
+ <
url>dav:https://snapshots.jboss.org/maven2</url>
+ <uniqueVersion>true</uniqueVersion>
+ </snapshotRepository>
+ </distributionManagement>
+
+ <modules>
+ <module>build</module>
+ <module>portal-management</module>
+ <module>portal-management-service</module>
+ <module>plugin</module>
+ </modules>
+
+
+</project>
\ No newline at end of file
Added: modules/jopr-plugin/trunk/portal-management/pom.xml
===================================================================
--- modules/jopr-plugin/trunk/portal-management/pom.xml (rev 0)
+++ modules/jopr-plugin/trunk/portal-management/pom.xml 2009-04-23 16:49:20 UTC (rev
13266)
@@ -0,0 +1,71 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.jopr</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>portal-management</artifactId>
+ <packaging>jar</packaging>
+ <name>JBoss Portal JOPR Plugin: Portal Management</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>jems</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.core</groupId>
+ <artifactId>server</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-management</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.portal.portlet</groupId>
+ <artifactId>portlet-federation</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-system</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jboss-common</artifactId>
+ </dependency>
+ </dependencies>
+
+
+ <build>
+ <plugins>
+ <!--<plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>-->
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.0-beta-1</version>
+
+ <!-- Enable packaging types and lifecycle bindings. -->
+ <extensions>true</extensions>
+ <configuration>
+ <excludeAll>true</excludeAll>
+ <primaryArtifact>false</primaryArtifact>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/Portal.java
===================================================================
---
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/Portal.java
(rev 0)
+++
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/Portal.java 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,38 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 (at your option) any later version. *
+ * *
+ * This software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.management;
+
+import javax.management.ObjectName;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8784 $
+ */
+public interface Portal
+{
+
+ public int getNbInstances();
+
+ Map<String, ObjectName> getRegisteredPortletMappings();
+}
Added:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java
===================================================================
---
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java
(rev 0)
+++
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortalImpl.java 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,77 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 (at your option) any later version. *
+ * *
+ * This software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.management;
+
+import org.jboss.portal.core.impl.model.instance.InstanceContainerContext;
+import org.jboss.portal.jems.as.system.AbstractJBossService;
+
+import javax.management.ObjectName;
+import javax.naming.InitialContext;
+import javax.transaction.UserTransaction;
+import java.util.Map;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8805 $
+ */
+public class PortalImpl extends AbstractJBossService implements Portal
+{
+
+ private InstanceContainerContext containerContext;
+ private PortletDiscoveryService discoveryService;
+
+ public int getNbInstances()
+ {
+ int nbInstances = -1;
+ try
+ {
+ InitialContext ctx = new InitialContext();
+ UserTransaction tx;
+ tx = (UserTransaction)ctx.lookup("UserTransaction");
+ tx.begin();
+ nbInstances = containerContext.getInstanceDefinitions().size();
+ tx.commit();
+ }
+ catch (Exception e)
+ {
+ // FIXME
+ e.printStackTrace();
+ }
+ return nbInstances;
+ }
+
+ public Map<String, ObjectName> getRegisteredPortletMappings()
+ {
+ return discoveryService.getRegisteredPortlets();
+ }
+
+ public void setContainerContext(InstanceContainerContext containerContext)
+ {
+ this.containerContext = containerContext;
+ }
+
+ public void setDiscoveryService(PortletDiscoveryService discoveryService)
+ {
+ this.discoveryService = discoveryService;
+ }
+}
Added:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
===================================================================
---
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java
(rev 0)
+++
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/PortletDiscoveryService.java 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,148 @@
+package org.jboss.portal.management;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.federation.FederatedPortletInvoker;
+import org.jboss.portal.portlet.federation.FederatingPortletInvoker;
+import org.jboss.portal.portlet.management.LocalPortletManagement;
+import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
+import org.jboss.portal.portlet.management.PortletInfo;
+import org.jboss.system.ServiceMBeanSupport;
+
+import javax.management.ObjectName;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Collections;
+
+public class PortletDiscoveryService extends ServiceMBeanSupport
+{
+ public static final String WSRP_JMX_PREFIX =
"portal.management:service=Management,type=WSRPPorlet,name=";
+ public static final String LOCAL_JMX_PREFIX =
"portal.management:service=Management,type=LocalPortlet,name=";
+
+ private PortletContainerManagementInterceptor interceptor;
+
+ private FederatingPortletInvoker federatingPortletInvoker;
+
+ private Map<String, ObjectName> registeredPortlets = new HashMap<String,
ObjectName>();
+
+ public void start()
+ {
+ try
+ {
+ processPortletDiscovery();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public void stop()
+ {
+ for (ObjectName objectName : registeredPortlets.values())
+ {
+ try
+ {
+ getServer().unregisterMBean(objectName);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ if (registeredPortlets.size() != 0)
+ {
+ log.error("Unable to remove all the Portlet management MBeans");
+ }
+ }
+
+ public FederatingPortletInvoker getFederatingPortletInvoker()
+ {
+ return federatingPortletInvoker;
+ }
+
+ public void setFederatingPortletInvoker(FederatingPortletInvoker
federatingPortletInvoker)
+ {
+ this.federatingPortletInvoker = federatingPortletInvoker;
+ }
+
+ public void setInterceptor(PortletContainerManagementInterceptor interceptor)
+ {
+ this.interceptor = interceptor;
+ }
+
+ public void processPortletDiscovery() throws Exception
+ {
+ Collection<FederatedPortletInvoker> federatedInvokers =
federatingPortletInvoker.getFederatedInvokers();
+ for (FederatedPortletInvoker federatedPortletInvoker : federatedInvokers)
+ {
+ if (federatedPortletInvoker.getId().equals("local"))
+ {
+ registerPortlets(federatedPortletInvoker.getPortlets(), false);
+ }
+ else
+ {
+ registerPortlets(federatedPortletInvoker.getPortlets(), true);
+ }
+ }
+ }
+
+ public Map<String, ObjectName> getRegisteredPortlets()
+ {
+ return Collections.unmodifiableMap(registeredPortlets);
+ }
+
+ private void registerPortlets(Collection<Portlet> portlets, boolean wsrp)
+ {
+ for (Portlet portlet : portlets)
+ {
+ String portletId = portlet.getContext().getId();
+
+ boolean used = interceptor.getPortletInfo(portletId).isUsed();
+ if ((!registeredPortlets.containsKey(portletId)) && (used))
+ {
+ try
+ {
+ ObjectName objectName = createManagementMBean(portlet, wsrp);
+ registeredPortlets.put(portletId, objectName);
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+ }
+
+ private ObjectName createManagementMBean(Portlet portlet, boolean wsrp) throws
Exception
+ {
+ Object management;
+ if (wsrp)
+ {
+ management = new WSRPPortletManagement(portlet, interceptor);
+ }
+ else
+ {
+ management = new LocalPortletManagement(portlet, interceptor);
+ }
+ String id = portlet.getContext().getId();
+ ObjectName objectName = new ObjectName(getMBeanName(id, wsrp));
+ getServer().registerMBean(management, objectName);
+ log.debug("Registered Management MBean for: " + id);
+ return objectName;
+ }
+
+ private String getMBeanName(String id, boolean wsrp)
+ {
+ if (wsrp)
+ {
+ return WSRP_JMX_PREFIX + id;
+ }
+ else
+ {
+ return LOCAL_JMX_PREFIX + id;
+ }
+ }
+
+}
Added:
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/WSRPPortletManagement.java
===================================================================
---
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/WSRPPortletManagement.java
(rev 0)
+++
modules/jopr-plugin/trunk/portal-management/src/main/java/org/jboss/portal/management/WSRPPortletManagement.java 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,88 @@
+/******************************************************************************
+ * JBoss, a division of Red Hat *
+ * Copyright 2006, Red Hat Middleware, LLC, and individual *
+ * contributors as indicated by the @authors tag. See the *
+ * copyright.txt in the distribution for a full listing of *
+ * individual contributors. *
+ * *
+ * This 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 (at your option) any later version. *
+ * *
+ * This software 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 software; if not, write to the Free *
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org. *
+ ******************************************************************************/
+package org.jboss.portal.management;
+
+import org.jboss.portal.portlet.Portlet;
+import org.jboss.portal.portlet.management.PortletContainerManagementInterceptor;
+
+/**
+ * @author <a href="mailto:theute@jboss.org">Thomas Heute</a>
+ * @version $Revision: 8784 $
+ */
+public class WSRPPortletManagement implements
org.jboss.portal.portlet.management.LocalPortletManagementMBean
+{
+ private Portlet portlet;
+
+ private PortletContainerManagementInterceptor interceptor;
+
+ public WSRPPortletManagement(Portlet portlet, PortletContainerManagementInterceptor
interceptor)
+ {
+ this.portlet = portlet;
+ this.interceptor = interceptor;
+ }
+
+ public String getId()
+ {
+ return portlet.getContext().getId();
+ }
+
+ public float getAverageRenderTime()
+ {
+ return interceptor.getPortletInfo(getId()).getAverageRenderTime();
+ }
+
+ public float getAverageActionTime()
+ {
+ return interceptor.getPortletInfo(getId()).getAverageActionTime();
+ }
+
+ public long getMaxRenderTime()
+ {
+ return interceptor.getPortletInfo(getId()).getMaxRenderTime();
+ }
+
+ public long getMaxActionTime()
+ {
+ return interceptor.getPortletInfo(getId()).getMaxActionTime();
+ }
+
+ public long getRenderRequestCount()
+ {
+ return interceptor.getPortletInfo(getId()).getRenderRequestCount();
+ }
+
+ public long getActionRequestCount()
+ {
+ return interceptor.getPortletInfo(getId()).getActionRequestCount();
+ }
+
+ public long getActionErrorCount()
+ {
+ return interceptor.getPortletInfo(getId()).getActionErrorCount();
+ }
+
+ public long getRenderErrorCount()
+ {
+ return interceptor.getPortletInfo(getId()).getRenderErrorCount();
+ }
+}
Added: modules/jopr-plugin/trunk/portal-management-service/pom.xml
===================================================================
--- modules/jopr-plugin/trunk/portal-management-service/pom.xml
(rev 0)
+++ modules/jopr-plugin/trunk/portal-management-service/pom.xml 2009-04-23 16:49:20 UTC
(rev 13266)
@@ -0,0 +1,64 @@
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <parent>
+ <groupId>org.jboss.portal.jopr</groupId>
+ <artifactId>module-parent</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <relativePath>../build/pom.xml</relativePath>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>portal-management-service</artifactId>
+ <packaging>jboss-sar</packaging>
+ <name>JBoss Portal JOPR Plugin: Portal Management Service</name>
+
+ <!--<dependencies>
+ <dependency>
+ <groupId>org.jboss.portal.jopr</groupId>
+ <artifactId>portal-management</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+-->
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.0</version>
+ <executions>
+ <execution>
+ <id>copy-portal-jopr-plugin-jar</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.jboss.portal.jopr</groupId>
+ <artifactId>portal-management</artifactId>
+ <version>${project.version}</version>
+ </artifactItem>
+ </artifactItems>
+
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>jboss-packaging-maven-plugin</artifactId>
+ <version>2.0-beta-1</version>
+
+ <!-- Enable packaging types and lifecycle bindings. -->
+ <extensions>true</extensions>
+ <configuration>
+ <excludeAll>true</excludeAll>
+ <primaryArtifact>false</primaryArtifact>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added:
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml
===================================================================
---
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml
(rev 0)
+++
modules/jopr-plugin/trunk/portal-management-service/src/main/resources/META-INF/jboss-service.xml 2009-04-23
16:49:20 UTC (rev 13266)
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ ~ JBoss, a division of Red Hat ~
+ ~ Copyright 2006, Red Hat Middleware, LLC, and individual ~
+ ~ contributors as indicated by the @authors tag. See the ~
+ ~ copyright.txt in the distribution for a full listing of ~
+ ~ individual contributors. ~
+ ~ ~
+ ~ This 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 (at your option) any later version. ~
+ ~ ~
+ ~ This software 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 software; if not, write to the Free ~
+ ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA ~
+ ~ 02110-1301 USA, or see the FSF site:
http://www.fsf.org. ~
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+
+<server>
+
+ <!-- Portlet discovery executed every 30 seconds -->
+ <mbean
+ code="org.jboss.varia.scheduler.Scheduler"
+ name="portal:service=Management,type=Scheduler">
+ <attribute
+
name="SchedulableMBean">portal:service=Management,type=PortletDiscoveryManagement,name=Default</attribute>
+ <attribute
name="SchedulableMBeanMethod">processPortletDiscovery()</attribute>
+ <attribute name="InitialStartDate">NOW</attribute>
+ <attribute name="SchedulePeriod">30000</attribute>
+ <attribute name="InitialRepetitions">-1</attribute>
+ <attribute name="StartAtStartup">true</attribute>
+ </mbean>
+
+ <mbean
+ code="org.jboss.portal.core.management.PortalImpl"
+ name="portal.management:service=Management,type=Portal,name=Default"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <depends optional-attribute-name="ContainerContext"
proxy-type="attribute">portal:service=InstanceContainerContext</depends>
+ <depends optional-attribute-name="DiscoveryService"
proxy-type="attribute">portal:service=Management,type=PortletDiscoveryManagement,name=Default</depends>
+ <xmbean/>
+ </mbean>
+
+ <mbean
+ code="org.jboss.portal.identity.management.Identity"
+
name="portal.management:service=Management,type=Identity,name=Default">
+
<depends>portal:service=Module,type=IdentityServiceController</depends>
+ <xmbean/>
+ </mbean>
+
+ <mbean
+ code="org.jboss.portal.core.management.PortletDiscoveryService"
+
name="portal:service=Management,type=PortletDiscoveryManagement,name=Default"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <depends
+ optional-attribute-name="FederatingPortletInvoker"
+
proxy-type="attribute">portal:service=PortletInvoker,type=Federating</depends>
+ <depends
+ optional-attribute-name="Interceptor"
+
proxy-type="attribute">portal:service=Interceptor,type=Portlet,name=PortletContainerManagement</depends>
+ <xmbean/>
+ </mbean>
+
+ <mbean
+
code="org.jboss.portal.portlet.management.PortletContainerManagementInterceptorImpl"
+
name="portal:service=Interceptor,type=Portlet,name=PortletContainerManagement"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ </mbean>
+ <mbean
+
code="org.jboss.portal.server.impl.invocation.JBossInterceptorRegistration"
+
name="portal:service=InterceptorRegistration,type=Portlet,name=PortletContainerManagement"
+ xmbean-dd=""
+ xmbean-code="org.jboss.portal.jems.as.system.JBossServiceModelMBean">
+ <xmbean/>
+ <depends
+
optional-attribute-name="StackFactory">portal:service=InterceptorStackFactory,type=Instance</depends>
+ <depends
+
optional-attribute-name="InterceptorName">portal:service=Interceptor,type=Portlet,name=PortletContainerManagement</depends>
+ </mbean>
+</server>