From kalumet-commits-return-7-apmail-incubator-kalumet-commits-archive=incubator.apache.org@incubator.apache.org Sat Oct 22 13:10:44 2011 Return-Path: X-Original-To: apmail-incubator-kalumet-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-kalumet-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D46217FE7 for ; Sat, 22 Oct 2011 13:10:44 +0000 (UTC) Received: (qmail 18733 invoked by uid 500); 22 Oct 2011 13:10:44 -0000 Delivered-To: apmail-incubator-kalumet-commits-archive@incubator.apache.org Received: (qmail 18714 invoked by uid 500); 22 Oct 2011 13:10:44 -0000 Mailing-List: contact kalumet-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: kalumet-dev@incubator.apache.org Delivered-To: mailing list kalumet-commits@incubator.apache.org Received: (qmail 18707 invoked by uid 99); 22 Oct 2011 13:10:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Oct 2011 13:10:44 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 22 Oct 2011 13:10:30 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 545122388AB9; Sat, 22 Oct 2011 13:10:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: 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/... Date: Sat, 22 Oct 2011 13:10:04 -0000 To: kalumet-commits@incubator.apache.org From: jbonofre@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20111022131007.545122388AB9@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 software 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 Object or null 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 name in the software update plan.. + * + * @param name the command name. + * @return the Command or null 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 Location 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 Location identified by name in the software update plan.. + * + * @param name the location name. + * @return the Location or null 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 ConfigurationFile 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 ConfigurationFile identified by name in the software update plan. + * + * @param name the configuration file name. + * @return the ConfigurationFile or null 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 Database identified by name in the software update plan. + * + * @param name the database name. + * @return the Database or null 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 software 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 sqlscript 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 Mapping in the SqlScript mappings + * container. + * + * @param mapping the Mapping 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 Mapping list in the SqlScript + * mappings container. + * + * @return the Mapping list. + */ + public List getMappings() { + return this.mappings; + } + + /** + * Set the Mapping in the SqlScript + * mappings container. + * + * @param mappings the new Mapping list. + */ + public void setMappings(LinkedList mappings) { + this.mappings = mappings; + } + + /** + * Get the Mapping identified by a given key in the + * SqlScript mappings container. + * + * @param key the Mapping key. + * @return the Mapping 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 SqlScript 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 Statistics 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 user 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; + } + + /** + * Warning : this method returns the encrypted password + */ + public String getPassword() { + return this.password; + } + + /** + * Warning : this method is expecting for an encrypted password + */ + 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 User password. + * + * @param password the given password. + * @return true of the password match the User 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 User 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 variable 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 Variable 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 @@ + + + + + + 4.0.0 + + + org.apache + apache + 9 + + + org.apache.kalumet + kalumet + pom + 0.6-incubating + Apache Kalumet + 2011 + + + common + + + + scm:svn:http://svn.apache.org/repos/asf/incubator/kalumet/trunk + scm:svn:https://svn.apache.org/repos/asf/incubator/kalumet/trunk + http://svn.apache.org/viewvc/incubator/kalumet/trunk + + + + jira + https://issues.apache.org/jira/browse/KALUMET + + + + + Kalumet Dev + kalumet-dev-subscribe@incubator.apache.org + kalumet-dev-unsubscribe@incubator.apache.org + - + http://www.mail-archive.com/kalumet-dev%40incubator.apache.org + + + Kalumet User + kalumet-user-subscribe@incubator.apache.org + kalumet-user-unsubscribe@incubator.apache.org + - + http://www.mail-archive.com/kalumet-user%40incubator.apache.org + + + Kalumet Commits + kalumet-commits-subscribe@incubator.apache.org + kalumet-commits-unsubscribe@incubator.apache.org + - + http://www.mail-archive.com/kalumet-commits%40incubator.apache.org + + + Kalumet Issues + kalumet-issues-subscribe@incubator.apache.org + kalumet-issues-unsubscribe@incubator.apache.org + - + http://www.mail-archive.com/kalumet-issues%40incubator.apache.org + + + + + + jbonofre + Jean-Baptiste Onofré + jbonofre@apache.org + + + olamy + Olivier Lamy + olamy@apache.org + + + imod + Dominik Bartholdi + domi@fortysix.ch + + + mduffy + Mike Duffy + micduffy@gmail.com + + + iocanel + Ioannis Canellos + iocanel@apache.org + + + pieber + Andreas Pieber + pieber@apache.org + + + anierbeck + Achim Nierbeck + anierbeck@apache.org + + + jgoodyear + Jamie Goodyear + jgoodyear@apache.org + + + yly + Youhort Ly + youhort@gmail.com + + + trimmer + Terri-Lynn Rimmer + one.pro.grammer@gmail.com + + + mikevan + Mike Ven Geertruy + mvangeertruy@comcast.net + + + + + 3.0.3 + + + + 1.4 + 1.5.1 + 1.3.4 + 1.8.1 + 2.1 + 2.6 + 1.0 + 1.2.16 + 2.0.8 + 1.6.3 + 2.9.1 + + + + + + axis + axis + ${axis.version} + + + axis + axis-jaxrpc + ${axis.version} + + + axis + axis-saaj + ${axis.version} + + + axis + axis-wsdl4j + ${axis-wsdl4j.version} + + + concurrent + concurrent + ${concurrent.version} + + + commons-digester + commons-digester + ${commons-digester.version} + + + commons-io + commons-io + ${commons-io.version} + + + commons-lang + commons-lang + ${commons-lang.version} + + + commons-vfs + commons-vfs + ${commons-vfs.version} + + + log4j + log4j + ${log4j.version} + + + oro + oro + ${oro.version} + + + org.slf4j + slf4j-api + ${slf4j.version} + + + org.slf4j + slf4j-log4j12 + ${slf4j.version} + + + xerces + xercesImpl + ${xerces.version} + + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + + +