You are viewing a plain text version of this content. The canonical link for it is here.
Posted to kalumet-commits@incubator.apache.org by jb...@apache.org on 2011/10/22 13:10:04 UTC
svn commit: r1187711 [5/5] - in /incubator/kalumet/trunk: ./ common/
common/src/ common/src/main/ common/src/main/java/
common/src/main/java/org/ common/src/main/java/org/apache/
common/src/main/java/org/apache/kalumet/ common/src/main/java/org/apache/...
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Software.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Software.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Software.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Software.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,323 @@
+/*
+ * 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.kalumet.model;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.LinkedList;
+
+import org.apache.xerces.dom.CoreDocumentImpl;
+import org.apache.xerces.dom.ElementImpl;
+import org.w3c.dom.Element;
+
+/**
+ * Represent the <code>software</code> tag in the Kalumet DOM.
+ */
+public class Software implements Serializable, Cloneable, Comparable {
+
+ private static final long serialVersionUID = 1464721106305749412L;
+
+ private String name;
+ private String uri;
+ private String agent;
+ private boolean active;
+ private boolean blocker;
+ private boolean beforejee;
+ private LinkedList updatePlan;
+
+ public Software() {
+ this.updatePlan = new LinkedList();
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUri() {
+ return uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public String getAgent() {
+ return agent;
+ }
+
+ public void setAgent(String agent) {
+ this.agent = agent;
+ }
+
+ public boolean isActive() {
+ return active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public boolean isBlocker() {
+ return blocker;
+ }
+
+ public void setBlocker(boolean blocker) {
+ this.blocker = blocker;
+ }
+
+ public boolean isBeforejee() {
+ return beforejee;
+ }
+
+ public void setBeforejee(boolean beforejee) {
+ this.beforejee = beforejee;
+ }
+
+ public LinkedList getUpdatePlan() {
+ return updatePlan;
+ }
+
+ public void setUpdatePlan(LinkedList updatePlan) {
+ this.updatePlan = updatePlan;
+ }
+
+ /**
+ * Get the software component with the given name.
+ *
+ * @param name the software component name.
+ * @return the component <code>Object</code> or <code>null</code> if not found.
+ */
+ public Object getComponent(String name) {
+ Object component = this.getLocation(name);
+ if (component != null) {
+ return component;
+ }
+ component = this.getCommand(name);
+ if (component != null) {
+ return component;
+ }
+ component = this.getConfigurationFile(name);
+ if (component != null) {
+ return component;
+ }
+ component = this.getDatabase(name);
+ if (component != null) {
+ return component;
+ }
+ return null;
+ }
+
+ /**
+ * Add a system command into the software update plan.
+ *
+ * @param command the system command
+ */
+ public void addCommand(Command command) throws ModelObjectAlreadyExistsException {
+ if (this.getComponent(command.getName()) != null) {
+ throw new ModelObjectAlreadyExistsException("Software component " + command.getName() + " already exists.");
+ }
+ updatePlan.add(command);
+ }
+
+ /**
+ * Get the command identified by <code>name</code> in the software update plan..
+ *
+ * @param name the command name.
+ * @return the <code>Command</code> or <code>null</code> if not found.
+ */
+ public Command getCommand(String name) {
+ for (Iterator updatePlanIterator = updatePlan.iterator(); updatePlanIterator.hasNext(); ) {
+ Object item = updatePlanIterator.next();
+ if (item instanceof Command) {
+ Command command = (Command) item;
+ if (command.getName().equals(name)) {
+ return command;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Add a <code>Location</code> into the software update plan.
+ *
+ * @param location the files/directories location
+ */
+ public void addLocation(Location location) throws ModelObjectAlreadyExistsException {
+ if (this.getComponent(location.getName()) != null) {
+ throw new ModelObjectAlreadyExistsException("Software component " + location.getName() + " already exists.");
+ }
+ updatePlan.add(location);
+ }
+
+ /**
+ * Get the <code>Location</code> identified by <code>name</code> in the software update plan..
+ *
+ * @param name the location name.
+ * @return the <code>Location</code> or <code>null</code> if not found.
+ */
+ public Location getLocation(String name) {
+ for (Iterator updatePlanIterator = updatePlan.iterator(); updatePlanIterator.hasNext(); ) {
+ Object item = updatePlanIterator.next();
+ if (item instanceof Location) {
+ Location location = (Location) item;
+ if (location.getName().equals(name)) {
+ return location;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Add a <code>ConfigurationFile</code> into the software update plan.
+ *
+ * @param configurationFile the configuration file.
+ */
+ public void addConfigurationFile(ConfigurationFile configurationFile) throws ModelObjectAlreadyExistsException {
+ if (this.getComponent(configurationFile.getName()) != null) {
+ throw new ModelObjectAlreadyExistsException("Software component " + configurationFile.getName() + " already exists.");
+ }
+ updatePlan.add(configurationFile);
+ }
+
+ /**
+ * Get the <code>ConfigurationFile</code> identified by <code>name</code> in the software update plan.
+ *
+ * @param name the configuration file name.
+ * @return the <code>ConfigurationFile</code> or <code>null</code> if not found.
+ */
+ public ConfigurationFile getConfigurationFile(String name) {
+ for (Iterator updatePlanIterator = updatePlan.iterator(); updatePlanIterator.hasNext(); ) {
+ Object item = updatePlanIterator.next();
+ if (item instanceof ConfigurationFile) {
+ ConfigurationFile configurationFile = (ConfigurationFile) item;
+ if (configurationFile.getName().equals(name)) {
+ return configurationFile;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Add a database (including SQL scripts) into the software update plan.
+ *
+ * @param database the database
+ */
+ public void addDatabase(Database database) throws ModelObjectAlreadyExistsException {
+ if (this.getComponent(database.getName()) != null) {
+ throw new ModelObjectAlreadyExistsException("Software component " + database.getName() + " already exists.");
+ }
+ updatePlan.add(database);
+ }
+
+ /**
+ * Get the <code>Database</code> identified by <code>name</code> in the software update plan.
+ *
+ * @param name the database name.
+ * @return the <code>Database</code> or <code>null</code> if not found.
+ */
+ public Database getDatabase(String name) {
+ for (Iterator updatePlanIterator = updatePlan.iterator(); updatePlanIterator.hasNext(); ) {
+ Object item = updatePlanIterator.next();
+ if (item instanceof Database) {
+ Database database = (Database) item;
+ if (database.getName().equals(name)) {
+ return database;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ public Object clone() throws CloneNotSupportedException {
+ Software clone = new Software();
+ clone.setName(this.getName());
+ clone.setUri(this.getUri());
+ clone.setActive(this.isActive());
+ clone.setBlocker(this.isBlocker());
+ clone.setBeforejee(this.isBeforejee());
+ for (Iterator updatePlanIterator = this.getUpdatePlan().iterator(); updatePlanIterator.hasNext(); ) {
+ Object item = updatePlanIterator.next();
+ if (item instanceof Command) {
+ clone.getUpdatePlan().add(((Command)item).clone());
+ }
+ if (item instanceof Location) {
+ clone.getUpdatePlan().add(((Location)item).clone());
+ }
+ if (item instanceof ConfigurationFile) {
+ clone.getUpdatePlan().add(((ConfigurationFile)item).clone());
+ }
+ if (item instanceof Database) {
+ clone.getUpdatePlan().add(((Database)item).clone());
+ }
+ }
+ return clone;
+ }
+
+ /**
+ * Transform a <code>software</code> into a DOM element.
+ *
+ * @param document the DOM document.
+ * @return the DOM element.
+ */
+ protected Element toDOMElement(CoreDocumentImpl document) {
+ ElementImpl element = new ElementImpl(document, "software");
+ element.setAttribute("name", this.getName());
+ element.setAttribute("uri", this.getUri());
+ element.setAttribute("agent", this.getAgent());
+ element.setAttribute("active", new Boolean(this.isActive()).toString());
+ element.setAttribute("blocker", new Boolean(this.isBlocker()).toString());
+ element.setAttribute("beforejee", new Boolean(this.isBeforejee()).toString());
+ ElementImpl updateplan = new ElementImpl(document, "updateplan");
+ element.appendChild(updateplan);
+ for (Iterator updatePlanIterator = this.getUpdatePlan().iterator(); updatePlanIterator.hasNext(); ) {
+ Object item = updatePlanIterator.next();
+ if (item instanceof Command) {
+ updateplan.appendChild(((Command)item).toDOMElement(document));
+ }
+ if (item instanceof Location) {
+ updateplan.appendChild(((Location)item).toDOMElement(document));
+ }
+ if (item instanceof ConfigurationFile) {
+ updateplan.appendChild(((ConfigurationFile)item).toDOMElement(document));
+ }
+ if (item instanceof Database) {
+ updateplan.appendChild(((Database)item).toDOMElement(document));
+ }
+ }
+ return element;
+ }
+
+ /**
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object anotherSoftware) {
+ return this.getName().compareTo(((Software)anotherSoftware).getName());
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/SqlScript.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/SqlScript.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/SqlScript.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/SqlScript.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,185 @@
+/*
+ * 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.kalumet.model;
+
+import java.io.Serializable;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.xerces.dom.CoreDocumentImpl;
+import org.apache.xerces.dom.ElementImpl;
+import org.w3c.dom.Element;
+
+/**
+ * Represent the <code>sqlscript</code> tag in the Kalumet configuration DOM.
+ */
+public class SqlScript implements Serializable, Cloneable, Comparable {
+
+ private static final long serialVersionUID = 2997968132530345317L;
+
+ private String name;
+ private String uri;
+ private boolean active;
+ private boolean blocker;
+ private boolean force;
+ private LinkedList mappings;
+
+ public SqlScript() {
+ this.mappings = new LinkedList();
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getUri() {
+ return this.uri;
+ }
+
+ public void setUri(String uri) {
+ this.uri = uri;
+ }
+
+ public boolean isActive() {
+ return this.active;
+ }
+
+ public void setActive(boolean active) {
+ this.active = active;
+ }
+
+ public boolean isBlocker() {
+ return this.blocker;
+ }
+
+ public void setBlocker(boolean blocker) {
+ this.blocker = blocker;
+ }
+
+ public boolean isForce() {
+ return this.force;
+ }
+
+ public void setForce(boolean force) {
+ this.force = force;
+ }
+
+ /**
+ * Add a new <code>Mapping</code> in the <code>SqlScript</code> mappings
+ * container.
+ *
+ * @param mapping the <code>Mapping</code> to add.
+ */
+ public void addMapping(Mapping mapping) throws ModelObjectAlreadyExistsException {
+ if (this.getMapping(mapping.getKey()) != null) {
+ throw new ModelObjectAlreadyExistsException("Mapping key already exists in sqlscript.");
+ }
+ this.mappings.add(mapping);
+ }
+
+ /**
+ * Get the <code>Mapping</code> list in the <code>SqlScript</code>
+ * mappings container.
+ *
+ * @return the <code>Mapping</code> list.
+ */
+ public List getMappings() {
+ return this.mappings;
+ }
+
+ /**
+ * Set the <code>Mapping</code> in the <code>SqlScript</code>
+ * mappings container.
+ *
+ * @param mappings the new <code>Mapping</code> list.
+ */
+ public void setMappings(LinkedList mappings) {
+ this.mappings = mappings;
+ }
+
+ /**
+ * Get the <code>Mapping</code> identified by a given key in the
+ * <code>SqlScript</code> mappings container.
+ *
+ * @param key the <code>Mapping</code> key.
+ * @return the <code>Mapping</code> found or null if not found.
+ */
+ public Mapping getMapping(String key) {
+ for (Iterator mappingIterator = this.getMappings().iterator(); mappingIterator.hasNext();) {
+ Mapping mapping = (Mapping) mappingIterator.next();
+ if (mapping.getKey().equals(key)) {
+ return mapping;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ public Object clone() throws CloneNotSupportedException {
+ SqlScript clone = new SqlScript();
+ clone.setName(this.getName());
+ clone.setUri(this.getUri());
+ clone.setActive(this.isActive());
+ clone.setBlocker(this.isBlocker());
+ clone.setForce(this.isForce());
+ for (Iterator mappingIterator = this.mappings.iterator(); mappingIterator.hasNext(); ) {
+ Mapping mapping = (Mapping)mappingIterator.next();
+ clone.mappings.add((Mapping)mapping.clone());
+ }
+ return clone;
+ }
+
+ /**
+ * Transform the <code>SqlScript</code> POJO to a DOM element.
+ *
+ * @param document the DOM document.
+ * @return the DOM element.
+ */
+ protected Element toDOMElement(CoreDocumentImpl document) {
+ ElementImpl element = new ElementImpl(document, "sqlscript");
+ element.setAttribute("name", this.getName());
+ element.setAttribute("uri", this.getUri());
+ element.setAttribute("active", new Boolean(this.isActive()).toString());
+ element.setAttribute("blocker", new Boolean(this.isBlocker()).toString());
+ element.setAttribute("force", new Boolean(this.isForce()).toString());
+ // mappings
+ ElementImpl mappings = new ElementImpl(document, "mappings");
+ for (Iterator mappingIterator = this.getMappings().iterator(); mappingIterator.hasNext();) {
+ Mapping mapping = (Mapping) mappingIterator.next();
+ mappings.appendChild(mapping.toDOMElement(document));
+ }
+ element.appendChild(mappings);
+ return element;
+ }
+
+ /**
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object anotherSqlScript) {
+ return this.getName().compareTo(((SqlScript)anotherSqlScript).getName());
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Statistics.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Statistics.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Statistics.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Statistics.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,92 @@
+/*
+ * 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.kalumet.model;
+
+import java.io.Serializable;
+
+import org.apache.xerces.dom.CoreDocumentImpl;
+import org.apache.xerces.dom.ElementImpl;
+import org.w3c.dom.Element;
+
+/**
+ * Store environment statistics (number of update, etc).
+ *
+ */
+public class Statistics implements Serializable, Cloneable {
+
+ private static final long serialVersionUID = -6110824574514994557L;
+
+ private int updateCount;
+ private String lastUpdateDate;
+ private String lastChangeDate;
+
+ public Statistics() {
+ updateCount = 0;
+ }
+
+ public int getUpdateCount() {
+ return updateCount;
+ }
+
+ public void setUpdateCount(int updateCount) {
+ this.updateCount = updateCount;
+ }
+
+ public String getLastUpdateDate() {
+ return lastUpdateDate;
+ }
+
+ public void setLastUpdateDate(String lastUpdateDate) {
+ this.lastUpdateDate = lastUpdateDate;
+ }
+
+ public String getLastChangeDate() {
+ return lastChangeDate;
+ }
+
+ public void setLastChangeDate(String lastChangeDate) {
+ this.lastChangeDate = lastChangeDate;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ public Object clone() throws CloneNotSupportedException {
+ Statistics clone = new Statistics();
+ clone.setUpdateCount(this.getUpdateCount());
+ clone.setLastChangeDate(this.getLastChangeDate());
+ clone.setLastUpdateDate(this.getLastUpdateDate());
+ return clone;
+ }
+
+ /**
+ * Transform the <code>Statistics</code> POJO to a DOM element.
+ *
+ * @param document the DOM document.
+ * @return the DOM element.
+ */
+ protected Element toDOMElement(CoreDocumentImpl document) {
+ ElementImpl element = new ElementImpl(document, "statistics");
+ element.setAttribute("updatecount", new Integer(this.getUpdateCount()).toString());
+ element.setAttribute("lastupdatedate", this.getLastUpdateDate());
+ element.setAttribute("lastchangedate", this.getLastChangeDate());
+ return element;
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/User.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/User.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/User.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/User.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,158 @@
+/*
+ * 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.kalumet.model;
+
+import java.io.Serializable;
+import java.security.MessageDigest;
+
+import org.apache.kalumet.KalumetException;
+
+import org.apache.xerces.dom.CoreDocumentImpl;
+import org.apache.xerces.dom.ElementImpl;
+import org.w3c.dom.Element;
+
+/**
+ * Represent the <code>user</code> tag in the Kalumet configuration DOM.
+ */
+public class User implements Serializable, Cloneable, Comparable {
+
+ private static final long serialVersionUID = -1628759131745053332L;
+
+ private String id;
+ private String name;
+ private String email;
+ private String password;
+
+ public User() { }
+
+ public String getId() {
+ return this.id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getEmail() {
+ return this.email;
+ }
+
+ public void setEmail(String email) {
+ this.email = email;
+ }
+
+ /**
+ * <b>Warning : this method returns the encrypted password</b>
+ */
+ public String getPassword() {
+ return this.password;
+ }
+
+ /**
+ * <b>Warning : this method is expecting for an encrypted password</b>
+ */
+ public void setPassword(String password) {
+ this.password = password;
+ }
+
+ /**
+ * Encrypts MD5 of a given password.
+ *
+ * @param password the password to encrypt.
+ * @return the MD5 encrypted password.
+ */
+ public static String md5PasswordCrypt(String password) throws KalumetException {
+ try {
+ byte[] hash = MessageDigest.getInstance("MD5").digest(password.getBytes());
+ StringBuffer hashString = new StringBuffer();
+ for(int i = 0; i < hash.length; i++) {
+ String hex = Integer.toHexString(hash[i]);
+ if(hex.length() == 1) {
+ hashString.append('0');
+ hashString.append(hex.charAt(hex.length() - 1));
+ }
+ else {
+ hashString.append(hex.substring(hex.length() - 2));
+ }
+ }
+ return hashString.toString();
+ }
+ catch (Exception e) {
+ throw new KalumetException("Cant' crypt password.", e);
+ }
+ }
+
+ /**
+ * Check if a given password match the <code>User</code> password.
+ *
+ * @param password the given password.
+ * @return true of the password match the <code>User</code> password, false else.
+ */
+ public boolean checkPassword(String password) throws KalumetException {
+ String crypt = User.md5PasswordCrypt(password);
+ if (this.getPassword().equals(crypt)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ public Object clone() throws CloneNotSupportedException {
+ User clone = new User();
+ clone.setId(this.getId());
+ clone.setName(this.getName());
+ clone.setEmail(this.getEmail());
+ clone.setPassword(this.getPassword());
+ return clone;
+ }
+
+ /**
+ * Transform the <code>User</code> POJO to a DOM element.
+ *
+ * @param document the DOM document.
+ * @return the DOM element.
+ */
+ protected Element toDOMElement(CoreDocumentImpl document) {
+ ElementImpl element = new ElementImpl(document, "user");
+ element.setAttribute("id", this.getId());
+ element.setAttribute("name", this.getName());
+ element.setAttribute("email", this.getEmail());
+ element.setAttribute("password", this.getPassword());
+ return element;
+ }
+
+ /**
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object anotherUser) {
+ return this.getId().compareTo(((User)anotherUser).getId());
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Variable.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Variable.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Variable.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/model/Variable.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,85 @@
+/*
+ * 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.kalumet.model;
+
+import java.io.Serializable;
+
+import org.apache.xerces.dom.CoreDocumentImpl;
+import org.apache.xerces.dom.ElementImpl;
+import org.w3c.dom.Element;
+
+/**
+ * Represent a <code>variable</code> tag in the Kalumet configuration DOM.
+ */
+public class Variable implements Serializable, Cloneable, Comparable {
+
+ private static final long serialVersionUID = -7869565872871570323L;
+
+ private String name;
+ private String value;
+
+ public Variable() { }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getValue() {
+ return this.value;
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ public Object clone() throws CloneNotSupportedException {
+ Variable clone = new Variable();
+ clone.setName(this.getName());
+ clone.setValue(this.getValue());
+ return clone;
+ }
+
+ /**
+ * Transform the <code>Variable</code> POJO to a DOM Element.
+ *
+ * @param document the DOM document.
+ * @return the DOM element.
+ */
+ protected Element toDOMElement(CoreDocumentImpl document) {
+ ElementImpl element = new ElementImpl(document, "variable");
+ element.setAttribute("name", this.getName());
+ element.setAttribute("value", this.getValue());
+ return element;
+ }
+
+ /**
+ * @see java.lang.Comparable#compareTo(java.lang.Object)
+ */
+ public int compareTo(Object anotherVariable) {
+ return this.getName().compareTo(((Variable)anotherVariable).getName());
+ }
+
+}
\ No newline at end of file
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/AbstractClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/AbstractClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/AbstractClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/AbstractClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,44 @@
+/*
+ * 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.kalumet.ws.client;
+
+import org.apache.axis.client.Call;
+import org.apache.axis.client.Service;
+
+import java.net.URL;
+
+/**
+ * Abstract WS client.
+ */
+public abstract class AbstractClient {
+
+ protected Call call;
+
+ public AbstractClient(String url) throws ClientException {
+ try {
+ Service service = new Service();
+ this.call = (Call) service.createCall();
+ call.setTimeout(new Integer(Integer.MAX_VALUE));
+ call.setTargetEndpointAddress(new URL(url));
+ } catch (Exception e) {
+ throw new ClientException("Can't to the Kalumet agent WS server", e);
+ }
+ }
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/AgentClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/AgentClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/AgentClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/AgentClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.kalumet.ws.client;
+
+/**
+ * WebService client dedicated to Kalumet agent operations.
+ */
+public class AgentClient extends AbstractClient {
+
+ /**
+ * Default constructor.
+ *
+ * @param host the hostname or IP address of the Kalumet agent WS server.
+ * @param port the port number of the Kalumet agent WS server.
+ * @throws ClientException in case of connection failure.
+ */
+ public AgentClient(String host, int port) throws ClientException {
+ super("http://" + host + ":" + port + "/axis/services/AgentService");
+ }
+
+ /**
+ * Wrapper method to the get agent version.
+ *
+ * @return the agent version.
+ * @throws ClientException in case of communication failure.
+ */
+ public String getVersion() throws ClientException {
+ String version = null;
+ try {
+ version = (String) call.invoke("getVersion", null);
+ } catch (Exception e) {
+ throw new ClientException("Can't get agent version", e);
+ }
+ return version;
+ }
+
+ // TODO update method to fully update an agent
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ApplicationClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ApplicationClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ApplicationClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ApplicationClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.kalumet.ws.client;
+
+
+/**
+ * Application WS client.
+ */
+public class ApplicationClient extends AbstractClient {
+
+ /**
+ * Default constructor.
+ *
+ * @param host hostname or IP address of the Kalumet agent WS server.
+ * @param port port number of the Kalumet agent WS server.
+ * @throws ClientException in case of communication failure.
+ */
+ public ApplicationClient(String host, int port) throws ClientException {
+ super("http://" + host + ":" + port + "/axis/services/J2EEApplicationServer");
+ }
+
+ /**
+ * Wrapper method to update a J2EE application.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param applicationName
+ * @param delegation
+ * @throws ClientException
+ */
+ public void update(String environmentName, String applicationServerName, String applicationName, boolean delegation) throws ClientException {
+ try {
+ call.invoke("update", new Object[]{ environmentName, applicationServerName, applicationName, new Boolean(delegation) });
+ } catch (Exception e) {
+ throw new ClientException("J2EE application " + applicationName + " update failed", e);
+ }
+ }
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ArchiveClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ArchiveClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ArchiveClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ArchiveClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,75 @@
+/*
+ * 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.kalumet.ws.client;
+
+/**
+ * Archive WS client.
+ */
+public class ArchiveClient extends AbstractClient {
+
+ /**
+ * Default constructor.
+ *
+ * @param host the hostname or IP address of the Kalumet agent WS server.
+ * @param port the port number of the Kalumet agent WS server.
+ * @throws ClientException in case of communication failure.
+ */
+ public ArchiveClient(String host, int port) throws ClientException {
+ super("http://" + host + ":" + port + "/axis/services/J2EEApplicationArchiveService");
+ }
+
+ /**
+ * Wrapper method to call archive update.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param applicationName the target J2EE application name.
+ * @param archiveName the target archive name.
+ * @param delegation true if this call is a delegation from another agent, false else.
+ * @throws ClientException in case of communication failure.
+ */
+ public void update(String environmentName, String applicationServerName, String applicationName, String archiveName, boolean delegation) throws ClientException {
+ try {
+ call.invoke("update", new Object[]{ environmentName, applicationServerName, applicationName, archiveName, new Boolean(delegation) });
+ } catch (Exception e) {
+ throw new ClientException("J2EE archive " + archiveName + " update failed", e);
+ }
+ }
+
+ /**
+ * Wrapper method to call archive check.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param applicationName the target J2EE application name.
+ * @param archiveName the target archive name.
+ * @return true if the J2EE application archive is up to date, false else.
+ * @throws ClientException in case of communication failure.
+ */
+ public boolean check(String environmentName, String applicationServerName, String applicationName, String archiveName) throws ClientException {
+ boolean upToDate = false;
+ try {
+ upToDate = ((Boolean) call.invoke("check", new Object[]{ environmentName, applicationServerName, applicationName, archiveName })).booleanValue();
+ } catch (Exception e) {
+ throw new ClientException("J2EE archive " + archiveName + " check status failed", e);
+ }
+ return upToDate;
+ }
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ClientException.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ClientException.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ClientException.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ClientException.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,56 @@
+/*
+ * 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.kalumet.ws.client;
+
+import org.apache.kalumet.KalumetException;
+
+/**
+ * WebService client exception wrapper.
+ */
+public class ClientException extends KalumetException {
+
+ /**
+ * Create a WebService client exception with the explanation message.
+ *
+ * @param message the explanation message.
+ */
+ public ClientException(String message) {
+ super(message);
+ }
+
+ /**
+ * Create a WebService client exception with the cause.
+ *
+ * @param cause the cause.
+ */
+ public ClientException(Throwable cause) {
+ super(cause);
+ }
+
+ /**
+ * Create a WebService client exception with the explanation message and the cause.
+ *
+ * @param message the explanation message.
+ * @param cause the cause.
+ */
+ public ClientException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/CommandClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/CommandClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/CommandClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/CommandClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,54 @@
+/*
+ * 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.kalumet.ws.client;
+
+/**
+ * Command WS client.
+ */
+public class CommandClient extends AbstractClient {
+
+ /**
+ * Default constructor.
+ *
+ * @param host hostname or IP address of the Kalumet agent WS server.
+ * @param port port number of the Kalumet agent WS server.
+ * @throws ClientException in case of communication failure.
+ */
+ public CommandClient(String host, int port) throws ClientException {
+ super("http://" + host + ":" + port + "/axis/services/CommandService");
+ }
+
+ /**
+ * Wrapper method to execute a command.
+ *
+ * @param command the command to execute.
+ * @return the command output.
+ * @throws ClientException in case of communication failure.
+ */
+ public String execute(String command) throws ClientException {
+ String output = null;
+ try {
+ output = (String) call.invoke("execute", new Object[]{ command });
+ } catch (Exception e) {
+ throw new ClientException("Command " + command + " execute failed", e);
+ }
+ return output;
+ }
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ConfigurationFileClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ConfigurationFileClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ConfigurationFileClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ConfigurationFileClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,75 @@
+/*
+ * 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.kalumet.ws.client;
+
+/**
+ * ConfigurationFIle WS client.
+ */
+public class ConfigurationFileClient extends AbstractClient {
+
+ /**
+ * Default constructor.
+ *
+ * @param host the hostname or IP address of the Kalumet agent WS server.
+ * @param port the port number of the Kalumet agent WS server.
+ * @throws ClientException in case of communication failure.
+ */
+ public ConfigurationFileClient(String host, int port) throws ClientException {
+ super("http://" + host + ":" + port + "/axis/services/J2EEApplicationConfigurationFileService");
+ }
+
+ /**
+ * Wrapper method to update a J2EE application configuration file.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param applicationName the target J2EE application name.
+ * @param configurationFileName the target configuration file name.
+ * @param delegation true if the call is a delegation from another agent, false else.
+ * @throws ClientException in case of communication failure.
+ */
+ public void update(String environmentName, String applicationServerName, String applicationName, String configurationFileName, boolean delegation) throws ClientException {
+ try {
+ call.invoke("update", new Object[]{ environmentName, applicationServerName, applicationName, configurationFileName, new Boolean(delegation) });
+ } catch (Exception e) {
+ throw new ClientException("J2EE application configuration file " + configurationFileName + " update failed", e);
+ }
+ }
+
+ /**
+ * Wrapper method to check if the J2EE application configuration file is up to date.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param applicationName the target J2EE application name.
+ * @param configurationFileName the target configuration file name.
+ * @return true if the configuration file is up to date, false else.
+ * @throws ClientException in case of communication failure.
+ */
+ public boolean check(String environmentName, String applicationServerName, String applicationName, String configurationFileName) throws ClientException {
+ boolean upToDate = false;
+ try {
+ upToDate = ((Boolean) call.invoke("check", new Object[]{ environmentName, applicationServerName, applicationName, configurationFileName })).booleanValue();
+ } catch (Exception e) {
+ throw new ClientException("J2EE application configuration file " + configurationFileName + " status check failed", e);
+ }
+ return upToDate;
+ }
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ConnectionPoolClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ConnectionPoolClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ConnectionPoolClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ConnectionPoolClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,72 @@
+/*
+ * 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.kalumet.ws.client;
+
+/**
+ * J2EE application server Connection pool WS client.
+ */
+public class ConnectionPoolClient extends AbstractClient {
+
+ /**
+ * Default constructor.
+ *
+ * @param host hostname or IP address of the Kalumet agent WS server.
+ * @param port port number of the Kalumet agent WS server.
+ * @throws ClientException in case of communication failure.
+ */
+ public ConnectionPoolClient(String host, int port) throws ClientException {
+ super("http://" + host + ":" + port + "/axis/services/J2EEApplicationServerConnectionPoolService");
+ }
+
+ /**
+ * Wrapper method to update a connection pool in the J2EE application server.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param connectionPoolName the target connection pool name.
+ * @throws ClientException in case of communication failure.
+ */
+ public void update(String environmentName, String applicationServerName, String connectionPoolName) throws ClientException {
+ try {
+ call.invoke("update", new Object[]{ environmentName, applicationServerName, connectionPoolName });
+ } catch (Exception e) {
+ throw new ClientException("Connection pool " + connectionPoolName + " update failed", e);
+ }
+ }
+
+ /**
+ * Wrapper method to check if a connection pool is up to date or not.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param connectionPoolName the target connection pool name.
+ * @return true if the connection pool is up to date, false else.
+ * @throws ClientException in case of communication failure.
+ */
+ public boolean check(String environmentName, String applicationServerName, String connectionPoolName) throws ClientException {
+ boolean upToDate = false;
+ try {
+ upToDate = ((Boolean) call.invoke("check", new Object[]{ environmentName, applicationServerName, connectionPoolName })).booleanValue();
+ } catch (Exception e) {
+ throw new ClientException("Connection pool " + connectionPoolName + " status check failed", e);
+ }
+ return upToDate;
+ }
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ContentManagerClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ContentManagerClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ContentManagerClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/ContentManagerClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.kalumet.ws.client;
+
+/**
+ * Content manager WS client.
+ */
+public class ContentManagerClient extends AbstractClient {
+
+ /**
+ * Default constructor.
+ *
+ * @param host the hostname or UP address of the Kalumet agent WS server.
+ * @param port the port number of the Kalumet agent WS server.
+ * @throws ClientException in case of communication failure.
+ */
+ public ContentManagerClient(String host, int port) throws ClientException {
+ super("http://" + host + ":" + port + "/axis/services/J2EEApplicationContentManagerService");
+ }
+
+ /**
+ * Wrapper method to update a J2EE application content manager.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param applicationName the target J2EE application name.
+ * @param contentManagerName the target content manager name.
+ * @param delegation true if the call is a delegation from another agent, false else.
+ * @throws ClientException
+ */
+ public void update(String environmentName, String applicationServerName, String applicationName, String contentManagerName, boolean delegation) throws ClientException {
+ try {
+ call.invoke("update", new Object[]{ environmentName, applicationServerName, applicationName, contentManagerName, new Boolean(delegation) });
+ } catch (Exception e) {
+ throw new ClientException("Content manager " + contentManagerName + " update failed", e);
+ }
+ }
+
+}
Added: incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/DatabaseClient.java
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/DatabaseClient.java?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/DatabaseClient.java (added)
+++ incubator/kalumet/trunk/common/src/main/java/org/apache/kalumet/ws/client/DatabaseClient.java Sat Oct 22 13:10:01 2011
@@ -0,0 +1,55 @@
+/*
+ * 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.kalumet.ws.client;
+
+/**
+ * Database WS client.
+ */
+public class DatabaseClient extends AbstractClient {
+
+ /**
+ * Default constructor.
+ *
+ * @param host the hostname or IP address of the Kalumet agent WS server.
+ * @param port the port number of the Kalumet agent WS server.
+ * @throws ClientException in case of communication failure.
+ */
+ public DatabaseClient(String host, int port) throws ClientException {
+ super("http://" + host + ":" + port + "/axis/services/J2EEApplicationDatabaseService");
+ }
+
+ /**
+ * Wrapper method to update a database.
+ *
+ * @param environmentName the target environment name.
+ * @param applicationServerName the target J2EE application server name.
+ * @param applicationName the target J2EE application name.
+ * @param databaseName the target database name.
+ * @param delegation if true, the call is a delegation from another agent, false else.
+ * @throws ClientException in case of communication failure.
+ */
+ public void update(String environmentName, String applicationServerName, String applicationName, String databaseName, boolean delegation) throws ClientException {
+ try {
+ call.invoke("update", new Object[]{ environmentName, applicationServerName, applicationName, databaseName, new Boolean(delegation) });
+ } catch (Exception e) {
+ throw new ClientException("Database " + databaseName + " update failed", e);
+ }
+ }
+
+}
Added: incubator/kalumet/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/kalumet/trunk/pom.xml?rev=1187711&view=auto
==============================================================================
--- incubator/kalumet/trunk/pom.xml (added)
+++ incubator/kalumet/trunk/pom.xml Sat Oct 22 13:10:01 2011
@@ -0,0 +1,247 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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/xsd/maven-4.0.0.xsd">
+
+ <!--
+
+ 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.
+ -->
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache</groupId>
+ <artifactId>apache</artifactId>
+ <version>9</version>
+ </parent>
+
+ <groupId>org.apache.kalumet</groupId>
+ <artifactId>kalumet</artifactId>
+ <packaging>pom</packaging>
+ <version>0.6-incubating</version>
+ <name>Apache Kalumet</name>
+ <inceptionYear>2011</inceptionYear>
+
+ <modules>
+ <module>common</module>
+ </modules>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/incubator/kalumet/trunk</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/incubator/kalumet/trunk</developerConnection>
+ <url>http://svn.apache.org/viewvc/incubator/kalumet/trunk</url>
+ </scm>
+
+ <issueManagement>
+ <system>jira</system>
+ <url>https://issues.apache.org/jira/browse/KALUMET</url>
+ </issueManagement>
+
+ <mailingLists>
+ <mailingList>
+ <name>Kalumet Dev</name>
+ <subscribe>kalumet-dev-subscribe@incubator.apache.org</subscribe>
+ <unsubscribe>kalumet-dev-unsubscribe@incubator.apache.org</unsubscribe>
+ <post>-</post>
+ <archive>http://www.mail-archive.com/kalumet-dev%40incubator.apache.org</archive>
+ </mailingList>
+ <mailingList>
+ <name>Kalumet User</name>
+ <subscribe>kalumet-user-subscribe@incubator.apache.org</subscribe>
+ <unsubscribe>kalumet-user-unsubscribe@incubator.apache.org</unsubscribe>
+ <post>-</post>
+ <archive>http://www.mail-archive.com/kalumet-user%40incubator.apache.org</archive>
+ </mailingList>
+ <mailingList>
+ <name>Kalumet Commits</name>
+ <subscribe>kalumet-commits-subscribe@incubator.apache.org</subscribe>
+ <unsubscribe>kalumet-commits-unsubscribe@incubator.apache.org</unsubscribe>
+ <post>-</post>
+ <archive>http://www.mail-archive.com/kalumet-commits%40incubator.apache.org</archive>
+ </mailingList>
+ <mailingList>
+ <name>Kalumet Issues</name>
+ <subscribe>kalumet-issues-subscribe@incubator.apache.org</subscribe>
+ <unsubscribe>kalumet-issues-unsubscribe@incubator.apache.org</unsubscribe>
+ <post>-</post>
+ <archive>http://www.mail-archive.com/kalumet-issues%40incubator.apache.org</archive>
+ </mailingList>
+ </mailingLists>
+
+ <developers>
+ <developer>
+ <id>jbonofre</id>
+ <name>Jean-Baptiste Onofré</name>
+ <email>jbonofre@apache.org</email>
+ </developer>
+ <developer>
+ <id>olamy</id>
+ <name>Olivier Lamy</name>
+ <email>olamy@apache.org</email>
+ </developer>
+ <developer>
+ <id>imod</id>
+ <name>Dominik Bartholdi</name>
+ <email>domi@fortysix.ch</email>
+ </developer>
+ <developer>
+ <id>mduffy</id>
+ <name>Mike Duffy</name>
+ <email>micduffy@gmail.com</email>
+ </developer>
+ <developer>
+ <id>iocanel</id>
+ <name>Ioannis Canellos</name>
+ <email>iocanel@apache.org</email>
+ </developer>
+ <developer>
+ <id>pieber</id>
+ <name>Andreas Pieber</name>
+ <email>pieber@apache.org</email>
+ </developer>
+ <developer>
+ <id>anierbeck</id>
+ <name>Achim Nierbeck</name>
+ <email>anierbeck@apache.org</email>
+ </developer>
+ <developer>
+ <id>jgoodyear</id>
+ <name>Jamie Goodyear</name>
+ <email>jgoodyear@apache.org</email>
+ </developer>
+ <developer>
+ <id>yly</id>
+ <name>Youhort Ly</name>
+ <email>youhort@gmail.com</email>
+ </developer>
+ <developer>
+ <id>trimmer</id>
+ <name>Terri-Lynn Rimmer</name>
+ <email>one.pro.grammer@gmail.com</email>
+ </developer>
+ <developer>
+ <id>mikevan</id>
+ <name>Mike Ven Geertruy</name>
+ <email>mvangeertruy@comcast.net</email>
+ </developer>
+ </developers>
+
+ <prerequisites>
+ <maven>3.0.3</maven>
+ </prerequisites>
+
+ <properties>
+ <axis.version>1.4</axis.version>
+ <axis-wsdl4j.version>1.5.1</axis-wsdl4j.version>
+ <concurrent.version>1.3.4</concurrent.version>
+ <commons-digester.version>1.8.1</commons-digester.version>
+ <commons-io.version>2.1</commons-io.version>
+ <commons-lang.version>2.6</commons-lang.version>
+ <commons-vfs.version>1.0</commons-vfs.version>
+ <log4j.version>1.2.16</log4j.version>
+ <oro.version>2.0.8</oro.version>
+ <slf4j.version>1.6.3</slf4j.version>
+ <xerces.version>2.9.1</xerces.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis</artifactId>
+ <version>${axis.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-jaxrpc</artifactId>
+ <version>${axis.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-saaj</artifactId>
+ <version>${axis.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis</groupId>
+ <artifactId>axis-wsdl4j</artifactId>
+ <version>${axis-wsdl4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ <version>${concurrent.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-digester</groupId>
+ <artifactId>commons-digester</artifactId>
+ <version>${commons-digester.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons-io.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>${commons-lang.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-vfs</groupId>
+ <artifactId>commons-vfs</artifactId>
+ <version>${commons-vfs.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>oro</groupId>
+ <artifactId>oro</artifactId>
+ <version>${oro.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>xerces</groupId>
+ <artifactId>xercesImpl</artifactId>
+ <version>${xerces.version}</version>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>